Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(baremetal): generate api v3 #4165

Merged
merged 1 commit into from
Oct 4, 2024
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/mattn/go-isatty v0.0.20
github.com/moby/buildkit v0.13.2
github.com/opencontainers/go-digest v1.0.0
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241003135237-a80efc7ba222
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241004134157-341bb81754f8
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,8 @@ github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUz
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241003135237-a80efc7ba222 h1:lr/Ewp6Ph3cXaEAyaPJqT7ZvC/wBnm1VoRHVz1FqOkM=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241003135237-a80efc7ba222/go.mod h1:o/2twhmcz4HlhtuuubCuwQ/fe+zyzoJR85+02gy04yY=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241004134157-341bb81754f8 h1:8xCVwaQSLX+LnnpeUzJKmvLZJ75IxjNdHLVujXDw3Hc=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241004134157-341bb81754f8/go.mod h1:o/2twhmcz4HlhtuuubCuwQ/fe+zyzoJR85+02gy04yY=
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM=
github.com/secure-systems-lab/go-securesystemslib v0.8.0 h1:mr5An6X45Kb2nddcFlbmfHkLguCE9laoZCUzEEpIZXA=
Expand Down
251 changes: 251 additions & 0 deletions internal/namespaces/baremetal/v3/baremetal_cli.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
// This file was automatically generated. DO NOT EDIT.
// If you have any remark or suggestion do not hesitate to open an issue.

package baremetal

import (
"context"
"reflect"

"github.com/scaleway/scaleway-cli/v2/core"
"github.com/scaleway/scaleway-sdk-go/api/baremetal/v3"
"github.com/scaleway/scaleway-sdk-go/scw"
)

// always import dependencies
var (
_ = scw.RegionFrPar
)

func GetGeneratedCommands() *core.Commands {
return core.NewCommands(
baremetalRoot(),
baremetalPrivateNetwork(),
baremetalPrivateNetworkAdd(),
baremetalPrivateNetworkSet(),
baremetalPrivateNetworkList(),
baremetalPrivateNetworkDelete(),
)
}
func baremetalRoot() *core.Command {
return &core.Command{
Short: `Elastic Metal - Private Networks API`,
Long: `Elastic Metal - Private Networks API.`,
Namespace: "baremetal",
}
}

func baremetalPrivateNetwork() *core.Command {
return &core.Command{
Short: `Private network management command`,
Long: `A Private Network allows you to interconnect your resources
in an isolated and private
network. Network reachability is limited to the
resources that are on the same Private Network. A VLAN
interface is available on the server and can be freely
managed (adding IP addresses, shutdown interface etc.).

Note that a resource can be a part of multiple Private Networks.`,
Namespace: "baremetal",
Resource: "private-network",
}
}

func baremetalPrivateNetworkAdd() *core.Command {
return &core.Command{
Short: `Add a server to a Private Network`,
Long: `Add an Elastic Metal server to a Private Network.`,
Namespace: "baremetal",
Resource: "private-network",
Verb: "add",
// Deprecated: false,
ArgsType: reflect.TypeOf(baremetal.PrivateNetworkAPIAddServerPrivateNetworkRequest{}),
ArgSpecs: core.ArgSpecs{
{
Name: "server-id",
Short: `UUID of the server`,
Required: true,
Deprecated: false,
Positional: false,
},
{
Name: "private-network-id",
Short: `UUID of the Private Network`,
Required: true,
Deprecated: false,
Positional: false,
},
{
Name: "ipam-ip-ids.{index}",
Short: `IPAM IDs of an IPs to attach to the server`,
Required: false,
Deprecated: false,
Positional: false,
},
core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneNlAms1, scw.ZoneNlAms2, scw.ZonePlWaw2, scw.ZonePlWaw3),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*baremetal.PrivateNetworkAPIAddServerPrivateNetworkRequest)

client := core.ExtractClient(ctx)
api := baremetal.NewPrivateNetworkAPI(client)
return api.AddServerPrivateNetwork(request)

},
}
}

