diff --git a/coder-sdk/image.go b/coder-sdk/image.go index 78fad426..2ecaaba9 100644 --- a/coder-sdk/image.go +++ b/coder-sdk/image.go @@ -44,6 +44,17 @@ type ImportImageReq struct { URL string `json:"url"` } +// UpdateImageReq defines the requests parameters for a partial update of an image resource. +type UpdateImageReq struct { + DefaultCPUCores *float32 `json:"default_cpu_cores"` + DefaultMemoryGB *int `json:"default_memory_gb"` + DefaultDiskGB *int `json:"default_disk_gb"` + Description *string `json:"description"` + URL *string `json:"url"` + Deprecated *bool `json:"deprecated"` + DefaultTag *string `json:"default_tag"` +} + // ImportImage creates a new image and optionally a new registry. func (c Client) ImportImage(ctx context.Context, orgID string, req ImportImageReq) (*Image, error) { var img Image @@ -61,3 +72,8 @@ func (c Client) OrganizationImages(ctx context.Context, orgID string) ([]Image, } return imgs, nil } + +// UpdateImage applies a partial update to an image resource. +func (c Client) UpdateImage(ctx context.Context, imageID string, req UpdateImageReq) error { + return c.requestBody(ctx, http.MethodPatch, "/api/images/"+imageID, req, nil) +}