Skip to content

Commit a2cf1aa

Browse files
authored
feat(instance): add support for private nic (#1362)
1 parent 64c7669 commit a2cf1aa

25 files changed

Lines changed: 1411 additions & 782 deletions
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Create a private NIC connecting a server to a private network.
4+
5+
USAGE:
6+
scw instance private-nic create [arg=value ...]
7+
8+
ARGS:
9+
server-id
10+
[private-network-id]
11+
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | nl-ams-1)
12+
13+
FLAGS:
14+
-h, --help help for create
15+
16+
GLOBAL FLAGS:
17+
-c, --config string The path to the config file
18+
-D, --debug Enable debug mode
19+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
20+
-p, --profile string The config profile to use
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Delete a private NIC.
4+
5+
USAGE:
6+
scw instance private-nic delete [arg=value ...]
7+
8+
ARGS:
9+
server-id
10+
private-nic-id
11+
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | nl-ams-1)
12+
13+
FLAGS:
14+
-h, --help help for delete
15+
16+
GLOBAL FLAGS:
17+
-c, --config string The path to the config file
18+
-D, --debug Enable debug mode
19+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
20+
-p, --profile string The config profile to use
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Get private NIC properties.
4+
5+
USAGE:
6+
scw instance private-nic get [arg=value ...]
7+
8+
ARGS:
9+
server-id
10+
private-nic-id
11+
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | nl-ams-1)
12+
13+
FLAGS:
14+
-h, --help help for get
15+
16+
GLOBAL FLAGS:
17+
-c, --config string The path to the config file
18+
-D, --debug Enable debug mode
19+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
20+
-p, --profile string The config profile to use
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
List all private NICs of a given server.
4+
5+
USAGE:
6+
scw instance private-nic list [arg=value ...]
7+
8+
EXAMPLES:
9+
List all private NICs on a specific server
10+
scw instance private-nic list
11+
12+
List private NICs of the server ID 'my_server_id'
13+
scw instance private-nic list server-id=my_server_id
14+
15+
ARGS:
16+
server-id
17+
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | nl-ams-1)
18+
19+
FLAGS:
20+
-h, --help help for list
21+
22+
GLOBAL FLAGS:
23+
-c, --config string The path to the config file
24+
-D, --debug Enable debug mode
25+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
26+
-p, --profile string The config profile to use
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
A Private NIC is the network interface that connects a server to a
4+
Private Network. There can be at most one Private NIC connecting a
5+
server to a network.
6+
7+
USAGE:
8+
scw instance private-nic <command>
9+
10+
AVAILABLE COMMANDS:
11+
create Create a private NIC connecting a server to a private network
12+
delete Delete a private NIC
13+
get Get a private NIC
14+
list List all private NICs
15+
16+
FLAGS:
17+
-h, --help help for private-nic
18+
19+
GLOBAL FLAGS:
20+
-c, --config string The path to the config file
21+
-D, --debug Enable debug mode
22+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
23+
-p, --profile string The config profile to use
24+
25+
Use "scw instance private-nic [command] --help" for more information about a command.

cmd/scw/testdata/test-all-usage-instance-server-update-usage.golden

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,25 @@ EXAMPLES:
2525
scw instance server update
2626

2727
ARGS:
28-
server-id UUID of the server
29-
[name] Name of the server
30-
[ip] IP that should be attached to the server (use ip=none to detach)
31-
[cloud-init] The cloud-init script to use
32-
[boot-type] (local | bootscript | rescue)
33-
[tags.{index}] Tags of the server
34-
[volumes.{key}.project] Project ID of the volume
35-
[bootscript]
36-
[dynamic-ip-required]
37-
[enable-ipv6]
38-
[protected]
39-
[security-group-id]
40-
[volume-ids.{index}] Will update ALL volume IDs at once, including the root volume of the server (use volume-ids=none to detach all volumes)
41-
[placement-group-id] Placement group ID if server must be part of a placement group
42-
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | nl-ams-1)
28+
server-id UUID of the server
29+
[name] Name of the server
30+
[ip] IP that should be attached to the server (use ip=none to detach)
31+
[cloud-init] The cloud-init script to use
32+
[boot-type] (local | bootscript | rescue)
33+
[tags.{index}] Tags of the server
34+
[volumes.{key}.project] Project ID of the volume
35+
[bootscript]
36+
[dynamic-ip-required]
37+
[enable-ipv6]
38+
[protected]
39+
[security-group-id]
40+
[volume-ids.{index}] Will update ALL volume IDs at once, including the root volume of the server (use volume-ids=none to detach all volumes)
41+
[placement-group-id] Placement group ID if server must be part of a placement group
42+
[private-nics.{index}.id] The private NIC unique ID
43+
[private-nics.{index}.server-id] The server the private NIC is attached to
44+
[private-nics.{index}.private-network-id] The private network where the private NIC is attached
45+
[private-nics.{index}.mac-address] The private NIC MAC address
46+
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | nl-ams-1)
4347

4448
FLAGS:
4549
-h, --help help for update

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ AVAILABLE COMMANDS:
99
image Image management commands
1010
ip IP management commands
1111
placement-group Placement group management commands
12+
private-nic Private NIC management commands
1213
security-group Security group management commands
1314
server Server management commands
1415
server-type Server type management commands

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ require (
2121
github.com/mattn/go-colorable v0.1.4
2222
github.com/mattn/go-isatty v0.0.11
2323
github.com/pkg/errors v0.9.1 // indirect
24-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200818160321-42f4b6772b5c
24+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200828151447-c88def765356
2525
github.com/sergi/go-diff v1.0.0 // indirect
2626
github.com/spf13/cobra v0.0.5
2727
github.com/spf13/pflag v1.0.5

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200810155502-64702d7341d2
8787
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200810155502-64702d7341d2/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8=
8888
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200818160321-42f4b6772b5c h1:5R916mdrgsgkZZQAeJxuUtciIv0yoX0UUTtBXsfOgJE=
8989
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200818160321-42f4b6772b5c/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8=
90+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200828151447-c88def765356 h1:cL3Kx+H/cVgS8Fhkk0nR2GC5v2NyhNrI8VF9coACJ5Y=
91+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200828151447-c88def765356/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8=
9092
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
9193
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
9294
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=

internal/namespaces/instance/v1/custom.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ func GetCommands() *core.Commands {
160160
cmds.MustFind("instance", "user-data", "get").Override(userDataGetBuilder)
161161
cmds.MustFind("instance", "user-data", "list").Override(userDataListBuilder)
162162

163+
//
164+
// Private NICs
165+
//
166+
cmds.MustFind("instance", "private-nic", "list").Override(privateNicListBuilder)
167+
163168
return cmds
164169
}
165170

0 commit comments

Comments
 (0)