Skip to content

fix(marketplace): order by type by default #2120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion api/instance/v1/server_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func TestAPI_CreateServer(t *testing.T) {

testhelpers.AssertNoError(t, err)
// this UUID might change when running the cassette later when the image "ubuntu_focal" got a new version
testhelpers.Equals(t, "1bed752e-f775-4ec2-b179-40af20ec1eec", res.Server.Image.ID)
testhelpers.Equals(t, "9c41e95b-add2-4ef8-b1b1-af8899748eda", res.Server.Image.ID)
err = instanceAPI.DeleteServer(&DeleteServerRequest{
Zone: scw.ZoneFrPar1,
ServerID: res.Server.ID,
Expand Down
80 changes: 34 additions & 46 deletions api/instance/v1/testdata/create-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,34 @@ interactions:
headers:
User-Agent:
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.21.1; linux; amd64)
url: https://api.scaleway.com/marketplace/v2/local-images?image_label=ubuntu_focal&order_by=created_at_asc&type=unknown_type&zone=fr-par-1
url: https://api.scaleway.com/marketplace/v2/local-images?image_label=ubuntu_focal&order_by=type_asc&type=unknown_type&zone=fr-par-1
method: GET
response:
body: '{"local_images":[{"id":"1bed752e-f775-4ec2-b179-40af20ec1eec", "arch":"x86_64",
"zone":"fr-par-1", "compatible_commercial_types":["DEV1-L", "DEV1-M", "DEV1-S",
"DEV1-XL", "GP1-L", "GP1-M", "GP1-S", "GP1-XL", "GP1-XS", "START1-L", "START1-M",
"START1-S", "START1-XS", "VC1L", "VC1M", "VC1S", "X64-120GB", "X64-15GB", "X64-30GB",
"X64-60GB", "ENT1-XXS", "ENT1-XS", "ENT1-S", "ENT1-M", "ENT1-L", "ENT1-XL",
"ENT1-2XL", "PRO2-XXS", "PRO2-XS", "PRO2-S", "PRO2-M", "PRO2-L", "STARDUST1-S",
"PLAY2-MICRO", "PLAY2-NANO", "PLAY2-PICO", "POP2-2C-8G", "POP2-4C-16G", "POP2-8C-32G",
"POP2-16C-64G", "POP2-32C-128G", "POP2-64C-256G", "POP2-HM-2C-16G", "POP2-HM-4C-32G",
"POP2-HM-8C-64G", "POP2-HM-16C-128G", "POP2-HM-32C-256G", "POP2-HM-64C-512G",
"POP2-HC-2C-4G", "POP2-HC-4C-8G", "POP2-HC-8C-16G", "POP2-HC-16C-32G", "POP2-HC-32C-64G",
"POP2-HC-64C-128G"], "label":"ubuntu_focal", "type":"instance_local"}, {"id":"9517ef8a-b830-4880-ab30-3f2366a8a207",
"arch":"arm64", "zone":"fr-par-1", "compatible_commercial_types":["AMP2-C1",
"AMP2-C2", "AMP2-C4", "AMP2-C8", "AMP2-C12", "AMP2-C24", "AMP2-C48", "AMP2-C60",
"COPARM1-2C-8G", "COPARM1-4C-16G", "COPARM1-8C-32G", "COPARM1-16C-64G", "COPARM1-32C-128G"],
"label":"ubuntu_focal", "type":"instance_local"}], "total_count":2}'
body: '{"local_images":[{"id":"19f37e3e-d8c4-43cb-a739-7ccefec2a489","arch":"arm64","zone":"fr-par-1","compatible_commercial_types":["AMP2-C1","AMP2-C2","AMP2-C4","AMP2-C8","AMP2-C12","AMP2-C24","AMP2-C48","AMP2-C60","COPARM1-2C-8G","COPARM1-4C-16G","COPARM1-8C-32G","COPARM1-16C-64G","COPARM1-32C-128G"],"label":"ubuntu_focal","type":"instance_local"},{"id":"9c41e95b-add2-4ef8-b1b1-af8899748eda","arch":"x86_64","zone":"fr-par-1","compatible_commercial_types":["DEV1-L","DEV1-M","DEV1-S","DEV1-XL","GP1-L","GP1-M","GP1-S","GP1-XL","GP1-XS","START1-L","START1-M","START1-S","START1-XS","VC1L","VC1M","VC1S","X64-120GB","X64-15GB","X64-30GB","X64-60GB","ENT1-XXS","ENT1-XS","ENT1-S","ENT1-M","ENT1-L","ENT1-XL","ENT1-2XL","PRO2-XXS","PRO2-XS","PRO2-S","PRO2-M","PRO2-L","STARDUST1-S","PLAY2-MICRO","PLAY2-NANO","PLAY2-PICO","POP2-2C-8G","POP2-4C-16G","POP2-8C-32G","POP2-16C-64G","POP2-32C-128G","POP2-64C-256G","POP2-HM-2C-16G","POP2-HM-4C-32G","POP2-HM-8C-64G","POP2-HM-16C-128G","POP2-HM-32C-256G","POP2-HM-64C-512G","POP2-HC-2C-4G","POP2-HC-4C-8G","POP2-HC-8C-16G","POP2-HC-16C-32G","POP2-HC-32C-64G","POP2-HC-64C-128G"],"label":"ubuntu_focal","type":"instance_local"},{"id":"1de03aca-1106-4152-bd36-f057c0cce9f1","arch":"arm64","zone":"fr-par-1","compatible_commercial_types":["AMP2-C1","AMP2-C2","AMP2-C4","AMP2-C8","AMP2-C12","AMP2-C24","AMP2-C48","AMP2-C60","COPARM1-2C-8G","COPARM1-4C-16G","COPARM1-8C-32G","COPARM1-16C-64G","COPARM1-32C-128G"],"label":"ubuntu_focal","type":"instance_sbs"},{"id":"60dd2959-89ce-4636-b54d-f1bb2ce9bde8","arch":"x86_64","zone":"fr-par-1","compatible_commercial_types":["DEV1-L","DEV1-M","DEV1-S","DEV1-XL","GP1-L","GP1-M","GP1-S","GP1-XL","GP1-XS","START1-L","START1-M","START1-S","START1-XS","VC1L","VC1M","VC1S","X64-120GB","X64-15GB","X64-30GB","X64-60GB","ENT1-XXS","ENT1-XS","ENT1-S","ENT1-M","ENT1-L","ENT1-XL","ENT1-2XL","PRO2-XXS","PRO2-XS","PRO2-S","PRO2-M","PRO2-L","STARDUST1-S","PLAY2-MICRO","PLAY2-NANO","PLAY2-PICO","POP2-2C-8G","POP2-4C-16G","POP2-8C-32G","POP2-16C-64G","POP2-32C-128G","POP2-64C-256G","POP2-HM-2C-16G","POP2-HM-4C-32G","POP2-HM-8C-64G","POP2-HM-16C-128G","POP2-HM-32C-256G","POP2-HM-64C-512G","POP2-HC-2C-4G","POP2-HC-4C-8G","POP2-HC-8C-16G","POP2-HC-16C-32G","POP2-HC-32C-64G","POP2-HC-64C-128G"],"label":"ubuntu_focal","type":"instance_sbs"}],"total_count":4}'
headers:
Content-Length:
- "1260"
- "2328"
Content-Security-Policy:
- default-src 'none'; frame-ancestors 'none'
Content-Type:
- application/json
Date:
- Wed, 13 Mar 2024 14:04:08 GMT
- Fri, 05 Jul 2024 09:32:10 GMT
Server:
- Scaleway API Gateway (fr-par-2;edge01)
- Scaleway API Gateway (fr-par-3;edge02)
Strict-Transport-Security:
- max-age=63072000
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
X-Request-Id:
- 175c82ab-efe5-4bc2-9ee0-f7c27ad4dbff
- 6d100b8a-5b13-4c9e-bc11-9733c577e898
status: 200 OK
code: 200
duration: ""
- request:
body: '{"name":"srv-optimistic-mirzakhani","commercial_type":"GP1-XS","image":"1bed752e-f775-4ec2-b179-40af20ec1eec","project":"ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b"}'
body: '{"name":"srv-ecstatic-saha","commercial_type":"GP1-XS","image":"9c41e95b-add2-4ef8-b1b1-af8899748eda","project":"ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b"}'
form: {}
headers:
Content-Type:
Expand All @@ -58,57 +44,57 @@ interactions:
url: https://api.scaleway.com/instance/v1/zones/fr-par-1/servers
method: POST
response:
body: '{"server": {"id": "6c125ef5-2567-46f9-aa8a-acbb05894cbf", "name": "srv-optimistic-mirzakhani",
body: '{"server": {"id": "973c6deb-c4c4-47e9-b9b9-62fdd812fb42", "name": "srv-ecstatic-saha",
"arch": "x86_64", "commercial_type": "GP1-XS", "boot_type": "local", "organization":
"ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b", "project": "ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b",
"hostname": "srv-optimistic-mirzakhani", "image": {"id": "1bed752e-f775-4ec2-b179-40af20ec1eec",
"hostname": "srv-ecstatic-saha", "image": {"id": "9c41e95b-add2-4ef8-b1b1-af8899748eda",
"name": "Ubuntu 20.04 Focal Fossa", "organization": "51b656e3-4865-41e8-adbc-0c45bdd780db",
"project": "51b656e3-4865-41e8-adbc-0c45bdd780db", "root_volume": {"id": "9199297e-fd35-4012-9164-8c97820f205b",
"project": "51b656e3-4865-41e8-adbc-0c45bdd780db", "root_volume": {"id": "f7bff04a-ee32-4bf5-ae53-2280e11d8977",
"name": "Ubuntu 20.04 Focal Fossa", "volume_type": "unified", "size": 10000000000},
"extra_volumes": {}, "public": true, "arch": "x86_64", "creation_date": "2024-02-22T15:47:31.528876+00:00",
"modification_date": "2024-02-22T15:47:31.528876+00:00", "default_bootscript":
null, "from_server": null, "state": "available", "tags": [], "zone": "fr-par-1"},
"volumes": {"0": {"boot": false, "id": "f866b8e9-22fc-43c4-a1e0-f5ad6380bc8b",
"extra_volumes": {}, "public": true, "arch": "x86_64", "creation_date": "2024-07-03T19:59:39.939165+00:00",
"modification_date": "2024-07-03T19:59:39.939165+00:00", "default_bootscript":
null, "from_server": "", "state": "available", "tags": [], "zone": "fr-par-1"},
"volumes": {"0": {"boot": false, "id": "36886cc7-3ef4-4cbf-9f33-7dad4a30d987",
"name": "Ubuntu 20.04 Focal Fossa", "volume_type": "l_ssd", "export_uri": null,
"organization": "ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b", "project": "ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b",
"server": {"id": "6c125ef5-2567-46f9-aa8a-acbb05894cbf", "name": "srv-optimistic-mirzakhani"},
"size": 150000000000, "state": "available", "creation_date": "2024-03-13T14:04:09.208979+00:00",
"modification_date": "2024-03-13T14:04:09.208979+00:00", "tags": [], "zone":
"server": {"id": "973c6deb-c4c4-47e9-b9b9-62fdd812fb42", "name": "srv-ecstatic-saha"},
"size": 150000000000, "state": "available", "creation_date": "2024-07-05T09:32:10.284203+00:00",
"modification_date": "2024-07-05T09:32:10.284203+00:00", "tags": [], "zone":
"fr-par-1"}}, "tags": [], "state": "stopped", "protected": false, "state_detail":
"", "public_ip": null, "public_ips": [], "mac_address": "de:00:00:44:07:b9",
"routed_ip_enabled": false, "ipv6": null, "extra_networks": [], "dynamic_ip_required":
true, "enable_ipv6": false, "private_ip": null, "creation_date": "2024-03-13T14:04:09.208979+00:00",
"modification_date": "2024-03-13T14:04:09.208979+00:00", "bootscript": {"id":
"", "public_ip": null, "public_ips": [], "mac_address": "de:00:00:5f:9a:41",
"routed_ip_enabled": true, "ipv6": null, "extra_networks": [], "dynamic_ip_required":
true, "enable_ipv6": false, "private_ip": null, "creation_date": "2024-07-05T09:32:10.284203+00:00",
"modification_date": "2024-07-05T09:32:10.284203+00:00", "bootscript": {"id":
"fdfe150f-a870-4ce4-b432-9f56b5b995c1", "public": true, "title": "x86_64 mainline
4.4.230 rev1", "architecture": "x86_64", "organization": "11111111-1111-4111-8111-111111111111",
"project": "11111111-1111-4111-8111-111111111111", "kernel": "http://10.194.3.9/kernel/x86_64-mainline-lts-4.4-4.4.230-rev1/vmlinuz-4.4.230",
"dtb": "", "initrd": "http://10.194.3.9/initrd/initrd-Linux-x86_64-v3.14.6.gz",
"bootcmdargs": "LINUX_COMMON scaleway boot=local nbd.max_part=16", "default":
true, "zone": "fr-par-1"}, "security_group": {"id": "0fe819c3-274d-472a-b3f5-ddb258d2d8bb",
"name": "Default security group"}, "location": null, "maintenances": [], "allowed_actions":
["poweron", "backup", "enable_routed_ip"], "placement_group": null, "private_nics":
[], "zone": "fr-par-1"}}'
["poweron", "backup"], "placement_group": null, "private_nics": [], "zone":
"fr-par-1"}}'
headers:
Content-Length:
- "2657"
- "2610"
Content-Security-Policy:
- default-src 'none'; frame-ancestors 'none'
Content-Type:
- application/json
Date:
- Wed, 13 Mar 2024 14:04:09 GMT
- Fri, 05 Jul 2024 09:32:10 GMT
Location:
- https://api.scaleway.com/instance/v1/zones/fr-par-1/servers/6c125ef5-2567-46f9-aa8a-acbb05894cbf
- https://api.scaleway.com/instance/v1/zones/fr-par-1/servers/973c6deb-c4c4-47e9-b9b9-62fdd812fb42
Server:
- Scaleway API Gateway (fr-par-2;edge01)
- Scaleway API Gateway (fr-par-3;edge02)
Strict-Transport-Security:
- max-age=63072000
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
X-Request-Id:
- d7e71ed3-9be6-4ee6-9e19-5e9ee1d850bb
- 268eec6d-1c3c-4c02-80e4-1466777e1533
status: 201 Created
code: 201
duration: ""
Expand All @@ -118,25 +104,27 @@ interactions:
headers:
User-Agent:
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.21.1; linux; amd64)
url: https://api.scaleway.com/instance/v1/zones/fr-par-1/servers/6c125ef5-2567-46f9-aa8a-acbb05894cbf
url: https://api.scaleway.com/instance/v1/zones/fr-par-1/servers/973c6deb-c4c4-47e9-b9b9-62fdd812fb42
method: DELETE
response:
body: ""
headers:
Content-Security-Policy:
- default-src 'none'; frame-ancestors 'none'
Content-Type:
- application/json
Date:
- Wed, 13 Mar 2024 14:04:09 GMT
- Fri, 05 Jul 2024 09:32:10 GMT
Server:
- Scaleway API Gateway (fr-par-2;edge01)
- Scaleway API Gateway (fr-par-3;edge02)
Strict-Transport-Security:
- max-age=63072000
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
X-Request-Id:
- e73e8a6b-4c6f-4c25-becd-fe029e2a3001
- b492939b-85ad-43ba-b34a-7ea96c4e91b5
status: 204 No Content
code: 204
duration: ""
Loading
Loading