Skip to content

Commit 5c03926

Browse files
Laure-didependabot[bot]scaleway-botjremy42remyleone
authored
fix(baremetal): activate PN v3 (#4763)
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Scaleway Bot <[email protected]> Co-authored-by: Jonathan R. <[email protected]> Co-authored-by: Rémy Léone <[email protected]>
1 parent ae7b686 commit 5c03926

10 files changed

+171
-23
lines changed

cmd/scw/testdata/test-all-usage-baremetal-private-network-add-usage.golden

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
22
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3-
Add a server to a Private Network.
3+
Add an Elastic Metal server to a Private Network.
44

55
USAGE:
66
scw baremetal private-network add [arg=value ...]
77

88
ARGS:
9-
server-id The ID of the server
10-
private-network-id The ID of the Private Network
11-
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-2)
9+
server-id UUID of the server
10+
private-network-id UUID of the Private Network
11+
[ipam-ip-ids.{index}] IPAM IDs of an IPs to attach to the server
12+
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | nl-ams-1 | nl-ams-2 | pl-waw-2 | pl-waw-3)
1213

1314
FLAGS:
1415
-h, --help help for add

cmd/scw/testdata/test-all-usage-baremetal-private-network-delete-usage.golden

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ USAGE:
66
scw baremetal private-network delete [arg=value ...]
77

88
ARGS:
9-
server-id The ID of the server
10-
private-network-id The ID of the Private Network
11-
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-2)
9+
server-id UUID of the server
10+
private-network-id UUID of the Private Network
11+
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | nl-ams-1 | nl-ams-2 | pl-waw-2 | pl-waw-3)
1212

1313
FLAGS:
1414
-h, --help help for delete

cmd/scw/testdata/test-all-usage-baremetal-private-network-list-usage.golden

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
22
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3-
List the Private Networks of a server.
3+
List the Private Networks of an Elastic Metal server.
44

55
USAGE:
66
scw baremetal private-network list [arg=value ...]
77

88
ARGS:
9-
[order-by] The sort order for the returned Private Networks (created_at_asc | created_at_desc | updated_at_asc | updated_at_desc)
10-
[server-id] Filter Private Networks by server ID
11-
[private-network-id] Filter Private Networks by Private Network ID
12-
[project-id] Filter Private Networks by Project ID
13-
[organization-id] Filter Private Networks by Organization ID
14-
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-2 | all)
9+
[order-by] Sort order for the returned Private Networks (created_at_asc | created_at_desc | updated_at_asc | updated_at_desc)
10+
[server-id] Filter Private Networks by server UUID
11+
[private-network-id] Filter Private Networks by Private Network UUID
12+
[project-id] Filter Private Networks by project UUID
13+
[ipam-ip-ids.{index}] Filter Private Networks by IPAM IP UUIDs
14+
[organization-id] Filter Private Networks by organization UUID
15+
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | nl-ams-1 | nl-ams-2 | pl-waw-2 | pl-waw-3 | all)
1516

1617
FLAGS:
1718
-h, --help help for list

cmd/scw/testdata/test-all-usage-baremetal-private-network-set-usage.golden

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
22
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3-
Set multiple Private Networks on a server.
3+
Configure multiple Private Networks on an Elastic Metal server.
44

55
USAGE:
66
scw baremetal private-network set [arg=value ...]
77

88
ARGS:
9-
server-id The ID of the server
10-
private-network-ids.{index} The IDs of the Private Networks
11-
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-2)
9+
server-id UUID of the server
10+
per-private-network-ipam-ip-ids.{key} Object where the keys are the UUIDs of Private Networks and the values are arrays of IPAM IDs representing the IPs to assign to this Elastic Metal server on the Private Network. If the array supplied for a Private Network is empty, the next available IP from the Private Network's CIDR block will automatically be used for attachment.
11+
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | nl-ams-1 | nl-ams-2 | pl-waw-2 | pl-waw-3)
1212

1313
FLAGS:
1414
-h, --help help for set

cmd/scw/testdata/test-all-usage-baremetal-private-network-usage.golden

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
22
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
33
A Private Network allows you to interconnect your resources
4-
(servers, instances, ...) in an isolated and private
5-
network. The network reachability is limited to the
6-
resources that are on the same Private Network . A VLAN
4+
in an isolated and private
5+
network. Network reachability is limited to the
6+
resources that are on the same Private Network. A VLAN
77
interface is available on the server and can be freely
8-
managed (adding IP addresses, shutdown interface...).
8+
managed (adding IP addresses, shutdown interface etc.).
99

1010
Note that a resource can be a part of multiple Private Networks.
1111

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Elastic Metal API.
4+
5+
USAGE:
6+
scw baremetal <command>
7+
8+
AVAILABLE COMMANDS:
9+
bmc Baseboard Management Controller (BMC) management commands
10+
offer Server offer management commands
11+
options Server options management commands
12+
os Operating System (OS) management commands
13+
partitioning-schemas Partitioning-schemas management commands
14+
private-network Private network management command
15+
server Server management commands
16+
settings Settings management commands
17+
18+
FLAGS:
19+
-h, --help help for baremetal
20+
21+
GLOBAL FLAGS:
22+
-c, --config string The path to the config file
23+
-D, --debug Enable debug mode
24+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
25+
-p, --profile string The config profile to use
26+
27+
Use "scw baremetal [command] --help" for more information about a command.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ AVAILABLE COMMANDS:
1111
options Server options management commands
1212
os Operating System (OS) management commands
1313
partitioning-schemas Partitioning-schemas management commands
14+
private-network Private network management command
1415
server Server management commands
1516
settings Settings management commands
1617

docs/commands/baremetal.md

Lines changed: 107 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- DO NOT EDIT: this file is automatically generated using scw-doc-gen -->
22
# Documentation for `scw baremetal`
3-
Elastic Metal API.
3+
Elastic Metal - Private Networks API.
44

