Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 6236498

Browse files
committed
add sdk method to patch an image
1 parent ce06c53 commit 6236498

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

coder-sdk/image.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@ type ImportImageReq struct {
4444
URL string `json:"url"`
4545
}
4646

47+
// UpdateImageReq defines the requests parameters for a partial update of an image resource.
48+
type UpdateImageReq struct {
49+
DefaultCPUCores *float32 `json:"default_cpu_cores"`
50+
DefaultMemoryGB *int `json:"default_memory_gb"`
51+
DefaultDiskGB *int `json:"default_disk_gb"`
52+
Description *string `json:"description"`
53+
URL *string `json:"url"`
54+
Deprecated *bool `json:"deprecated"`
55+
}
56+
4757
// ImportImage creates a new image and optionally a new registry.
4858
func (c Client) ImportImage(ctx context.Context, orgID string, req ImportImageReq) (*Image, error) {
4959
var img Image
@@ -61,3 +71,8 @@ func (c Client) OrganizationImages(ctx context.Context, orgID string) ([]Image,
6171
}
6272
return imgs, nil
6373
}
74+
75+
// UpdateImage applies a partial update to an image resource.
76+
func (c Client) UpdateImage(ctx context.Context, imageID string, req UpdateImageReq) error {
77+
return c.requestBody(ctx, http.MethodPatch, "/api/images/"+imageID, req, nil)
78+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy