Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

add method to patch an image#188

Merged
cmoog merged 2 commits intocoder:masterfromjmcampanini:jc/add-updateimage
Nov 16, 2020
Merged
Changes fromall 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
16 changes: 16 additions & 0 deletionscoder-sdk/image.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand All@@ -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)
}

[8]ページ先頭

©2009-2025 Movatter.jp