Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
19 changes: 19 additions & 0 deletions cmd/scw/testdata/test-all-usage-baremetal-bmc-get-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Get the BMC (Baseboard Management Controller) access associated with the given ID.

USAGE:
scw baremetal bmc get [arg=value ...]

ARGS:
server-id ID of the server
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-2)

FLAGS:
-h, --help help for get

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Start BMC (Baseboard Management Controller) access associated with the given ID.
The BMC (Baseboard Management Controller) access is available one hour after the installation of the server.

USAGE:
scw baremetal bmc start [arg=value ...]

ARGS:
server-id ID of the server
ip The IP authorized to connect to the given server
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-2)

FLAGS:
-h, --help help for start

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
19 changes: 19 additions & 0 deletions cmd/scw/testdata/test-all-usage-baremetal-bmc-stop-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Stop BMC (Baseboard Management Controller) access associated with the given ID.

USAGE:
scw baremetal bmc stop [arg=value ...]

ARGS:
server-id ID of the server
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-2)

FLAGS:
-h, --help help for stop

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
23 changes: 23 additions & 0 deletions cmd/scw/testdata/test-all-usage-baremetal-bmc-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Baseboard Management Controller (BMC) allows you to remotely access the low-level parameters of your dedicated server.
For instance, your KVM-IP management console could be accessed with it.

USAGE:
scw baremetal bmc <command>

AVAILABLE COMMANDS:
get Get BMC (Baseboard Management Controller) access for a given baremetal server
start Start BMC (Baseboard Management Controller) access for a given baremetal server
stop Stop BMC (Baseboard Management Controller) access for a given baremetal server

FLAGS:
-h, --help help for bmc

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

Use "scw baremetal bmc [command] --help" for more information about a command.
1 change: 1 addition & 0 deletions cmd/scw/testdata/test-all-usage-baremetal-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ USAGE:
scw baremetal <command>

AVAILABLE COMMANDS:
bmc Baseboard Management Controller (BMC) management commands
os Operating System (OS) management commands
server Server management commands

Expand Down
113 changes: 113 additions & 0 deletions internal/namespaces/baremetal/v1/baremetal_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func GetGeneratedCommands() *core.Commands {
baremetalRoot(),
baremetalServer(),
baremetalOs(),
baremetalBmc(),
baremetalServerList(),
baremetalServerGet(),
baremetalServerCreate(),
Expand All @@ -31,6 +32,9 @@ func GetGeneratedCommands() *core.Commands {
baremetalServerReboot(),
baremetalServerStart(),
baremetalServerStop(),
baremetalBmcStart(),
baremetalBmcGet(),
baremetalBmcStop(),
baremetalOsList(),
baremetalOsGet(),
)
Expand Down Expand Up @@ -61,6 +65,17 @@ func baremetalOs() *core.Command {
}
}

func baremetalBmc() *core.Command {
return &core.Command{
Short: `Baseboard Management Controller (BMC) management commands`,
Long: `Baseboard Management Controller (BMC) allows you to remotely access the low-level parameters of your dedicated server.
For instance, your KVM-IP management console could be accessed with it.
`,
Namespace: "baremetal",
Resource: "bmc",
}
}

func baremetalServerList() *core.Command {
return &core.Command{
Short: `List baremetal servers`,
Expand Down Expand Up @@ -496,6 +511,104 @@ func baremetalServerStop() *core.Command {
}
}

func baremetalBmcStart() *core.Command {
return &core.Command{
Short: `Start BMC (Baseboard Management Controller) access for a given baremetal server`,
Long: `Start BMC (Baseboard Management Controller) access associated with the given ID.
The BMC (Baseboard Management Controller) access is available one hour after the installation of the server.
`,
Namespace: "baremetal",
Resource: "bmc",
Verb: "start",
ArgsType: reflect.TypeOf(baremetal.StartBMCAccessRequest{}),
ArgSpecs: core.ArgSpecs{
{
Name: "server-id",
Short: `ID of the server`,
Required: true,
Positional: false,
},
{
Name: "ip",
Short: `The IP authorized to connect to the given server`,
Required: true,
Positional: false,
},
core.ZoneArgSpec(scw.ZoneFrPar2),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*baremetal.StartBMCAccessRequest)

client := core.ExtractClient(ctx)
api := baremetal.NewAPI(client)
return api.StartBMCAccess(request)

},
}
}

func baremetalBmcGet() *core.Command {
return &core.Command{
Short: `Get BMC (Baseboard Management Controller) access for a given baremetal server`,
Long: `Get the BMC (Baseboard Management Controller) access associated with the given ID.`,
Namespace: "baremetal",
Resource: "bmc",
Verb: "get",
ArgsType: reflect.TypeOf(baremetal.GetBMCAccessRequest{}),
ArgSpecs: core.ArgSpecs{
{
Name: "server-id",
Short: `ID of the server`,
Required: true,
Positional: false,
},
core.ZoneArgSpec(scw.ZoneFrPar2),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*baremetal.GetBMCAccessRequest)

client := core.ExtractClient(ctx)
api := baremetal.NewAPI(client)
return api.GetBMCAccess(request)

},
}
}

func baremetalBmcStop() *core.Command {
return &core.Command{
Short: `Stop BMC (Baseboard Management Controller) access for a given baremetal server`,
Long: `Stop BMC (Baseboard Management Controller) access associated with the given ID.`,
Namespace: "baremetal",
Resource: "bmc",
Verb: "stop",
ArgsType: reflect.TypeOf(baremetal.StopBMCAccessRequest{}),
ArgSpecs: core.ArgSpecs{
{
Name: "server-id",
Short: `ID of the server`,
Required: true,
Positional: false,
},
core.ZoneArgSpec(scw.ZoneFrPar2),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*baremetal.StopBMCAccessRequest)

client := core.ExtractClient(ctx)
api := baremetal.NewAPI(client)
e = api.StopBMCAccess(request)
if e != nil {
return nil, e
}
return &core.SuccessResult{
Resource: "bmc",
Verb: "stop",
}, nil
},
}
}

func baremetalOsList() *core.Command {
return &core.Command{
Short: `List all available OS that can be install on a baremetal server`,
Expand Down