Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 2 additions & 0 deletions internal/namespaces/vpcgw/v1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ func GetCommands() *core.Commands {
human.RegisterMarshalerFunc(vpcgw.GatewayNetworkStatus(""), human.EnumMarshalFunc(gatewayNetworkStatusMarshalSpecs))
human.RegisterMarshalerFunc(vpcgw.GatewayStatus(""), human.EnumMarshalFunc(gatewayStatusMarshalSpecs))

cmds.MustFind("vpc-gw", "gateway-type", "list").Override(vpcgwGatewayTypeListBuilder)

return cmds
}
17 changes: 17 additions & 0 deletions internal/namespaces/vpcgw/v1/custom_gateway_type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package vpcgw

import "github.com/scaleway/scaleway-cli/v2/internal/core"

func vpcgwGatewayTypeListBuilder(c *core.Command) *core.Command {
c.View = &core.View{
Sections: []*core.ViewSection{

{
FieldName: "Types",
Title: "Types",
},
},
}

return c
}
15 changes: 15 additions & 0 deletions internal/namespaces/vpcgw/v1/custom_gateway_type_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package vpcgw

import (
"testing"

"github.com/scaleway/scaleway-cli/v2/internal/core"
)

func Test_ListGatewayType(t *testing.T) {
t.Run("Simple", core.Test(&core.TestConfig{
Commands: GetCommands(),
Cmd: "scw vpc-gw gateway-type list",
Check: core.TestCheckGolden(),
}))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
version: 1
interactions:
- request:
body: ""
form: {}
headers:
User-Agent:
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19.5; darwin; amd64) cli-e2e-test
url: https://api.scaleway.com/vpc-gw/v1/zones/fr-par-1/gateway-types
method: GET
response:
body: '{"types":[{"name":"VPC-GW-S", "bandwidth":100000000, "zone":"fr-par-1"},
{"name":"VPC-GW-M", "bandwidth":1000000000, "zone":"fr-par-1"}]}'
headers:
Content-Length:
- "137"
Content-Security-Policy:
- default-src 'none'; frame-ancestors 'none'
Content-Type:
- application/json
Date:
- Tue, 28 Mar 2023 12:48:08 GMT
Server:
- Scaleway API-Gateway
Strict-Transport-Security:
- max-age=63072000
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
X-Request-Id:
- d23a2fd4-94cc-4bad-985f-a04b2e467ff6
status: 200 OK
code: 200
duration: ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟩🟩🟩 STDOUT️ 🟩🟩🟩️
Types:
NAME BANDWIDTH ZONE
VPC-GW-S 100000000 fr-par-1
VPC-GW-M 1000000000 fr-par-1
🟩🟩🟩 JSON STDOUT 🟩🟩🟩
{
"types": [
{
"name": "VPC-GW-S",
"bandwidth": 100000000,
"zone": "fr-par-1"
},
{
"name": "VPC-GW-M",
"bandwidth": 1000000000,
"zone": "fr-par-1"
}
]
}