Skip to content

Commit 8c93608

Browse files
authored
fix(instance): use snake case in json output format for image list (#1750)
1 parent 5b4fefb commit 8c93608

2 files changed

Lines changed: 30 additions & 30 deletions

File tree

internal/namespaces/instance/v1/custom_image.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -152,23 +152,23 @@ func imageCreateBuilder(c *core.Command) *core.Command {
152152

153153
// customImage is based on instance.Image, with additional information about the server
154154
type imageListItem struct {
155-
ID string
156-
Name string
157-
Arch instance.Arch
158-
CreationDate *time.Time
159-
ModificationDate *time.Time
160-
DefaultBootscript *instance.Bootscript
161-
ExtraVolumes map[string]*instance.Volume
162-
OrganizationID string
163-
ProjectID string
164-
Public bool
165-
RootVolume *instance.VolumeSummary
166-
State instance.ImageState
155+
ID string `json:"id"`
156+
Name string `json:"name"`
157+
Arch instance.Arch `json:"arch"`
158+
CreationDate *time.Time `json:"creation_date"`
159+
ModificationDate *time.Time `json:"modification_date"`
160+
DefaultBootscript *instance.Bootscript `json:"default_bootscript"`
161+
ExtraVolumes map[string]*instance.Volume `json:"extra_volumes"`
162+
OrganizationID string `json:"organization"`
163+
ProjectID string `json:"project"`
164+
Public bool `json:"public"`
165+
RootVolume *instance.VolumeSummary `json:"root_volume"`
166+
State instance.ImageState `json:"state"`
167167

168168
// Replace Image.FromServer
169-
ServerID string
170-
ServerName string
171-
Zone scw.Zone
169+
ServerID string `json:"server_id"`
170+
ServerName string `json:"server_name"`
171+
Zone scw.Zone `json:"zone"`
172172
}
173173

174174
// imageListBuilder list the images for a given organization/project.

internal/namespaces/instance/v1/testdata/test-image-list-simple.golden

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@ ID NAME STATE PUBLI
55
🟩🟩🟩 JSON STDOUT 🟩🟩🟩
66
[
77
{
8-
"ID": "1a5178fe-f813-404a-a31c-df3822256c43",
9-
"Name": "cli-img-practical-banzai",
10-
"Arch": "x86_64",
11-
"CreationDate": "1970-01-01T00:00:00.0Z",
12-
"ModificationDate": "1970-01-01T00:00:00.0Z",
13-
"DefaultBootscript": null,
14-
"ExtraVolumes": {},
15-
"OrganizationID": "b8fdefc6-c926-4a47-af24-24f14f724d6a",
16-
"ProjectID": "b8fdefc6-c926-4a47-af24-24f14f724d6a",
17-
"Public": false,
18-
"RootVolume": {
8+
"id": "1a5178fe-f813-404a-a31c-df3822256c43",
9+
"name": "cli-img-practical-banzai",
10+
"arch": "x86_64",
11+
"creation_date": "1970-01-01T00:00:00.0Z",
12+
"modification_date": "1970-01-01T00:00:00.0Z",
13+
"default_bootscript": null,
14+
"extra_volumes": {},
15+
"organization": "b8fdefc6-c926-4a47-af24-24f14f724d6a",
16+
"project": "b8fdefc6-c926-4a47-af24-24f14f724d6a",
17+
"public": false,
18+
"root_volume": {
1919
"id": "032d525e-d014-4b48-aaed-ea7d2c611a94",
2020
"name": "cli-snp-gifted-solomon",
2121
"size": 20000000000,
2222
"volume_type": "l_ssd"
2323
},
24-
"State": "available",
25-
"ServerID": "",
26-
"ServerName": "",
27-
"Zone": "fr-par-1"
24+
"state": "available",
25+
"server_id": "",
26+
"server_name": "",
27+
"zone": "fr-par-1"
2828
}
2929
]

0 commit comments

Comments
 (0)