@@ -16,6 +16,7 @@ import (
1616 "github.com/sfcompute/nodes-go/option"
1717 "github.com/sfcompute/nodes-go/packages/param"
1818 "github.com/sfcompute/nodes-go/packages/respjson"
19+ "github.com/sfcompute/nodes-go/shared/constant"
1920)
2021
2122// Custom machine images for instances.
@@ -69,9 +70,8 @@ func (r *VMImageService) Get(ctx context.Context, id string, opts ...option.Requ
6970type VMImageListResponse struct {
7071 Data []VMImageListResponseData `json:"data" api:"required"`
7172 HasMore bool `json:"has_more" api:"required"`
72- // Any of "list".
73- Object VMImageListResponseObject `json:"object" api:"required"`
74- Cursor string `json:"cursor" api:"nullable"`
73+ Object constant.List `json:"object" default:"list"`
74+ Cursor string `json:"cursor" api:"nullable"`
7575 // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
7676 JSON struct {
7777 Data respjson.Field
@@ -92,11 +92,10 @@ func (r *VMImageListResponse) UnmarshalJSON(data []byte) error {
9292type VMImageListResponseData struct {
9393 ID string `json:"id" api:"required"`
9494 // Unix timestamp.
95- CreatedAt int64 `json:"created_at" api:"required"`
96- Name string `json:"name" api:"required"`
97- // Any of "image".
98- Object string `json:"object" api:"required"`
99- Owner string `json:"owner" api:"required"`
95+ CreatedAt int64 `json:"created_at" api:"required"`
96+ Name string `json:"name" api:"required"`
97+ Object constant.Image `json:"object" default:"image"`
98+ Owner string `json:"owner" api:"required"`
10099 // A resource path for a image resource. Format:
101100 // sfc:image:<account>:<workspace>:<name>.
102101 ResourcePath string `json:"resource_path" api:"required"`
@@ -128,20 +127,13 @@ func (r *VMImageListResponseData) UnmarshalJSON(data []byte) error {
128127 return apijson .UnmarshalRoot (data , r )
129128}
130129
131- type VMImageListResponseObject string
132-
133- const (
134- VMImageListResponseObjectList VMImageListResponseObject = "list"
135- )
136-
137130type VMImageGetResponse struct {
138131 ID string `json:"id" api:"required"`
139132 // Unix timestamp.
140- CreatedAt int64 `json:"created_at" api:"required"`
141- Name string `json:"name" api:"required"`
142- // Any of "image".
143- Object VMImageGetResponseObject `json:"object" api:"required"`
144- Owner string `json:"owner" api:"required"`
133+ CreatedAt int64 `json:"created_at" api:"required"`
134+ Name string `json:"name" api:"required"`
135+ Object constant.Image `json:"object" default:"image"`
136+ Owner string `json:"owner" api:"required"`
145137 // A resource path for a image resource. Format:
146138 // sfc:image:<account>:<workspace>:<name>.
147139 ResourcePath string `json:"resource_path" api:"required"`
@@ -173,12 +165,6 @@ func (r *VMImageGetResponse) UnmarshalJSON(data []byte) error {
173165 return apijson .UnmarshalRoot (data , r )
174166}
175167
176- type VMImageGetResponseObject string
177-
178- const (
179- VMImageGetResponseObjectImage VMImageGetResponseObject = "image"
180- )
181-
182168type VMImageGetResponseUploadStatus string
183169
184170const (
0 commit comments