Skip to content

Commit

Permalink
feat: update generated namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
scaleway-bot committed Mar 19, 2020
1 parent 5af2272 commit 135b476
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Return specific OS for the given ID.

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

ARGS:
os-id ID of the researched OS
[zone] 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:
-D, --debug Enable debug mode
-o, --output string Output format: json or human
-p, --profile string The config profile to use
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
List all available OS that can be install on a baremetal server.

USAGE:
scw baremetal os list [arg=value ...]

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

FLAGS:
-h, --help help for list

GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human
-p, --profile string The config profile to use
16 changes: 16 additions & 0 deletions cmd/scw/testdata/test-all-usage-baremetal-os-usage.stderr.golden
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
An Operating System (OS) is the underlying software installed on your server.

USAGE:
scw baremetal os <command>

AVAILABLE COMMANDS:
list List OS
get Get OS

FLAGS:
-h, --help help for os

GLOBAL FLAGS:
-D, --debug Enable debug mode
-o, --output string Output format: json or human
-p, --profile string The config profile to use

Use "scw baremetal os [command] --help" for more information about a command.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ USAGE:

AVAILABLE COMMANDS:
server A server is a denomination of a type of instances provided by Scaleway
os An Operating System (OS) is the underlying software installed on your server

FLAGS:
-h, --help help for baremetal
Expand All @@ -15,7 +16,6 @@ GLOBAL FLAGS:
-p, --profile string The config profile to use

Additional help topics:
scw baremetal os An Operating System (OS) is the underlying software installed on your server
scw baremetal ip IP fail-over management
scw baremetal bmc Baseboard Management Controller (BMC) offers a low-level access to your baremetal instance
scw baremetal offer Commercial offers
Expand Down
55 changes: 55 additions & 0 deletions internal/namespaces/baremetal/v1alpha1/baremetal_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ func GetGeneratedCommands() *core.Commands {
baremetalServerReboot(),
baremetalServerStart(),
baremetalServerStop(),
baremetalOsList(),
baremetalOsGet(),
)
}
func baremetalRoot() *core.Command {
Expand Down Expand Up @@ -414,3 +416,56 @@ func baremetalServerStop() *core.Command {
},
}
}

func baremetalOsList() *core.Command {
return &core.Command{
Short: `List OS`,
Long: `List all available OS that can be install on a baremetal server.`,
Namespace: "baremetal",
Resource: "os",
Verb: "list",
ArgsType: reflect.TypeOf(baremetal.ListOsRequest{}),
ArgSpecs: core.ArgSpecs{
core.ZoneArgSpec(scw.ZoneFrPar2),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*baremetal.ListOsRequest)

client := core.ExtractClient(ctx)
api := baremetal.NewAPI(client)
resp, err := api.ListOs(request, scw.WithAllPages())
if err != nil {
return nil, err
}
return resp.Os, nil

},
}
}

func baremetalOsGet() *core.Command {
return &core.Command{
Short: `Get OS`,
Long: `Return specific OS for the given ID.`,
Namespace: "baremetal",
Resource: "os",
Verb: "get",
ArgsType: reflect.TypeOf(baremetal.GetOsRequest{}),
ArgSpecs: core.ArgSpecs{
{
Name: "os-id",
Short: `ID of the researched OS`,
Required: true,
},
core.ZoneArgSpec(scw.ZoneFrPar2),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*baremetal.GetOsRequest)

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

},
}
}

0 comments on commit 135b476

Please sign in to comment.