55
- [Baseboard Management Controller (BMC) management commands](#baseboard-management-controller-(bmc)-management-commands)
66
- [Get BMC access](#get-bmc-access)
@@ -18,6 +18,11 @@ Elastic Metal API.
1818
- [Get OS with an ID](#get-os-with-an-id)
1919
- [List available OSes](#list-available-oses)
2020
- [Partitioning-schemas management commands](#partitioning-schemas-management-commands)
21+
- [Private network management command](#private-network-management-command)
22+
- [Add a server to a Private Network](#add-a-server-to-a-private-network)
23+
- [Delete a Private Network](#delete-a-private-network)
24+
- [List the Private Networks of a server](#list-the-private-networks-of-a-server)
25+
- [Set multiple Private Networks on a server](#set-multiple-private-networks-on-a-server)
2126
- [Server management commands](#server-management-commands)
2227
- [Attach a new flexible IP to a server](#attach-a-new-flexible-ip-to-a-server)
2328
- [Create an Elastic Metal server](#create-an-elastic-metal-server)
@@ -386,6 +391,107 @@ scw baremetal partitioning-schemas
386391

387392

388393

394+
## Private network management command
395+
396+
A Private Network allows you to interconnect your resources
397+
in an isolated and private
398+
network. Network reachability is limited to the
399+
resources that are on the same Private Network. A VLAN
400+
interface is available on the server and can be freely
401+
managed (adding IP addresses, shutdown interface etc.).
402+
403+
Note that a resource can be a part of multiple Private Networks.
404+
405+
406+
### Add a server to a Private Network
407+
408+
Add an Elastic Metal server to a Private Network.
409+
410+
**Usage:**
411+
412+
```
413+
scw baremetal private-network add [arg=value ...]
414+
```
415+
416+
417+
**Args:**
418+
419+
| Name | | Description |
420+
|------|---|-------------|
421+
| server-id | Required | UUID of the server |
422+
| private-network-id | Required | UUID of the Private Network |
423+
| ipam-ip-ids.{index} | | IPAM IDs of an IPs to attach to the server |
424+
| zone | Default: `fr-par-1`<br />One of: `fr-par-1`, `fr-par-2`, `nl-ams-1`, `nl-ams-2`, `pl-waw-2`, `pl-waw-3` | Zone to target. If none is passed will use default zone from the config |
425+
426+
427+
428+
### Delete a Private Network
429+
430+
Delete a Private Network.
431+
432+
**Usage:**
433+
434+
```
435+
scw baremetal private-network delete [arg=value ...]
436+
```
437+
438+
439+
**Args:**
440+
441+
| Name | | Description |
442+
|------|---|-------------|
443+
| server-id | Required | UUID of the server |
444+
| private-network-id | Required | UUID of the Private Network |
445+
| zone | Default: `fr-par-1`<br />One of: `fr-par-1`, `fr-par-2`, `nl-ams-1`, `nl-ams-2`, `pl-waw-2`, `pl-waw-3` | Zone to target. If none is passed will use default zone from the config |
446+
447+
448+
449+
### List the Private Networks of a server
450+
451+
List the Private Networks of an Elastic Metal server.
452+
453+
**Usage:**
454+
455+
```
456+
scw baremetal private-network list [arg=value ...]
457+
```
458+
459+
460+
**Args:**
461+
462+
| Name | | Description |
463+
|------|---|-------------|
464+
| order-by | One of: `created_at_asc`, `created_at_desc`, `updated_at_asc`, `updated_at_desc` | Sort order for the returned Private Networks |
465+
| server-id | | Filter Private Networks by server UUID |
466+
| private-network-id | | Filter Private Networks by Private Network UUID |
467+
| project-id | | Filter Private Networks by project UUID |
468+
| ipam-ip-ids.{index} | | Filter Private Networks by IPAM IP UUIDs |
469+
| organization-id | | Filter Private Networks by organization UUID |
470+
| zone | Default: `fr-par-1`<br />One of: `fr-par-1`, `fr-par-2`, `nl-ams-1`, `nl-ams-2`, `pl-waw-2`, `pl-waw-3`, `all` | Zone to target. If none is passed will use default zone from the config |
471+
472+
473+
474+
### Set multiple Private Networks on a server
475+
476+
Configure multiple Private Networks on an Elastic Metal server.
477+
478+
**Usage:**
479+
480+
```
481+
scw baremetal private-network set [arg=value ...]
482+
```
483+
484+
485+
**Args:**
486+
487+
| Name | | Description |
488+
|------|---|-------------|
489+
| server-id | Required | UUID of the server |
490+
| per-private-network-ipam-ip-ids.{key} | Required | Object where the keys are the UUIDs of Private Networks and the values are arrays of IPAM IDs representing the IPs to assign to this Elastic Metal server on the Private Network. If the array supplied for a Private Network is empty, the next available IP from the Private Network's CIDR block will automatically be used for attachment. |
491+
| zone | Default: `fr-par-1`<br />One of: `fr-par-1`, `fr-par-2`, `nl-ams-1`, `nl-ams-2`, `pl-waw-2`, `pl-waw-3` | Zone to target. If none is passed will use default zone from the config |
492+
493+
494+
389495
## Server management commands
390496

391497
A server is a denomination of a type of instances provided by Scaleway.

internal/namespaces/baremetal/v1/custom.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package baremetal
33
import (
44
"github.com/scaleway/scaleway-cli/v2/core"
55
"github.com/scaleway/scaleway-cli/v2/core/human"
6+
baremetalV3 "github.com/scaleway/scaleway-cli/v2/internal/namespaces/baremetal/v3"
67
baremetal "github.com/scaleway/scaleway-sdk-go/api/baremetal/v1"
78
)
89

@@ -38,5 +39,7 @@ func GetCommands() *core.Commands {
3839
cmds.MustFind("baremetal", "server", "stop").Override(serverStopBuilder)
3940
cmds.MustFind("baremetal", "server", "reboot").Override(serverRebootBuilder)
4041

42+
cmds.MergeAll(baremetalV3.GetCommands())
43+
4144
return cmds
4245
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package baremetal
2+
3+
import "github.com/scaleway/scaleway-cli/v2/core"
4+
5+
func GetCommands() *core.Commands {
6+
cmds := GetGeneratedCommands()
7+
8+
return cmds
9+
}

0 commit comments

Comments
 (0)