Skip to content

Commit ec278e4

Browse files
authored
feat(instance): remove monthly prices from server types list (#1509)
1 parent cc46d8e commit ec278e4

File tree

2 files changed

+12
-64
lines changed

2 files changed

+12
-64
lines changed

internal/namespaces/instance/v1/custom_server_type.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ func serverTypeListBuilder(c *core.Command) *core.Command {
6161
c.Run = func(ctx context.Context, argsI interface{}) (interface{}, error) {
6262
type customServerType struct {
6363
Name string `json:"name"`
64-
MonthlyPrice *scw.Money `json:"monthly_price"`
6564
HourlyPrice *scw.Money `json:"hourly_price"`
6665
LocalVolumeSize scw.Size `json:"local_volume_size"`
6766
CPU uint32 `json:"cpu"`
@@ -95,7 +94,6 @@ func serverTypeListBuilder(c *core.Command) *core.Command {
9594

9695
serverTypes = append(serverTypes, &customServerType{
9796
Name: name,
98-
MonthlyPrice: scw.NewMoneyFromFloat(float64(serverType.MonthlyPrice), "EUR", 2),
9997
HourlyPrice: scw.NewMoneyFromFloat(float64(serverType.HourlyPrice), "EUR", 3),
10098
LocalVolumeSize: serverType.VolumesConstraint.MinSize,
10199
CPU: serverType.Ncpus,
@@ -112,7 +110,7 @@ func serverTypeListBuilder(c *core.Command) *core.Command {
112110
if categoryA != categoryB {
113111
return categoryA < categoryB
114112
}
115-
return serverTypes[i].MonthlyPrice.ToFloat() < serverTypes[j].MonthlyPrice.ToFloat()
113+
return serverTypes[i].HourlyPrice.ToFloat() < serverTypes[j].HourlyPrice.ToFloat()
116114
})
117115

118116
return serverTypes, nil

internal/namespaces/instance/v1/testdata/test-server-type-list-server-type-list.golden

Lines changed: 11 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
22
🟩🟩🟩 STDOUT️ 🟩🟩🟩️
3-
NAME MONTHLY PRICE HOURLY PRICE LOCAL VOLUME SIZE CPU GPU RAM ARCH AVAILABILITY
4-
DEV1-S € 2.99 € 0.006 20 GB 2 - 2.0 GiB x86_64 available
5-
DEV1-M € 7.99 € 0.016 40 GB 3 - 4.0 GiB x86_64 available
6-
DEV1-L € 15.99 € 0.032 80 GB 4 - 8.0 GiB x86_64 available
7-
DEV1-XL € 23.99 € 0.048 120 GB 4 - 12 GiB x86_64 available
8-
GP1-XS € 39.00 € 0.078 150 GB 4 - 16 GiB x86_64 available
9-
GP1-S € 79.00 € 0.158 300 GB 8 - 32 GiB x86_64 available
10-
GP1-M € 159.00 € 0.318 600 GB 16 - 64 GiB x86_64 available
11-
GP1-L € 299.00 € 0.598 600 GB 32 - 128 GiB x86_64 available
12-
GP1-XL € 569.00 € 1.138 600 GB 48 - 256 GiB x86_64 available
13-
RENDER-S € 499.99 € 1.00 400 GB 10 1 45 GiB x86_64 available
3+
NAME HOURLY PRICE LOCAL VOLUME SIZE CPU GPU RAM ARCH AVAILABILITY
4+
DEV1-S € 0.006 20 GB 2 - 2.0 GiB x86_64 available
5+
DEV1-M € 0.016 40 GB 3 - 4.0 GiB x86_64 available
6+
DEV1-L € 0.032 80 GB 4 - 8.0 GiB x86_64 available
7+
DEV1-XL € 0.048 120 GB 4 - 12 GiB x86_64 available
8+
GP1-XS € 0.078 150 GB 4 - 16 GiB x86_64 available
9+
GP1-S € 0.158 300 GB 8 - 32 GiB x86_64 available
10+
GP1-M € 0.318 600 GB 16 - 64 GiB x86_64 available
11+
GP1-L € 0.598 600 GB 32 - 128 GiB x86_64 available
12+
GP1-XL € 1.138 600 GB 48 - 256 GiB x86_64 available
13+
RENDER-S € 1.00 400 GB 10 1 45 GiB x86_64 available
1414
🟩🟩🟩 JSON STDOUT 🟩🟩🟩
1515
[
1616
{
1717
"name": "DEV1-S",
18-
"monthly_price": {
19-
"currency_code": "EUR",
20-
"units": 2,
21-
"nanos": 990000000
22-
},
2318
"hourly_price": {
2419
"currency_code": "EUR",
2520
"units": 0,
@@ -34,11 +29,6 @@ RENDER-S € 499.99 € 1.00 400 GB 10 1 45 GiB
3429
},
3530
{
3631
"name": "DEV1-M",
37-
"monthly_price": {
38-
"currency_code": "EUR",
39-
"units": 7,
40-
"nanos": 990000000
41-
},
4232
"hourly_price": {
4333
"currency_code": "EUR",
4434
"units": 0,
@@ -53,11 +43,6 @@ RENDER-S € 499.99 € 1.00 400 GB 10 1 45 GiB
5343
},
5444
{
5545
"name": "DEV1-L",
56-
"monthly_price": {
57-
"currency_code": "EUR",
58-
"units": 15,
59-
"nanos": 990000000
60-
},
6146
"hourly_price": {
6247
"currency_code": "EUR",
6348
"units": 0,
@@ -72,11 +57,6 @@ RENDER-S € 499.99 € 1.00 400 GB 10 1 45 GiB
7257
},
7358
{
7459
"name": "DEV1-XL",
75-
"monthly_price": {
76-
"currency_code": "EUR",
77-
"units": 23,
78-
"nanos": 990000000
79-
},
8060
"hourly_price": {
8161
"currency_code": "EUR",
8262
"units": 0,
@@ -91,11 +71,6 @@ RENDER-S € 499.99 € 1.00 400 GB 10 1 45 GiB
9171
},
9272
{
9373
"name": "GP1-XS",
94-
"monthly_price": {
95-
"currency_code": "EUR",
96-
"units": 39,
97-
"nanos": 0
98-
},
9974
"hourly_price": {
10075
"currency_code": "EUR",
10176
"units": 0,
@@ -110,11 +85,6 @@ RENDER-S € 499.99 € 1.00 400 GB 10 1 45 GiB
11085
},
11186
{
11287
"name": "GP1-S",
113-
"monthly_price": {
114-
"currency_code": "EUR",
115-
"units": 79,
116-
"nanos": 0
117-
},
11888
"hourly_price": {
11989
"currency_code": "EUR",
12090
"units": 0,
@@ -129,11 +99,6 @@ RENDER-S € 499.99 € 1.00 400 GB 10 1 45 GiB
12999
},
130100
{
131101
"name": "GP1-M",
132-
"monthly_price": {
133-
"currency_code": "EUR",
134-
"units": 159,
135-
"nanos": 0
136-
},
137102
"hourly_price": {
138103
"currency_code": "EUR",
139104
"units": 0,
@@ -148,11 +113,6 @@ RENDER-S € 499.99 € 1.00 400 GB 10 1 45 GiB
148113
},
149114
{
150115
"name": "GP1-L",
151-
"monthly_price": {
152-
"currency_code": "EUR",
153-
"units": 299,
154-
"nanos": 0
155-
},
156116
"hourly_price": {
157117
"currency_code": "EUR",
158118
"units": 0,
@@ -167,11 +127,6 @@ RENDER-S € 499.99 € 1.00 400 GB 10 1 45 GiB
167127
},
168128
{
169129
"name": "GP1-XL",
170-
"monthly_price": {
171-
"currency_code": "EUR",
172-
"units": 569,
173-
"nanos": 0
174-
},
175130
"hourly_price": {
176131
"currency_code": "EUR",
177132
"units": 1,
@@ -186,11 +141,6 @@ RENDER-S € 499.99 € 1.00 400 GB 10 1 45 GiB
186141
},
187142
{
188143
"name": "RENDER-S",
189-
"monthly_price": {
190-
"currency_code": "EUR",
191-
"units": 499,
192-
"nanos": 990000000
193-
},
194144
"hourly_price": {
195145
"currency_code": "EUR",
196146
"units": 1,

0 commit comments

Comments
 (0)