Skip to content

Commit

Permalink
images: Support updating distribution and description. (digitalocean#413
Browse files Browse the repository at this point in the history
)
  • Loading branch information
andrewsomething authored Nov 13, 2020
1 parent f70bf7f commit 45fcf9e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion images.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ type Image struct {

// ImageUpdateRequest represents a request to update an image.
type ImageUpdateRequest struct {
Name string `json:"name"`
Name string `json:"name,omitempty"`
Distribution string `json:"distribution,omitempty"`
Description string `json:"description,omitempty"`
}

// CustomImageCreateRequest represents a request to create a custom image.
Expand Down
8 changes: 6 additions & 2 deletions images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,12 +353,16 @@ func TestImages_Update(t *testing.T) {
defer teardown()

updateRequest := &ImageUpdateRequest{
Name: "name",
Name: "name",
Distribution: "Fedora",
Description: "Just testing...",
}

mux.HandleFunc("/v2/images/12345", func(w http.ResponseWriter, r *http.Request) {
expected := map[string]interface{}{
"name": "name",
"name": "name",
"distribution": "Fedora",
"description": "Just testing...",
}

var v map[string]interface{}
Expand Down

0 comments on commit 45fcf9e

Please sign in to comment.