Skip to content

Commit 689ceb3

Browse files
authored
feat(instance): remove 'public' argument for listing images (#5032)
1 parent f96e6ef commit 689ceb3

13 files changed

+5649
-1960
lines changed

cmd/scw/testdata/test-all-usage-instance-image-list-usage.golden

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ EXAMPLES:
1111

1212
ARGS:
1313
[name]
14-
[public]
1514
[arch]
1615
[project-id]
1716
[tags]

docs/commands/instance.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ scw instance image list [arg=value ...]
249249
| Name | | Description |
250250
|------|---|-------------|
251251
| name | | |
252-
| public | | |
253252
| arch | | |
254253
| project-id | | |
255254
| tags | | |

internal/namespaces/instance/v1/custom_image.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ func imagesMarshalerFunc(i any, _ *human.MarshalOpt) (string, error) {
3737
ID string
3838
Name string
3939
State instance.ImageState
40-
Public bool
4140
Zone scw.Zone
4241
Volumes []scw.Size
4342
ServerName string
@@ -72,7 +71,6 @@ func imagesMarshalerFunc(i any, _ *human.MarshalOpt) (string, error) {
7271
ID: image.ID,
7372
Name: image.Name,
7473
State: image.State,
75-
Public: image.Public,
7674
Zone: image.Zone,
7775
Volumes: volumes,
7876
ServerName: image.ServerName,
@@ -167,25 +165,27 @@ type imageListItem struct {
167165
// A call to GetServer(..) with the ID contained in Image.FromServer retrieves more information about the server.
168166
func imageListBuilder(c *core.Command) *core.Command {
169167
type customListImageRequest struct {
170-
*instance.ListImagesRequest
168+
Zone scw.Zone `json:"-"`
169+
PerPage *uint32 `json:"-"`
170+
Page *int32 `json:"-"`
171+
Name *string `json:"-"`
172+
Arch *string `json:"-"`
173+
Tags *string `json:"-"`
171174
OrganizationID *string
172175
ProjectID *string
173176
}
174177

175178
renameOrganizationIDArgSpec(c.ArgSpecs)
176179
renameProjectIDArgSpec(c.ArgSpecs)
180+
c.ArgSpecs.DeleteByName("public")
177181

178182
c.ArgsType = reflect.TypeOf(customListImageRequest{})
179183

180184
c.Run = func(ctx context.Context, argsI any) (i any, e error) {
181185
// Get images
182186
args := argsI.(*customListImageRequest)
183187

184-
if args.ListImagesRequest == nil {
185-
args.ListImagesRequest = &instance.ListImagesRequest{}
186-
}
187-
188-
req := args.ListImagesRequest
188+
req := &instance.ListImagesRequest{}
189189
req.Organization = args.OrganizationID
190190
req.Project = args.ProjectID
191191
req.Public = scw.BoolPtr(false)

internal/namespaces/instance/v1/testdata/test-image-list-private.cassette.yaml

Lines changed: 916 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟩🟩🟩 STDOUT️ 🟩🟩🟩️
3+
ID NAME STATE PUBLIC ZONE VOLUMES SERVER NAME SERVER ID ARCH ORGANIZATION ID PROJECT ID CREATION DATE MODIFICATION DATE
4+
d033d71f-79a4-4b58-96e2-dbddce4894b3 cli-img-jolly-thompson available false fr-par-1 20 GB - - x86_64 fa1e3217-dc80-42ac-85c3-3f034b78b552 fa1e3217-dc80-42ac-85c3-3f034b78b552 few seconds ago few seconds ago
5+
958fd56a-19a3-426c-9c98-487618f44126 cli-img-zen-goldwasser available false fr-par-1 20 GB - - x86_64 fa1e3217-dc80-42ac-85c3-3f034b78b552 fa1e3217-dc80-42ac-85c3-3f034b78b552 few seconds ago few seconds ago
6+
decb60c8-7673-4518-8ee3-ce0aa42522be cli-img-bold-ramanujan available false fr-par-1 20 GB - - x86_64 fa1e3217-dc80-42ac-85c3-3f034b78b552 fa1e3217-dc80-42ac-85c3-3f034b78b552 few seconds ago few seconds ago
7+
6f50550d-39d6-4f72-8f66-9d87277c626b cli-img-angry-buck available false fr-par-1 20 GB - - x86_64 fa1e3217-dc80-42ac-85c3-3f034b78b552 fa1e3217-dc80-42ac-85c3-3f034b78b552 few seconds ago few seconds ago
8+
942bb563-f079-4d9b-a881-3f060d559e3b img-mystifying-rosalind available false fr-par-1 20 GB - - x86_64 fa1e3217-dc80-42ac-85c3-3f034b78b552 19a4819b-24bf-4d44-969f-935ef0061b71 few seconds ago few seconds ago
9+
🟩🟩🟩 JSON STDOUT 🟩🟩🟩
10+
[
11+
{
12+
"id": "d033d71f-79a4-4b58-96e2-dbddce4894b3",
13+
"name": "cli-img-jolly-thompson",
14+
"arch": "x86_64",
15+
"creation_date": "1970-01-01T00:00:00.0Z",
16+
"modification_date": "1970-01-01T00:00:00.0Z",
17+
"default_bootscript": null,
18+
"extra_volumes": {},
19+
"from_server": "",
20+
"organization": "fa1e3217-dc80-42ac-85c3-3f034b78b552",
21+
"public": false,
22+
"root_volume": {
23+
"id": "9a603922-b39b-4c45-abec-23da474fdda5",
24+
"name": "cli-snp-dreamy-wilbur",
25+
"size": 20000000000,
26+
"volume_type": "l_ssd"
27+
},
28+
"state": "available",
29+
"project": "fa1e3217-dc80-42ac-85c3-3f034b78b552",
30+
"tags": [],
31+
"zone": "fr-par-1",
32+
"server_id": "",
33+
"server_name": ""
34+
},
35+
{
36+
"id": "958fd56a-19a3-426c-9c98-487618f44126",
37+
"name": "cli-img-zen-goldwasser",
38+
"arch": "x86_64",
39+
"creation_date": "1970-01-01T00:00:00.0Z",
40+
"modification_date": "1970-01-01T00:00:00.0Z",
41+
"default_bootscript": null,
42+
"extra_volumes": {},
43+
"from_server": "",
44+
"organization": "fa1e3217-dc80-42ac-85c3-3f034b78b552",
45+
"public": false,
46+
"root_volume": {
47+
"id": "0cfc4d6c-e383-4646-b150-87054d5b4f22",
48+
"name": "cli-snp-priceless-dirac",
49+
"size": 20000000000,
50+
"volume_type": "l_ssd"
51+
},
52+
"state": "available",
53+
"project": "fa1e3217-dc80-42ac-85c3-3f034b78b552",
54+
"tags": [],
55+
"zone": "fr-par-1",
56+
"server_id": "",
57+
"server_name": ""
58+
},
59+
{
60+
"id": "decb60c8-7673-4518-8ee3-ce0aa42522be",
61+
"name": "cli-img-bold-ramanujan",
62+
"arch": "x86_64",
63+
"creation_date": "1970-01-01T00:00:00.0Z",
64+
"modification_date": "1970-01-01T00:00:00.0Z",
65+
"default_bootscript": null,
66+
"extra_volumes": {},
67+
"from_server": "",
68+
"organization": "fa1e3217-dc80-42ac-85c3-3f034b78b552",
69+
"public": false,
70+
"root_volume": {
71+
"id": "3596c079-ff05-40aa-bf0e-ed8b163b318a",
72+
"name": "cli-snp-dreamy-lehmann",
73+
"size": 20000000000,
74+
"volume_type": "l_ssd"
75+
},
76+
"state": "available",
77+
"project": "fa1e3217-dc80-42ac-85c3-3f034b78b552",
78+
"tags": [],
79+
"zone": "fr-par-1",
80+
"server_id": "",
81+
"server_name": ""
82+
},
83+
{
84+
"id": "6f50550d-39d6-4f72-8f66-9d87277c626b",
85+
"name": "cli-img-angry-buck",
86+
"arch": "x86_64",
87+
"creation_date": "1970-01-01T00:00:00.0Z",
88+
"modification_date": "1970-01-01T00:00:00.0Z",
89+
"default_bootscript": null,
90+
"extra_volumes": {},
91+
"from_server": "",
92+
"organization": "fa1e3217-dc80-42ac-85c3-3f034b78b552",
93+
"public": false,
94+
"root_volume": {
95+
"id": "439ab483-67b2-4ff3-83ca-aa47d59386f1",
96+
"name": "tf-snap-sweet-cori",
97+
"size": 20000000000,
98+
"volume_type": "l_ssd"
99+
},
100+
"state": "available",
101+
"project": "fa1e3217-dc80-42ac-85c3-3f034b78b552",
102+
"tags": [],
103+
"zone": "fr-par-1",
104+
"server_id": "",
105+
"server_name": ""
106+
},
107+
{
108+
"id": "942bb563-f079-4d9b-a881-3f060d559e3b",
109+
"name": "img-mystifying-rosalind",
110+
"arch": "x86_64",
111+
"creation_date": "1970-01-01T00:00:00.0Z",
112+
"modification_date": "1970-01-01T00:00:00.0Z",
113+
"default_bootscript": null,
114+
"extra_volumes": {},
115+
"from_server": "",
116+
"organization": "fa1e3217-dc80-42ac-85c3-3f034b78b552",
117+
"public": false,
118+
"root_volume": {
119+
"id": "e06bbd25-55da-4011-a26f-8e4f1d0b973a",
120+
"name": "tf-snap-cranky-khorana",
121+
"size": 20000000000,
122+
"volume_type": "l_ssd"
123+
},
124+
"state": "available",
125+
"project": "19a4819b-24bf-4d44-969f-935ef0061b71",
126+
"tags": [],
127+
"zone": "fr-par-1",
128+
"server_id": "",
129+
"server_name": ""
130+
}
131+
]

0 commit comments

Comments
 (0)