Skip to content

Commit e6a579e

Browse files
committed
Merge branch 'improve_vpc-gw_offers_visualization' of github.com:yfodil/scaleway-cli into improve_vpc-gw_offers_visualization
2 parents ed2097b + 249995e commit e6a579e

File tree

5 files changed

+213
-0
lines changed

5 files changed

+213
-0
lines changed

internal/namespaces/webhosting/v1alpha1/custom.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@ func GetCommands() *core.Commands {
1313
human.RegisterMarshalerFunc(webhosting.DNSRecordsStatus(""), human.EnumMarshalFunc(hostingDNSMarshalSpecs))
1414
human.RegisterMarshalerFunc(webhosting.NameserverStatus(""), human.EnumMarshalFunc(nameserverMarshalSpecs))
1515

16+
cmds.MustFind("webhosting", "offer", "list").Override(webhostingOfferListBuilder)
17+
1618
return cmds
1719
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package webhosting
2+
3+
import "github.com/scaleway/scaleway-cli/v2/internal/core"
4+
5+
func webhostingOfferListBuilder(c *core.Command) *core.Command {
6+
c.View = &core.View{
7+
Sections: []*core.ViewSection{
8+
9+
{
10+
FieldName: "Offers",
11+
Title: "Offers",
12+
},
13+
},
14+
}
15+
16+
return c
17+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package webhosting
2+
3+
import (
4+
"testing"
5+
6+
"github.com/scaleway/scaleway-cli/v2/internal/core"
7+
)
8+
9+
func Test_ListOffer(t *testing.T) {
10+
t.Run("Simple", core.Test(&core.TestConfig{
11+
Commands: GetCommands(),
12+
Cmd: "scw webhosting offer list",
13+
Check: core.TestCheckGolden(),
14+
}))
15+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
version: 1
3+
interactions:
4+
- request:
5+
body: ""
6+
form: {}
7+
headers:
8+
User-Agent:
9+
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19.5; darwin; amd64) cli-e2e-test
10+
url: https://api.scaleway.com/webhosting/v1alpha1/regions/fr-par/offers?only_options=false&order_by=price_asc&without_options=false
11+
method: GET
12+
response:
13+
body: '{"offers":[{"id":"e500237a-a9e9-11ec-b909-0242ac120002", "billing_operation_path":"/webhosting/backup/fr-par",
14+
"product":{"name":"backup", "option":true, "email_accounts_quota":0, "email_storage_quota":0,
15+
"databases_quota":0, "hosting_storage_quota":0, "support_included":false, "v_cpu":0,
16+
"ram":0}, "price":{"currency_code":"EUR", "units":2, "nanos":990000000}, "available":true,
17+
"quota_warnings":[]}, {"id":"f5c2ae8f-7625-4bca-b711-b44bb3d08694", "billing_operation_path":"/webhosting/lite/fr-par",
18+
"product":{"name":"lite", "option":false, "email_accounts_quota":1, "email_storage_quota":5,
19+
"databases_quota":1, "hosting_storage_quota":10, "support_included":true, "v_cpu":1,
20+
"ram":1}, "price":{"currency_code":"EUR", "units":5, "nanos":990000000}, "available":true,
21+
"quota_warnings":[]}, {"id":"d86c61a0-a9e9-11ec-b909-0242ac120002", "billing_operation_path":"/webhosting/personal/fr-par",
22+
"product":{"name":"essential", "option":false, "email_accounts_quota":2, "email_storage_quota":5,
23+
"databases_quota":-1, "hosting_storage_quota":50, "support_included":true, "v_cpu":2,
24+
"ram":1}, "price":{"currency_code":"EUR", "units":9, "nanos":990000000}, "available":true,
25+
"quota_warnings":[]}, {"id":"de2426b4-a9e9-11ec-b909-0242ac120002", "billing_operation_path":"/webhosting/professional/fr-par",
26+
"product":{"name":"performance", "option":false, "email_accounts_quota":10,
27+
"email_storage_quota":5, "databases_quota":-1, "hosting_storage_quota":100,
28+
"support_included":true, "v_cpu":4, "ram":2}, "price":{"currency_code":"EUR",
29+
"units":18, "nanos":990000000}, "available":true, "quota_warnings":[]}, {"id":"e1c1e6c6-a9e9-11ec-b909-0242ac120002",
30+
"billing_operation_path":"/webhosting/ecommerce/fr-par", "product":{"name":"ecommerce",
31+
"option":false, "email_accounts_quota":25, "email_storage_quota":5, "databases_quota":-1,
32+
"hosting_storage_quota":250, "support_included":true, "v_cpu":8, "ram":8}, "price":{"currency_code":"EUR",
33+
"units":29, "nanos":990000000}, "available":true, "quota_warnings":[]}]}'
34+
headers:
35+
Content-Length:
36+
- "2002"
37+
Content-Security-Policy:
38+
- default-src 'none'; frame-ancestors 'none'
39+
Content-Type:
40+
- application/json
41+
Date:
42+
- Tue, 28 Mar 2023 12:32:25 GMT
43+
Server:
44+
- Scaleway API-Gateway
45+
Strict-Transport-Security:
46+
- max-age=63072000
47+
X-Content-Type-Options:
48+
- nosniff
49+
X-Frame-Options:
50+
- DENY
51+
X-Request-Id:
52+
- d471ce2b-9726-4f8a-9518-4112558dc493
53+
status: 200 OK
54+
code: 200
55+
duration: ""
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟩🟩🟩 STDOUT️ 🟩🟩🟩️
3+
Offers:
4+
ID BILLING OPERATION PATH PRICE AVAILABLE QUOTA WARNINGS
5+
e500237a-a9e9-11ec-b909-0242ac120002 /webhosting/backup/fr-par € 2.99 true []
6+
f5c2ae8f-7625-4bca-b711-b44bb3d08694 /webhosting/lite/fr-par € 5.99 true []
7+
d86c61a0-a9e9-11ec-b909-0242ac120002 /webhosting/personal/fr-par € 9.99 true []
8+
de2426b4-a9e9-11ec-b909-0242ac120002 /webhosting/professional/fr-par € 18.99 true []
9+
e1c1e6c6-a9e9-11ec-b909-0242ac120002 /webhosting/ecommerce/fr-par € 29.99 true []
10+
🟩🟩🟩 JSON STDOUT 🟩🟩🟩
11+
{
12+
"offers": [
13+
{
14+
"id": "e500237a-a9e9-11ec-b909-0242ac120002",
15+
"billing_operation_path": "/webhosting/backup/fr-par",
16+
"product": {
17+
"name": "backup",
18+
"option": true,
19+
"email_accounts_quota": 0,
20+
"email_storage_quota": 0,
21+
"databases_quota": 0,
22+
"hosting_storage_quota": 0,
23+
"support_included": false,
24+
"v_cpu": 0,
25+
"ram": 0
26+
},
27+
"price": {
28+
"currency_code": "EUR",
29+
"units": 2,
30+
"nanos": 990000000
31+
},
32+
"available": true,
33+
"quota_warnings": []
34+
},
35+
{
36+
"id": "f5c2ae8f-7625-4bca-b711-b44bb3d08694",
37+
"billing_operation_path": "/webhosting/lite/fr-par",
38+
"product": {
39+
"name": "lite",
40+
"option": false,
41+
"email_accounts_quota": 1,
42+
"email_storage_quota": 5,
43+
"databases_quota": 1,
44+
"hosting_storage_quota": 10,
45+
"support_included": true,
46+
"v_cpu": 1,
47+
"ram": 1
48+
},
49+
"price": {
50+
"currency_code": "EUR",
51+
"units": 5,
52+
"nanos": 990000000
53+
},
54+
"available": true,
55+
"quota_warnings": []
56+
},
57+
{
58+
"id": "d86c61a0-a9e9-11ec-b909-0242ac120002",
59+
"billing_operation_path": "/webhosting/personal/fr-par",
60+
"product": {
61+
"name": "essential",
62+
"option": false,
63+
"email_accounts_quota": 2,
64+
"email_storage_quota": 5,
65+
"databases_quota": -1,
66+
"hosting_storage_quota": 50,
67+
"support_included": true,
68+
"v_cpu": 2,
69+
"ram": 1
70+
},
71+
"price": {
72+
"currency_code": "EUR",
73+
"units": 9,
74+
"nanos": 990000000
75+
},
76+
"available": true,
77+
"quota_warnings": []
78+
},
79+
{
80+
"id": "de2426b4-a9e9-11ec-b909-0242ac120002",
81+
"billing_operation_path": "/webhosting/professional/fr-par",
82+
"product": {
83+
"name": "performance",
84+
"option": false,
85+
"email_accounts_quota": 10,
86+
"email_storage_quota": 5,
87+
"databases_quota": -1,
88+
"hosting_storage_quota": 100,
89+
"support_included": true,
90+
"v_cpu": 4,
91+
"ram": 2
92+
},
93+
"price": {
94+
"currency_code": "EUR",
95+
"units": 18,
96+
"nanos": 990000000
97+
},
98+
"available": true,
99+
"quota_warnings": []
100+
},
101+
{
102+
"id": "e1c1e6c6-a9e9-11ec-b909-0242ac120002",
103+
"billing_operation_path": "/webhosting/ecommerce/fr-par",
104+
"product": {
105+
"name": "ecommerce",
106+
"option": false,
107+
"email_accounts_quota": 25,
108+
"email_storage_quota": 5,
109+
"databases_quota": -1,
110+
"hosting_storage_quota": 250,
111+
"support_included": true,
112+
"v_cpu": 8,
113+
"ram": 8
114+
},
115+
"price": {
116+
"currency_code": "EUR",
117+
"units": 29,
118+
"nanos": 990000000
119+
},
120+
"available": true,
121+
"quota_warnings": []
122+
}
123+
]
124+
}

0 commit comments

Comments
 (0)