Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion hcloud/schema/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ type ServerActionDisableRescueResponse struct {
// ServerActionRebuildRequest defines the schema for the request to
// rebuild a server.
type ServerActionRebuildRequest struct {
Image IDOrName `json:"image"`
Image IDOrName `json:"image"`
UserData *string `json:"user_data,omitempty"`
}

// ServerActionRebuildResponse defines the schema of the response when
Expand Down
5 changes: 3 additions & 2 deletions hcloud/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,8 @@ func (c *ServerClient) DisableRescue(ctx context.Context, server *Server) (*Acti

// ServerRebuildOpts specifies options for rebuilding a server.
type ServerRebuildOpts struct {
Image *Image
Image *Image
UserData *string
}

// ServerRebuildResult is the result of a create server call.
Expand All @@ -754,7 +755,7 @@ func (c *ServerClient) RebuildWithResult(ctx context.Context, server *Server, op

reqPath := fmt.Sprintf(opPath, server.ID)

reqBody := schema.ServerActionRebuildRequest{}
reqBody := schema.ServerActionRebuildRequest{UserData: opts.UserData}
if opts.Image.ID != 0 || opts.Image.Name != "" {
reqBody.Image = schema.IDOrName{ID: opts.Image.ID, Name: opts.Image.Name}
}
Expand Down