func baremetalPrivateNetworkSet() *core.Command {
return &core.Command{
Short: `Set multiple Private Networks on a server`,
Long: `Configure multiple Private Networks on an Elastic Metal server.`,
Namespace: "baremetal",
Resource: "private-network",
Verb: "set",
// Deprecated: false,
ArgsType: reflect.TypeOf(baremetal.PrivateNetworkAPISetServerPrivateNetworksRequest{}),
ArgSpecs: core.ArgSpecs{
{
Name: "server-id",
Short: `UUID of the server`,
Required: true,
Deprecated: false,
Positional: false,
},
{
Name: "per-private-network-ipam-ip-ids.{key}",
Short: `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.`,
Required: true,
Deprecated: false,
Positional: false,
},
core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneNlAms1, scw.ZoneNlAms2, scw.ZonePlWaw2, scw.ZonePlWaw3),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*baremetal.PrivateNetworkAPISetServerPrivateNetworksRequest)

client := core.ExtractClient(ctx)
api := baremetal.NewPrivateNetworkAPI(client)
return api.SetServerPrivateNetworks(request)

},
}
}

func baremetalPrivateNetworkList() *core.Command {
return &core.Command{
Short: `List the Private Networks of a server`,
Long: `List the Private Networks of an Elastic Metal server.`,
Namespace: "baremetal",
Resource: "private-network",
Verb: "list",
// Deprecated: false,
ArgsType: reflect.TypeOf(baremetal.PrivateNetworkAPIListServerPrivateNetworksRequest{}),
ArgSpecs: core.ArgSpecs{
{
Name: "order-by",
Short: `Sort order for the returned Private Networks`,
Required: false,
Deprecated: false,
Positional: false,
EnumValues: []string{"created_at_asc", "created_at_desc", "updated_at_asc", "updated_at_desc"},
},
{
Name: "server-id",
Short: `Filter Private Networks by server UUID`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "private-network-id",
Short: `Filter Private Networks by Private Network UUID`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "project-id",
Short: `Filter Private Networks by project UUID`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "ipam-ip-ids.{index}",
Short: `Filter Private Networks by IPAM IP UUIDs`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "organization-id",
Short: `Filter Private Networks by organization UUID`,
Required: false,
Deprecated: false,
Positional: false,
},
core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneNlAms1, scw.ZoneNlAms2, scw.ZonePlWaw2, scw.ZonePlWaw3, scw.Zone(core.AllLocalities)),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*baremetal.PrivateNetworkAPIListServerPrivateNetworksRequest)

client := core.ExtractClient(ctx)
api := baremetal.NewPrivateNetworkAPI(client)
opts := []scw.RequestOption{scw.WithAllPages()}
if request.Zone == scw.Zone(core.AllLocalities) {
opts = append(opts, scw.WithZones(api.Zones()...))
request.Zone = ""
}
resp, err := api.ListServerPrivateNetworks(request, opts...)
if err != nil {
return nil, err
}
return resp.ServerPrivateNetworks, nil

},
}
}

func baremetalPrivateNetworkDelete() *core.Command {
return &core.Command{
Short: `Delete a Private Network`,
Long: `Delete a Private Network.`,
Namespace: "baremetal",
Resource: "private-network",
Verb: "delete",
// Deprecated: false,
ArgsType: reflect.TypeOf(baremetal.PrivateNetworkAPIDeleteServerPrivateNetworkRequest{}),
ArgSpecs: core.ArgSpecs{
{
Name: "server-id",
Short: `UUID of the server`,
Required: true,
Deprecated: false,
Positional: false,
},
{
Name: "private-network-id",
Short: `UUID of the Private Network`,
Required: true,
Deprecated: false,
Positional: false,
},
core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneNlAms1, scw.ZoneNlAms2, scw.ZonePlWaw2, scw.ZonePlWaw3),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*baremetal.PrivateNetworkAPIDeleteServerPrivateNetworkRequest)

client := core.ExtractClient(ctx)
api := baremetal.NewPrivateNetworkAPI(client)
e = api.DeleteServerPrivateNetwork(request)
if e != nil {
return nil, e
}
return &core.SuccessResult{
Resource: "private-network",
Verb: "delete",
}, nil
},
}
}
Loading