From 3c24f1cfea860395a12f1427f6593ff7abf6f025 Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Thu, 21 Oct 2021 15:11:58 +0000 Subject: [PATCH 1/2] feat: update generated cli --- .../container/v1beta1/container_cli.go | 701 ++++++++++++++++++ .../flexibleip/v1alpha1/flexibleip_cli.go | 481 ++++++++++++ .../namespaces/instance/v1/instance_cli.go | 4 +- internal/namespaces/rdb/v1/rdb_cli.go | 128 +++- 4 files changed, 1311 insertions(+), 3 deletions(-) create mode 100644 internal/namespaces/container/v1beta1/container_cli.go create mode 100644 internal/namespaces/flexibleip/v1alpha1/flexibleip_cli.go diff --git a/internal/namespaces/container/v1beta1/container_cli.go b/internal/namespaces/container/v1beta1/container_cli.go new file mode 100644 index 0000000000..df605c5790 --- /dev/null +++ b/internal/namespaces/container/v1beta1/container_cli.go @@ -0,0 +1,701 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. + +package container + +import ( + "context" + "reflect" + + "github.com/scaleway/scaleway-cli/internal/core" + "github.com/scaleway/scaleway-sdk-go/api/container/v1beta1" + "github.com/scaleway/scaleway-sdk-go/scw" +) + +// always import dependencies +var ( + _ = scw.RegionFrPar +) + +func GetGeneratedCommands() *core.Commands { + return core.NewCommands( + containerRoot(), + containerNamespace(), + containerContainer(), + containerCron(), + containerNamespaceList(), + containerNamespaceGet(), + containerNamespaceCreate(), + containerNamespaceUpdate(), + containerNamespaceDelete(), + containerContainerList(), + containerContainerGet(), + containerContainerCreate(), + containerContainerUpdate(), + containerContainerDelete(), + containerCronList(), + containerCronGet(), + containerCronDelete(), + ) +} +func containerRoot() *core.Command { + return &core.Command{ + Short: `Container as a Service API`, + Long: ``, + Namespace: "container", + } +} + +func containerNamespace() *core.Command { + return &core.Command{ + Short: `Namespace management commands`, + Long: `Namespace management commands.`, + Namespace: "container", + Resource: "namespace", + } +} + +func containerContainer() *core.Command { + return &core.Command{ + Short: `Container management commands`, + Long: `Container management commands.`, + Namespace: "container", + Resource: "container", + } +} + +func containerCron() *core.Command { + return &core.Command{ + Short: `Cron management commands`, + Long: `Cron management commands.`, + Namespace: "container", + Resource: "cron", + } +} + +func containerNamespaceList() *core.Command { + return &core.Command{ + Short: `List all your namespaces`, + Long: `List all your namespaces.`, + Namespace: "container", + Resource: "namespace", + Verb: "list", + // Deprecated: false, + ArgsType: reflect.TypeOf(container.ListNamespacesRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "order-by", + Required: false, + Deprecated: false, + Positional: false, + EnumValues: []string{"created_at_asc", "created_at_desc", "name_asc", "name_desc"}, + }, + { + Name: "name", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "project-id", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "organization-id", + Required: false, + Deprecated: false, + Positional: false, + }, + core.RegionArgSpec(scw.RegionFrPar), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*container.ListNamespacesRequest) + + client := core.ExtractClient(ctx) + api := container.NewAPI(client) + resp, err := api.ListNamespaces(request, scw.WithAllPages()) + if err != nil { + return nil, err + } + return resp.Namespaces, nil + + }, + } +} + +func containerNamespaceGet() *core.Command { + return &core.Command{ + Short: `Get a namespace`, + Long: `Get the namespace associated with the given id.`, + Namespace: "container", + Resource: "namespace", + Verb: "get", + // Deprecated: false, + ArgsType: reflect.TypeOf(container.GetNamespaceRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "namespace-id", + Required: true, + Deprecated: false, + Positional: true, + }, + core.RegionArgSpec(scw.RegionFrPar), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*container.GetNamespaceRequest) + + client := core.ExtractClient(ctx) + api := container.NewAPI(client) + return api.GetNamespace(request) + + }, + } +} + +func containerNamespaceCreate() *core.Command { + return &core.Command{ + Short: `Create a new namespace`, + Long: `Create a new namespace.`, + Namespace: "container", + Resource: "namespace", + Verb: "create", + // Deprecated: false, + ArgsType: reflect.TypeOf(container.CreateNamespaceRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "name", + Required: false, + Deprecated: false, + Positional: false, + Default: core.RandomValueGenerator("cns"), + }, + { + Name: "environment-variables.value.{key}", + Required: false, + Deprecated: false, + Positional: false, + }, + core.ProjectIDArgSpec(), + { + Name: "description", + Required: false, + Deprecated: false, + Positional: false, + }, + core.RegionArgSpec(scw.RegionFrPar), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*container.CreateNamespaceRequest) + + client := core.ExtractClient(ctx) + api := container.NewAPI(client) + return api.CreateNamespace(request) + + }, + } +} + +func containerNamespaceUpdate() *core.Command { + return &core.Command{ + Short: `Update an existing namespace`, + Long: `Update the space associated with the given id.`, + Namespace: "container", + Resource: "namespace", + Verb: "update", + // Deprecated: false, + ArgsType: reflect.TypeOf(container.UpdateNamespaceRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "namespace-id", + Required: true, + Deprecated: false, + Positional: true, + }, + { + Name: "environment-variables.value.{key}", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "description", + Required: false, + Deprecated: false, + Positional: false, + }, + core.RegionArgSpec(scw.RegionFrPar), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*container.UpdateNamespaceRequest) + + client := core.ExtractClient(ctx) + api := container.NewAPI(client) + return api.UpdateNamespace(request) + + }, + } +} + +func containerNamespaceDelete() *core.Command { + return &core.Command{ + Short: `Delete an existing namespace`, + Long: `Delete the namespace associated with the given id.`, + Namespace: "container", + Resource: "namespace", + Verb: "delete", + // Deprecated: false, + ArgsType: reflect.TypeOf(container.DeleteNamespaceRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "namespace-id", + Required: true, + Deprecated: false, + Positional: true, + }, + core.RegionArgSpec(scw.RegionFrPar), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*container.DeleteNamespaceRequest) + + client := core.ExtractClient(ctx) + api := container.NewAPI(client) + return api.DeleteNamespace(request) + + }, + } +} + +func containerContainerList() *core.Command { + return &core.Command{ + Short: `List all your containers`, + Long: `List all your containers.`, + Namespace: "container", + Resource: "container", + Verb: "list", + // Deprecated: false, + ArgsType: reflect.TypeOf(container.ListContainersRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "order-by", + Required: false, + Deprecated: false, + Positional: false, + EnumValues: []string{"created_at_asc", "created_at_desc", "name_asc", "name_desc"}, + }, + { + Name: "namespace-id", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "name", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "project-id", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "organization-id", + Required: false, + Deprecated: false, + Positional: false, + }, + core.RegionArgSpec(scw.RegionFrPar), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*container.ListContainersRequest) + + client := core.ExtractClient(ctx) + api := container.NewAPI(client) + resp, err := api.ListContainers(request, scw.WithAllPages()) + if err != nil { + return nil, err + } + return resp.Containers, nil + + }, + } +} + +func containerContainerGet() *core.Command { + return &core.Command{ + Short: `Get a container`, + Long: `Get the container associated with the given id.`, + Namespace: "container", + Resource: "container", + Verb: "get", + // Deprecated: false, + ArgsType: reflect.TypeOf(container.GetContainerRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "container-id", + Required: true, + Deprecated: false, + Positional: true, + }, + core.RegionArgSpec(scw.RegionFrPar), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*container.GetContainerRequest) + + client := core.ExtractClient(ctx) + api := container.NewAPI(client) + return api.GetContainer(request) + + }, + } +} + +func containerContainerCreate() *core.Command { + return &core.Command{ + Short: `Create a new container`, + Long: `Create a new container.`, + Namespace: "container", + Resource: "container", + Verb: "create", + // Deprecated: false, + ArgsType: reflect.TypeOf(container.CreateContainerRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "namespace-id", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "name", + Required: false, + Deprecated: false, + Positional: false, + Default: core.RandomValueGenerator("ctnr"), + }, + { + Name: "environment-variables.value.{key}", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "min-scale", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "max-scale", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "memory-limit", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "timeout.seconds", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "timeout.nanos", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "privacy", + Required: false, + Deprecated: false, + Positional: false, + EnumValues: []string{"unknown_privacy", "public", "private"}, + }, + { + Name: "description", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "registry-image", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "max-concurrency", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "domain-name", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "protocol", + Required: false, + Deprecated: false, + Positional: false, + EnumValues: []string{"unknown_protocol", "http1", "h2c"}, + }, + core.RegionArgSpec(scw.RegionFrPar), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*container.CreateContainerRequest) + + client := core.ExtractClient(ctx) + api := container.NewAPI(client) + return api.CreateContainer(request) + + }, + } +} + +func containerContainerUpdate() *core.Command { + return &core.Command{ + Short: `Update an existing container`, + Long: `Update the container associated with the given id.`, + Namespace: "container", + Resource: "container", + Verb: "update", + // Deprecated: false, + ArgsType: reflect.TypeOf(container.UpdateContainerRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "container-id", + Required: true, + Deprecated: false, + Positional: true, + }, + { + Name: "environment-variables.value.{key}", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "min-scale", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "max-scale", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "memory-limit", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "timeout.seconds", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "timeout.nanos", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "redeploy", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "privacy", + Required: false, + Deprecated: false, + Positional: false, + EnumValues: []string{"unknown_privacy", "public", "private"}, + }, + { + Name: "description", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "registry-image", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "max-concurrency", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "domain-name", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "protocol", + Required: false, + Deprecated: false, + Positional: false, + EnumValues: []string{"unknown_protocol", "http1", "h2c"}, + }, + core.RegionArgSpec(scw.RegionFrPar), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*container.UpdateContainerRequest) + + client := core.ExtractClient(ctx) + api := container.NewAPI(client) + return api.UpdateContainer(request) + + }, + } +} + +func containerContainerDelete() *core.Command { + return &core.Command{ + Short: `Delete a container`, + Long: `Delete the container associated with the given id.`, + Namespace: "container", + Resource: "container", + Verb: "delete", + // Deprecated: false, + ArgsType: reflect.TypeOf(container.DeleteContainerRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "container-id", + Required: true, + Deprecated: false, + Positional: true, + }, + core.RegionArgSpec(scw.RegionFrPar), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*container.DeleteContainerRequest) + + client := core.ExtractClient(ctx) + api := container.NewAPI(client) + return api.DeleteContainer(request) + + }, + } +} + +func containerCronList() *core.Command { + return &core.Command{ + Short: `List all your crons`, + Long: `List all your crons.`, + Namespace: "container", + Resource: "cron", + Verb: "list", + // Deprecated: false, + ArgsType: reflect.TypeOf(container.ListCronsRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "order-by", + Required: false, + Deprecated: false, + Positional: false, + EnumValues: []string{"created_at_asc", "created_at_desc"}, + }, + { + Name: "container-id", + Required: false, + Deprecated: false, + Positional: false, + }, + core.RegionArgSpec(scw.RegionFrPar), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*container.ListCronsRequest) + + client := core.ExtractClient(ctx) + api := container.NewAPI(client) + resp, err := api.ListCrons(request, scw.WithAllPages()) + if err != nil { + return nil, err + } + return resp.Crons, nil + + }, + } +} + +func containerCronGet() *core.Command { + return &core.Command{ + Short: `Get a cron`, + Long: `Get the cron associated with the given id.`, + Namespace: "container", + Resource: "cron", + Verb: "get", + // Deprecated: false, + ArgsType: reflect.TypeOf(container.GetCronRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "cron-id", + Required: true, + Deprecated: false, + Positional: true, + }, + core.RegionArgSpec(scw.RegionFrPar), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*container.GetCronRequest) + + client := core.ExtractClient(ctx) + api := container.NewAPI(client) + return api.GetCron(request) + + }, + } +} + +func containerCronDelete() *core.Command { + return &core.Command{ + Short: `Delete an existing cron`, + Long: `Delete the cron associated with the given id.`, + Namespace: "container", + Resource: "cron", + Verb: "delete", + // Deprecated: false, + ArgsType: reflect.TypeOf(container.DeleteCronRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "cron-id", + Required: true, + Deprecated: false, + Positional: true, + }, + core.RegionArgSpec(scw.RegionFrPar), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*container.DeleteCronRequest) + + client := core.ExtractClient(ctx) + api := container.NewAPI(client) + return api.DeleteCron(request) + + }, + } +} diff --git a/internal/namespaces/flexibleip/v1alpha1/flexibleip_cli.go b/internal/namespaces/flexibleip/v1alpha1/flexibleip_cli.go new file mode 100644 index 0000000000..0f0886f658 --- /dev/null +++ b/internal/namespaces/flexibleip/v1alpha1/flexibleip_cli.go @@ -0,0 +1,481 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. + +package flexibleip + +import ( + "context" + "reflect" + + "github.com/scaleway/scaleway-cli/internal/core" + "github.com/scaleway/scaleway-sdk-go/api/flexibleip/v1alpha1" + "github.com/scaleway/scaleway-sdk-go/scw" +) + +// always import dependencies +var ( + _ = scw.RegionFrPar +) + +func GetGeneratedCommands() *core.Commands { + return core.NewCommands( + fipRoot(), + fipIP(), + fipMac(), + fipIPCreate(), + fipIPGet(), + fipIPList(), + fipIPUpdate(), + fipIPDelete(), + fipIPAttach(), + fipIPDetach(), + fipMacCreate(), + fipMacDuplicate(), + fipMacDelete(), + ) +} +func fipRoot() *core.Command { + return &core.Command{ + Short: `Flexible IP API`, + Long: ``, + Namespace: "fip", + } +} + +func fipIP() *core.Command { + return &core.Command{ + Short: `Flexible IP management commands`, + Long: `A Flexible IP can be attached to any server in the same zone. +A server can be linked with multiple Flexible IPs attached to it. +`, + Namespace: "fip", + Resource: "ip", + } +} + +func fipMac() *core.Command { + return &core.Command{ + Short: `MAC address management commands`, + Long: `MAC address management commands.`, + Namespace: "fip", + Resource: "mac", + } +} + +func fipIPCreate() *core.Command { + return &core.Command{ + Short: `Create a Flexible IP`, + Long: `Create a Flexible IP.`, + Namespace: "fip", + Resource: "ip", + Verb: "create", + // Deprecated: false, + ArgsType: reflect.TypeOf(flexibleip.CreateFlexibleIPRequest{}), + ArgSpecs: core.ArgSpecs{ + core.ProjectIDArgSpec(), + { + Name: "description", + Short: `Description to associate with the Flexible IP, max 255 characters`, + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "tags.{index}", + Short: `Tags to associate to the Flexible IP`, + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "server-id", + Short: `Server ID on which to attach the created Flexible IP`, + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "reverse", + Short: `Reverse DNS value`, + Required: false, + Deprecated: false, + Positional: false, + }, + core.ZoneArgSpec(scw.ZoneFrPar2), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*flexibleip.CreateFlexibleIPRequest) + + client := core.ExtractClient(ctx) + api := flexibleip.NewAPI(client) + return api.CreateFlexibleIP(request) + + }, + } +} + +func fipIPGet() *core.Command { + return &core.Command{ + Short: `Get a Flexible IP`, + Long: `Get a Flexible IP.`, + Namespace: "fip", + Resource: "ip", + Verb: "get", + // Deprecated: false, + ArgsType: reflect.TypeOf(flexibleip.GetFlexibleIPRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "fip-id", + Short: `Flexible IP ID`, + Required: true, + Deprecated: false, + Positional: true, + }, + core.ZoneArgSpec(scw.ZoneFrPar2), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*flexibleip.GetFlexibleIPRequest) + + client := core.ExtractClient(ctx) + api := flexibleip.NewAPI(client) + return api.GetFlexibleIP(request) + + }, + } +} + +func fipIPList() *core.Command { + return &core.Command{ + Short: `List Flexible IPs`, + Long: `List Flexible IPs.`, + Namespace: "fip", + Resource: "ip", + Verb: "list", + // Deprecated: false, + ArgsType: reflect.TypeOf(flexibleip.ListFlexibleIPsRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "order-by", + Short: `The sort order of the returned Flexible IPs`, + Required: false, + Deprecated: false, + Positional: false, + EnumValues: []string{"created_at_asc", "created_at_desc"}, + }, + { + Name: "tags.{index}", + Short: `Filter Flexible IPs with one or more matching tags`, + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "status.{index}", + Short: `Filter Flexible IPs by status`, + Required: false, + Deprecated: false, + Positional: false, + EnumValues: []string{"unknown", "ready", "updating", "attached", "error", "detaching", "locked"}, + }, + { + Name: "server-ids.{index}", + Short: `Filter Flexible IPs by server IDs`, + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "project-id", + Short: `Filter Flexible IPs by project ID`, + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "organization-id", + Short: `Filter Flexible IPs by organization ID`, + Required: false, + Deprecated: false, + Positional: false, + }, + core.ZoneArgSpec(scw.ZoneFrPar2), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*flexibleip.ListFlexibleIPsRequest) + + client := core.ExtractClient(ctx) + api := flexibleip.NewAPI(client) + resp, err := api.ListFlexibleIPs(request, scw.WithAllPages()) + if err != nil { + return nil, err + } + return resp.FlexibleIPs, nil + + }, + } +} + +func fipIPUpdate() *core.Command { + return &core.Command{ + Short: `Update a Flexible IP`, + Long: `Update a Flexible IP.`, + Namespace: "fip", + Resource: "ip", + Verb: "update", + // Deprecated: false, + ArgsType: reflect.TypeOf(flexibleip.UpdateFlexibleIPRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "fip-id", + Short: `ID of the Flexible IP to update`, + Required: true, + Deprecated: false, + Positional: false, + }, + { + Name: "description", + Short: `Description to associate with the Flexible IP, max 255 characters`, + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "tags.{index}", + Short: `Tags to associate with the Flexible IP`, + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "reverse", + Short: `Reverse DNS value`, + Required: false, + Deprecated: false, + Positional: false, + }, + core.ZoneArgSpec(scw.ZoneFrPar2), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*flexibleip.UpdateFlexibleIPRequest) + + client := core.ExtractClient(ctx) + api := flexibleip.NewAPI(client) + return api.UpdateFlexibleIP(request) + + }, + } +} + +func fipIPDelete() *core.Command { + return &core.Command{ + Short: `Delete a Flexible IP`, + Long: `Delete a Flexible IP.`, + Namespace: "fip", + Resource: "ip", + Verb: "delete", + // Deprecated: false, + ArgsType: reflect.TypeOf(flexibleip.DeleteFlexibleIPRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "fip-id", + Short: `ID of the Flexible IP to delete`, + Required: true, + Deprecated: false, + Positional: false, + }, + core.ZoneArgSpec(scw.ZoneFrPar2), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*flexibleip.DeleteFlexibleIPRequest) + + client := core.ExtractClient(ctx) + api := flexibleip.NewAPI(client) + e = api.DeleteFlexibleIP(request) + if e != nil { + return nil, e + } + return &core.SuccessResult{ + Resource: "ip", + Verb: "delete", + }, nil + }, + } +} + +func fipIPAttach() *core.Command { + return &core.Command{ + Short: `Attach a Flexible IP to a server`, + Long: `Attach a Flexible IP to a server.`, + Namespace: "fip", + Resource: "ip", + Verb: "attach", + // Deprecated: false, + ArgsType: reflect.TypeOf(flexibleip.AttachFlexibleIPRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "fips-ids.{index}", + Short: `A list of Flexible IP IDs to attach`, + Required: true, + Deprecated: false, + Positional: false, + }, + { + Name: "server-id", + Short: `A server ID on which to attach the Flexible IPs`, + Required: true, + Deprecated: false, + Positional: false, + }, + core.ZoneArgSpec(scw.ZoneFrPar2), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*flexibleip.AttachFlexibleIPRequest) + + client := core.ExtractClient(ctx) + api := flexibleip.NewAPI(client) + return api.AttachFlexibleIP(request) + + }, + } +} + +func fipIPDetach() *core.Command { + return &core.Command{ + Short: `Detach a Flexible IP from a server`, + Long: `Detach a Flexible IP from a server.`, + Namespace: "fip", + Resource: "ip", + Verb: "detach", + // Deprecated: false, + ArgsType: reflect.TypeOf(flexibleip.DetachFlexibleIPRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "fips-ids.{index}", + Short: `A list of Flexible IP IDs to detach`, + Required: true, + Deprecated: false, + Positional: false, + }, + core.ZoneArgSpec(scw.ZoneFrPar2), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*flexibleip.DetachFlexibleIPRequest) + + client := core.ExtractClient(ctx) + api := flexibleip.NewAPI(client) + return api.DetachFlexibleIP(request) + + }, + } +} + +func fipMacCreate() *core.Command { + return &core.Command{ + Short: `Generate a virtual MAC on a given Flexible IP`, + Long: `Generate a virtual MAC on a given Flexible IP.`, + Namespace: "fip", + Resource: "mac", + Verb: "create", + // Deprecated: false, + ArgsType: reflect.TypeOf(flexibleip.GenerateMACAddrRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "fip-id", + Short: `Flexible IP ID on which to generate a Virtual MAC`, + Required: true, + Deprecated: false, + Positional: false, + }, + { + Name: "mac-type", + Short: `TODO`, + Required: true, + Deprecated: false, + Positional: false, + EnumValues: []string{"unknown_type", "vmware", "xen", "kvm"}, + }, + core.ZoneArgSpec(scw.ZoneFrPar2), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*flexibleip.GenerateMACAddrRequest) + + client := core.ExtractClient(ctx) + api := flexibleip.NewAPI(client) + return api.GenerateMACAddr(request) + + }, + } +} + +func fipMacDuplicate() *core.Command { + return &core.Command{ + Short: `Duplicate a Virtual MAC`, + Long: `Duplicate a Virtual MAC from a given Flexible IP onto another attached on the same server.`, + Namespace: "fip", + Resource: "mac", + Verb: "duplicate", + // Deprecated: false, + ArgsType: reflect.TypeOf(flexibleip.DuplicateMACAddrRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "fip-id", + Short: `Flexible IP ID on which to duplicate the Virtual MAC`, + Required: true, + Deprecated: false, + Positional: false, + }, + { + Name: "duplicate-from-fip-id", + Short: `Flexible IP ID to duplicate the Virtual MAC from`, + Required: true, + Deprecated: false, + Positional: false, + }, + core.ZoneArgSpec(scw.ZoneFrPar2), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*flexibleip.DuplicateMACAddrRequest) + + client := core.ExtractClient(ctx) + api := flexibleip.NewAPI(client) + return api.DuplicateMACAddr(request) + + }, + } +} + +func fipMacDelete() *core.Command { + return &core.Command{ + Short: `Remove a virtual MAC from a Flexible IP`, + Long: `Remove a virtual MAC from a Flexible IP.`, + Namespace: "fip", + Resource: "mac", + Verb: "delete", + // Deprecated: false, + ArgsType: reflect.TypeOf(flexibleip.DeleteMACAddrRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "fip-id", + Short: `Flexible IP ID from which to delete the Virtual MAC`, + Required: true, + Deprecated: false, + Positional: false, + }, + core.ZoneArgSpec(scw.ZoneFrPar2), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*flexibleip.DeleteMACAddrRequest) + + client := core.ExtractClient(ctx) + api := flexibleip.NewAPI(client) + e = api.DeleteMACAddr(request) + if e != nil { + return nil, e + } + return &core.SuccessResult{ + Resource: "mac", + Verb: "delete", + }, nil + }, + } +} diff --git a/internal/namespaces/instance/v1/instance_cli.go b/internal/namespaces/instance/v1/instance_cli.go index 3dd4e46e5d..3cf71f46fd 100644 --- a/internal/namespaces/instance/v1/instance_cli.go +++ b/internal/namespaces/instance/v1/instance_cli.go @@ -1098,8 +1098,8 @@ func instanceImageCreate() *core.Command { }, Examples: []*core.Example{ { - Short: "Create an image named 'foobar' for x86_64 instances from the given root_volume ID (root_volume ID needs to be a snapshot UUID)", - ArgsJSON: `{"arch":"x86_64","name":"foobar","root_volume":"11111111-1111-1111-1111-111111111111"}`, + Short: "Create an image named 'foobar' for x86_64 instances from the given snapshot ID", + Raw: `scw instance image create name=foobar snapshot-id=11111111-1111-1111-1111-111111111111 arch=x86_64`, }, }, } diff --git a/internal/namespaces/rdb/v1/rdb_cli.go b/internal/namespaces/rdb/v1/rdb_cli.go index 0295ae1aed..d188f2449b 100644 --- a/internal/namespaces/rdb/v1/rdb_cli.go +++ b/internal/namespaces/rdb/v1/rdb_cli.go @@ -47,9 +47,12 @@ func GetGeneratedCommands() *core.Commands { rdbInstanceDelete(), rdbInstanceClone(), rdbInstanceGetCertificate(), + rdbInstanceRenewCertificate(), rdbLogPrepare(), rdbLogList(), rdbLogGet(), + rdbLogPurge(), + rdbLogListDetails(), rdbACLList(), rdbACLAdd(), rdbACLDelete(), @@ -888,6 +891,20 @@ func rdbInstanceUpdate() *core.Command { Deprecated: false, Positional: false, }, + { + Name: "logs-policy.max-age-retention", + Short: `Max age of remote logs to keep on the database instance`, + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "logs-policy.total-disk-retention", + Short: `Max disk size of remote logs to keep on the database instance`, + Required: false, + Deprecated: false, + Positional: false, + }, core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw), }, Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { @@ -1005,6 +1022,42 @@ func rdbInstanceGetCertificate() *core.Command { } } +func rdbInstanceRenewCertificate() *core.Command { + return &core.Command{ + Short: `Renew the TLS certificate of an instance`, + Long: `Renew the TLS certificate of an instance.`, + Namespace: "rdb", + Resource: "instance", + Verb: "renew-certificate", + // Deprecated: false, + ArgsType: reflect.TypeOf(rdb.RenewInstanceCertificateRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "instance-id", + Short: `UUID of the instance you want logs of`, + Required: true, + Deprecated: false, + Positional: true, + }, + core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*rdb.RenewInstanceCertificateRequest) + + client := core.ExtractClient(ctx) + api := rdb.NewAPI(client) + e = api.RenewInstanceCertificate(request) + if e != nil { + return nil, e + } + return &core.SuccessResult{ + Resource: "instance", + Verb: "renew-certificate", + }, nil + }, + } +} + func rdbLogPrepare() *core.Command { return &core.Command{ Short: `Prepare logs of a given instance`, @@ -1117,6 +1170,79 @@ func rdbLogGet() *core.Command { } } +func rdbLogPurge() *core.Command { + return &core.Command{ + Short: `Purge remote instances logs`, + Long: `Purge remote instances logs.`, + Namespace: "rdb", + Resource: "log", + Verb: "purge", + // Deprecated: false, + ArgsType: reflect.TypeOf(rdb.PurgeInstanceLogsRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "instance-id", + Short: `UUID of the instance you want logs of`, + Required: true, + Deprecated: false, + Positional: false, + }, + { + Name: "log-name", + Short: `Specific log name to purge`, + Required: false, + Deprecated: false, + Positional: false, + }, + core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*rdb.PurgeInstanceLogsRequest) + + client := core.ExtractClient(ctx) + api := rdb.NewAPI(client) + e = api.PurgeInstanceLogs(request) + if e != nil { + return nil, e + } + return &core.SuccessResult{ + Resource: "log", + Verb: "purge", + }, nil + }, + } +} + +func rdbLogListDetails() *core.Command { + return &core.Command{ + Short: `List remote instances logs details`, + Long: `List remote instances logs details.`, + Namespace: "rdb", + Resource: "log", + Verb: "list-details", + // Deprecated: false, + ArgsType: reflect.TypeOf(rdb.ListInstanceLogsDetailsRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "instance-id", + Short: `UUID of the instance you want logs of`, + Required: true, + Deprecated: false, + Positional: false, + }, + core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*rdb.ListInstanceLogsDetailsRequest) + + client := core.ExtractClient(ctx) + api := rdb.NewAPI(client) + return api.ListInstanceLogsDetails(request) + + }, + } +} + func rdbACLList() *core.Command { return &core.Command{ Short: `List ACL rules of a given instance`, @@ -1154,7 +1280,7 @@ func rdbACLList() *core.Command { func rdbACLAdd() *core.Command { return &core.Command{ Short: `Add an ACL instance to a given instance`, - Long: `Add an ACL instance to a given instance.`, + Long: `Add an additional ACL rule to a database instance.`, Namespace: "rdb", Resource: "acl", Verb: "add", From 8c08c3491ab4253b06b2000b9b7872774adbd148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20L=C3=A9one?= Date: Thu, 21 Oct 2021 17:28:33 +0200 Subject: [PATCH 2/2] Fix --- ...l-usage-instance-image-create-usage.golden | 4 +- docs/commands/instance.md | 4 +- .../container/v1beta1/container_cli.go | 701 ------------------ .../flexibleip/v1alpha1/flexibleip_cli.go | 481 ------------ internal/namespaces/rdb/v1/rdb_cli.go | 128 +--- 5 files changed, 5 insertions(+), 1313 deletions(-) delete mode 100644 internal/namespaces/container/v1beta1/container_cli.go delete mode 100644 internal/namespaces/flexibleip/v1alpha1/flexibleip_cli.go diff --git a/cmd/scw/testdata/test-all-usage-instance-image-create-usage.golden b/cmd/scw/testdata/test-all-usage-instance-image-create-usage.golden index ea7758e196..71eeceb237 100644 --- a/cmd/scw/testdata/test-all-usage-instance-image-create-usage.golden +++ b/cmd/scw/testdata/test-all-usage-instance-image-create-usage.golden @@ -6,8 +6,8 @@ USAGE: scw instance image create [arg=value ...] EXAMPLES: - Create an image named 'foobar' for x86_64 instances from the given root_volume ID (root_volume ID needs to be a snapshot UUID) - scw instance image create name=foobar root-volume=11111111-1111-1111-1111-111111111111 arch=x86_64 + Create an image named 'foobar' for x86_64 instances from the given snapshot ID + scw instance image create name=foobar snapshot-id=11111111-1111-1111-1111-111111111111 arch=x86_64 ARGS: [name=] Name of the image diff --git a/docs/commands/instance.md b/docs/commands/instance.md index da4af3d626..7e72d98724 100644 --- a/docs/commands/instance.md +++ b/docs/commands/instance.md @@ -119,9 +119,9 @@ scw instance image create [arg=value ...] **Examples:** -Create an image named 'foobar' for x86_64 instances from the given root_volume ID (root_volume ID needs to be a snapshot UUID) +Create an image named 'foobar' for x86_64 instances from the given snapshot ID ``` -scw instance image create name=foobar root-volume=11111111-1111-1111-1111-111111111111 arch=x86_64 +scw instance image create name=foobar snapshot-id=11111111-1111-1111-1111-111111111111 arch=x86_64 ``` diff --git a/internal/namespaces/container/v1beta1/container_cli.go b/internal/namespaces/container/v1beta1/container_cli.go deleted file mode 100644 index df605c5790..0000000000 --- a/internal/namespaces/container/v1beta1/container_cli.go +++ /dev/null @@ -1,701 +0,0 @@ -// This file was automatically generated. DO NOT EDIT. -// If you have any remark or suggestion do not hesitate to open an issue. - -package container - -import ( - "context" - "reflect" - - "github.com/scaleway/scaleway-cli/internal/core" - "github.com/scaleway/scaleway-sdk-go/api/container/v1beta1" - "github.com/scaleway/scaleway-sdk-go/scw" -) - -// always import dependencies -var ( - _ = scw.RegionFrPar -) - -func GetGeneratedCommands() *core.Commands { - return core.NewCommands( - containerRoot(), - containerNamespace(), - containerContainer(), - containerCron(), - containerNamespaceList(), - containerNamespaceGet(), - containerNamespaceCreate(), - containerNamespaceUpdate(), - containerNamespaceDelete(), - containerContainerList(), - containerContainerGet(), - containerContainerCreate(), - containerContainerUpdate(), - containerContainerDelete(), - containerCronList(), - containerCronGet(), - containerCronDelete(), - ) -} -func containerRoot() *core.Command { - return &core.Command{ - Short: `Container as a Service API`, - Long: ``, - Namespace: "container", - } -} - -func containerNamespace() *core.Command { - return &core.Command{ - Short: `Namespace management commands`, - Long: `Namespace management commands.`, - Namespace: "container", - Resource: "namespace", - } -} - -func containerContainer() *core.Command { - return &core.Command{ - Short: `Container management commands`, - Long: `Container management commands.`, - Namespace: "container", - Resource: "container", - } -} - -func containerCron() *core.Command { - return &core.Command{ - Short: `Cron management commands`, - Long: `Cron management commands.`, - Namespace: "container", - Resource: "cron", - } -} - -func containerNamespaceList() *core.Command { - return &core.Command{ - Short: `List all your namespaces`, - Long: `List all your namespaces.`, - Namespace: "container", - Resource: "namespace", - Verb: "list", - // Deprecated: false, - ArgsType: reflect.TypeOf(container.ListNamespacesRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "order-by", - Required: false, - Deprecated: false, - Positional: false, - EnumValues: []string{"created_at_asc", "created_at_desc", "name_asc", "name_desc"}, - }, - { - Name: "name", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "project-id", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "organization-id", - Required: false, - Deprecated: false, - Positional: false, - }, - core.RegionArgSpec(scw.RegionFrPar), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*container.ListNamespacesRequest) - - client := core.ExtractClient(ctx) - api := container.NewAPI(client) - resp, err := api.ListNamespaces(request, scw.WithAllPages()) - if err != nil { - return nil, err - } - return resp.Namespaces, nil - - }, - } -} - -func containerNamespaceGet() *core.Command { - return &core.Command{ - Short: `Get a namespace`, - Long: `Get the namespace associated with the given id.`, - Namespace: "container", - Resource: "namespace", - Verb: "get", - // Deprecated: false, - ArgsType: reflect.TypeOf(container.GetNamespaceRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "namespace-id", - Required: true, - Deprecated: false, - Positional: true, - }, - core.RegionArgSpec(scw.RegionFrPar), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*container.GetNamespaceRequest) - - client := core.ExtractClient(ctx) - api := container.NewAPI(client) - return api.GetNamespace(request) - - }, - } -} - -func containerNamespaceCreate() *core.Command { - return &core.Command{ - Short: `Create a new namespace`, - Long: `Create a new namespace.`, - Namespace: "container", - Resource: "namespace", - Verb: "create", - // Deprecated: false, - ArgsType: reflect.TypeOf(container.CreateNamespaceRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "name", - Required: false, - Deprecated: false, - Positional: false, - Default: core.RandomValueGenerator("cns"), - }, - { - Name: "environment-variables.value.{key}", - Required: false, - Deprecated: false, - Positional: false, - }, - core.ProjectIDArgSpec(), - { - Name: "description", - Required: false, - Deprecated: false, - Positional: false, - }, - core.RegionArgSpec(scw.RegionFrPar), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*container.CreateNamespaceRequest) - - client := core.ExtractClient(ctx) - api := container.NewAPI(client) - return api.CreateNamespace(request) - - }, - } -} - -func containerNamespaceUpdate() *core.Command { - return &core.Command{ - Short: `Update an existing namespace`, - Long: `Update the space associated with the given id.`, - Namespace: "container", - Resource: "namespace", - Verb: "update", - // Deprecated: false, - ArgsType: reflect.TypeOf(container.UpdateNamespaceRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "namespace-id", - Required: true, - Deprecated: false, - Positional: true, - }, - { - Name: "environment-variables.value.{key}", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "description", - Required: false, - Deprecated: false, - Positional: false, - }, - core.RegionArgSpec(scw.RegionFrPar), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*container.UpdateNamespaceRequest) - - client := core.ExtractClient(ctx) - api := container.NewAPI(client) - return api.UpdateNamespace(request) - - }, - } -} - -func containerNamespaceDelete() *core.Command { - return &core.Command{ - Short: `Delete an existing namespace`, - Long: `Delete the namespace associated with the given id.`, - Namespace: "container", - Resource: "namespace", - Verb: "delete", - // Deprecated: false, - ArgsType: reflect.TypeOf(container.DeleteNamespaceRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "namespace-id", - Required: true, - Deprecated: false, - Positional: true, - }, - core.RegionArgSpec(scw.RegionFrPar), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*container.DeleteNamespaceRequest) - - client := core.ExtractClient(ctx) - api := container.NewAPI(client) - return api.DeleteNamespace(request) - - }, - } -} - -func containerContainerList() *core.Command { - return &core.Command{ - Short: `List all your containers`, - Long: `List all your containers.`, - Namespace: "container", - Resource: "container", - Verb: "list", - // Deprecated: false, - ArgsType: reflect.TypeOf(container.ListContainersRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "order-by", - Required: false, - Deprecated: false, - Positional: false, - EnumValues: []string{"created_at_asc", "created_at_desc", "name_asc", "name_desc"}, - }, - { - Name: "namespace-id", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "name", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "project-id", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "organization-id", - Required: false, - Deprecated: false, - Positional: false, - }, - core.RegionArgSpec(scw.RegionFrPar), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*container.ListContainersRequest) - - client := core.ExtractClient(ctx) - api := container.NewAPI(client) - resp, err := api.ListContainers(request, scw.WithAllPages()) - if err != nil { - return nil, err - } - return resp.Containers, nil - - }, - } -} - -func containerContainerGet() *core.Command { - return &core.Command{ - Short: `Get a container`, - Long: `Get the container associated with the given id.`, - Namespace: "container", - Resource: "container", - Verb: "get", - // Deprecated: false, - ArgsType: reflect.TypeOf(container.GetContainerRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "container-id", - Required: true, - Deprecated: false, - Positional: true, - }, - core.RegionArgSpec(scw.RegionFrPar), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*container.GetContainerRequest) - - client := core.ExtractClient(ctx) - api := container.NewAPI(client) - return api.GetContainer(request) - - }, - } -} - -func containerContainerCreate() *core.Command { - return &core.Command{ - Short: `Create a new container`, - Long: `Create a new container.`, - Namespace: "container", - Resource: "container", - Verb: "create", - // Deprecated: false, - ArgsType: reflect.TypeOf(container.CreateContainerRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "namespace-id", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "name", - Required: false, - Deprecated: false, - Positional: false, - Default: core.RandomValueGenerator("ctnr"), - }, - { - Name: "environment-variables.value.{key}", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "min-scale", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "max-scale", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "memory-limit", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "timeout.seconds", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "timeout.nanos", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "privacy", - Required: false, - Deprecated: false, - Positional: false, - EnumValues: []string{"unknown_privacy", "public", "private"}, - }, - { - Name: "description", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "registry-image", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "max-concurrency", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "domain-name", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "protocol", - Required: false, - Deprecated: false, - Positional: false, - EnumValues: []string{"unknown_protocol", "http1", "h2c"}, - }, - core.RegionArgSpec(scw.RegionFrPar), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*container.CreateContainerRequest) - - client := core.ExtractClient(ctx) - api := container.NewAPI(client) - return api.CreateContainer(request) - - }, - } -} - -func containerContainerUpdate() *core.Command { - return &core.Command{ - Short: `Update an existing container`, - Long: `Update the container associated with the given id.`, - Namespace: "container", - Resource: "container", - Verb: "update", - // Deprecated: false, - ArgsType: reflect.TypeOf(container.UpdateContainerRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "container-id", - Required: true, - Deprecated: false, - Positional: true, - }, - { - Name: "environment-variables.value.{key}", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "min-scale", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "max-scale", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "memory-limit", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "timeout.seconds", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "timeout.nanos", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "redeploy", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "privacy", - Required: false, - Deprecated: false, - Positional: false, - EnumValues: []string{"unknown_privacy", "public", "private"}, - }, - { - Name: "description", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "registry-image", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "max-concurrency", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "domain-name", - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "protocol", - Required: false, - Deprecated: false, - Positional: false, - EnumValues: []string{"unknown_protocol", "http1", "h2c"}, - }, - core.RegionArgSpec(scw.RegionFrPar), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*container.UpdateContainerRequest) - - client := core.ExtractClient(ctx) - api := container.NewAPI(client) - return api.UpdateContainer(request) - - }, - } -} - -func containerContainerDelete() *core.Command { - return &core.Command{ - Short: `Delete a container`, - Long: `Delete the container associated with the given id.`, - Namespace: "container", - Resource: "container", - Verb: "delete", - // Deprecated: false, - ArgsType: reflect.TypeOf(container.DeleteContainerRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "container-id", - Required: true, - Deprecated: false, - Positional: true, - }, - core.RegionArgSpec(scw.RegionFrPar), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*container.DeleteContainerRequest) - - client := core.ExtractClient(ctx) - api := container.NewAPI(client) - return api.DeleteContainer(request) - - }, - } -} - -func containerCronList() *core.Command { - return &core.Command{ - Short: `List all your crons`, - Long: `List all your crons.`, - Namespace: "container", - Resource: "cron", - Verb: "list", - // Deprecated: false, - ArgsType: reflect.TypeOf(container.ListCronsRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "order-by", - Required: false, - Deprecated: false, - Positional: false, - EnumValues: []string{"created_at_asc", "created_at_desc"}, - }, - { - Name: "container-id", - Required: false, - Deprecated: false, - Positional: false, - }, - core.RegionArgSpec(scw.RegionFrPar), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*container.ListCronsRequest) - - client := core.ExtractClient(ctx) - api := container.NewAPI(client) - resp, err := api.ListCrons(request, scw.WithAllPages()) - if err != nil { - return nil, err - } - return resp.Crons, nil - - }, - } -} - -func containerCronGet() *core.Command { - return &core.Command{ - Short: `Get a cron`, - Long: `Get the cron associated with the given id.`, - Namespace: "container", - Resource: "cron", - Verb: "get", - // Deprecated: false, - ArgsType: reflect.TypeOf(container.GetCronRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "cron-id", - Required: true, - Deprecated: false, - Positional: true, - }, - core.RegionArgSpec(scw.RegionFrPar), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*container.GetCronRequest) - - client := core.ExtractClient(ctx) - api := container.NewAPI(client) - return api.GetCron(request) - - }, - } -} - -func containerCronDelete() *core.Command { - return &core.Command{ - Short: `Delete an existing cron`, - Long: `Delete the cron associated with the given id.`, - Namespace: "container", - Resource: "cron", - Verb: "delete", - // Deprecated: false, - ArgsType: reflect.TypeOf(container.DeleteCronRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "cron-id", - Required: true, - Deprecated: false, - Positional: true, - }, - core.RegionArgSpec(scw.RegionFrPar), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*container.DeleteCronRequest) - - client := core.ExtractClient(ctx) - api := container.NewAPI(client) - return api.DeleteCron(request) - - }, - } -} diff --git a/internal/namespaces/flexibleip/v1alpha1/flexibleip_cli.go b/internal/namespaces/flexibleip/v1alpha1/flexibleip_cli.go deleted file mode 100644 index 0f0886f658..0000000000 --- a/internal/namespaces/flexibleip/v1alpha1/flexibleip_cli.go +++ /dev/null @@ -1,481 +0,0 @@ -// This file was automatically generated. DO NOT EDIT. -// If you have any remark or suggestion do not hesitate to open an issue. - -package flexibleip - -import ( - "context" - "reflect" - - "github.com/scaleway/scaleway-cli/internal/core" - "github.com/scaleway/scaleway-sdk-go/api/flexibleip/v1alpha1" - "github.com/scaleway/scaleway-sdk-go/scw" -) - -// always import dependencies -var ( - _ = scw.RegionFrPar -) - -func GetGeneratedCommands() *core.Commands { - return core.NewCommands( - fipRoot(), - fipIP(), - fipMac(), - fipIPCreate(), - fipIPGet(), - fipIPList(), - fipIPUpdate(), - fipIPDelete(), - fipIPAttach(), - fipIPDetach(), - fipMacCreate(), - fipMacDuplicate(), - fipMacDelete(), - ) -} -func fipRoot() *core.Command { - return &core.Command{ - Short: `Flexible IP API`, - Long: ``, - Namespace: "fip", - } -} - -func fipIP() *core.Command { - return &core.Command{ - Short: `Flexible IP management commands`, - Long: `A Flexible IP can be attached to any server in the same zone. -A server can be linked with multiple Flexible IPs attached to it. -`, - Namespace: "fip", - Resource: "ip", - } -} - -func fipMac() *core.Command { - return &core.Command{ - Short: `MAC address management commands`, - Long: `MAC address management commands.`, - Namespace: "fip", - Resource: "mac", - } -} - -func fipIPCreate() *core.Command { - return &core.Command{ - Short: `Create a Flexible IP`, - Long: `Create a Flexible IP.`, - Namespace: "fip", - Resource: "ip", - Verb: "create", - // Deprecated: false, - ArgsType: reflect.TypeOf(flexibleip.CreateFlexibleIPRequest{}), - ArgSpecs: core.ArgSpecs{ - core.ProjectIDArgSpec(), - { - Name: "description", - Short: `Description to associate with the Flexible IP, max 255 characters`, - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "tags.{index}", - Short: `Tags to associate to the Flexible IP`, - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "server-id", - Short: `Server ID on which to attach the created Flexible IP`, - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "reverse", - Short: `Reverse DNS value`, - Required: false, - Deprecated: false, - Positional: false, - }, - core.ZoneArgSpec(scw.ZoneFrPar2), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*flexibleip.CreateFlexibleIPRequest) - - client := core.ExtractClient(ctx) - api := flexibleip.NewAPI(client) - return api.CreateFlexibleIP(request) - - }, - } -} - -func fipIPGet() *core.Command { - return &core.Command{ - Short: `Get a Flexible IP`, - Long: `Get a Flexible IP.`, - Namespace: "fip", - Resource: "ip", - Verb: "get", - // Deprecated: false, - ArgsType: reflect.TypeOf(flexibleip.GetFlexibleIPRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "fip-id", - Short: `Flexible IP ID`, - Required: true, - Deprecated: false, - Positional: true, - }, - core.ZoneArgSpec(scw.ZoneFrPar2), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*flexibleip.GetFlexibleIPRequest) - - client := core.ExtractClient(ctx) - api := flexibleip.NewAPI(client) - return api.GetFlexibleIP(request) - - }, - } -} - -func fipIPList() *core.Command { - return &core.Command{ - Short: `List Flexible IPs`, - Long: `List Flexible IPs.`, - Namespace: "fip", - Resource: "ip", - Verb: "list", - // Deprecated: false, - ArgsType: reflect.TypeOf(flexibleip.ListFlexibleIPsRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "order-by", - Short: `The sort order of the returned Flexible IPs`, - Required: false, - Deprecated: false, - Positional: false, - EnumValues: []string{"created_at_asc", "created_at_desc"}, - }, - { - Name: "tags.{index}", - Short: `Filter Flexible IPs with one or more matching tags`, - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "status.{index}", - Short: `Filter Flexible IPs by status`, - Required: false, - Deprecated: false, - Positional: false, - EnumValues: []string{"unknown", "ready", "updating", "attached", "error", "detaching", "locked"}, - }, - { - Name: "server-ids.{index}", - Short: `Filter Flexible IPs by server IDs`, - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "project-id", - Short: `Filter Flexible IPs by project ID`, - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "organization-id", - Short: `Filter Flexible IPs by organization ID`, - Required: false, - Deprecated: false, - Positional: false, - }, - core.ZoneArgSpec(scw.ZoneFrPar2), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*flexibleip.ListFlexibleIPsRequest) - - client := core.ExtractClient(ctx) - api := flexibleip.NewAPI(client) - resp, err := api.ListFlexibleIPs(request, scw.WithAllPages()) - if err != nil { - return nil, err - } - return resp.FlexibleIPs, nil - - }, - } -} - -func fipIPUpdate() *core.Command { - return &core.Command{ - Short: `Update a Flexible IP`, - Long: `Update a Flexible IP.`, - Namespace: "fip", - Resource: "ip", - Verb: "update", - // Deprecated: false, - ArgsType: reflect.TypeOf(flexibleip.UpdateFlexibleIPRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "fip-id", - Short: `ID of the Flexible IP to update`, - Required: true, - Deprecated: false, - Positional: false, - }, - { - Name: "description", - Short: `Description to associate with the Flexible IP, max 255 characters`, - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "tags.{index}", - Short: `Tags to associate with the Flexible IP`, - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "reverse", - Short: `Reverse DNS value`, - Required: false, - Deprecated: false, - Positional: false, - }, - core.ZoneArgSpec(scw.ZoneFrPar2), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*flexibleip.UpdateFlexibleIPRequest) - - client := core.ExtractClient(ctx) - api := flexibleip.NewAPI(client) - return api.UpdateFlexibleIP(request) - - }, - } -} - -func fipIPDelete() *core.Command { - return &core.Command{ - Short: `Delete a Flexible IP`, - Long: `Delete a Flexible IP.`, - Namespace: "fip", - Resource: "ip", - Verb: "delete", - // Deprecated: false, - ArgsType: reflect.TypeOf(flexibleip.DeleteFlexibleIPRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "fip-id", - Short: `ID of the Flexible IP to delete`, - Required: true, - Deprecated: false, - Positional: false, - }, - core.ZoneArgSpec(scw.ZoneFrPar2), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*flexibleip.DeleteFlexibleIPRequest) - - client := core.ExtractClient(ctx) - api := flexibleip.NewAPI(client) - e = api.DeleteFlexibleIP(request) - if e != nil { - return nil, e - } - return &core.SuccessResult{ - Resource: "ip", - Verb: "delete", - }, nil - }, - } -} - -func fipIPAttach() *core.Command { - return &core.Command{ - Short: `Attach a Flexible IP to a server`, - Long: `Attach a Flexible IP to a server.`, - Namespace: "fip", - Resource: "ip", - Verb: "attach", - // Deprecated: false, - ArgsType: reflect.TypeOf(flexibleip.AttachFlexibleIPRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "fips-ids.{index}", - Short: `A list of Flexible IP IDs to attach`, - Required: true, - Deprecated: false, - Positional: false, - }, - { - Name: "server-id", - Short: `A server ID on which to attach the Flexible IPs`, - Required: true, - Deprecated: false, - Positional: false, - }, - core.ZoneArgSpec(scw.ZoneFrPar2), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*flexibleip.AttachFlexibleIPRequest) - - client := core.ExtractClient(ctx) - api := flexibleip.NewAPI(client) - return api.AttachFlexibleIP(request) - - }, - } -} - -func fipIPDetach() *core.Command { - return &core.Command{ - Short: `Detach a Flexible IP from a server`, - Long: `Detach a Flexible IP from a server.`, - Namespace: "fip", - Resource: "ip", - Verb: "detach", - // Deprecated: false, - ArgsType: reflect.TypeOf(flexibleip.DetachFlexibleIPRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "fips-ids.{index}", - Short: `A list of Flexible IP IDs to detach`, - Required: true, - Deprecated: false, - Positional: false, - }, - core.ZoneArgSpec(scw.ZoneFrPar2), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*flexibleip.DetachFlexibleIPRequest) - - client := core.ExtractClient(ctx) - api := flexibleip.NewAPI(client) - return api.DetachFlexibleIP(request) - - }, - } -} - -func fipMacCreate() *core.Command { - return &core.Command{ - Short: `Generate a virtual MAC on a given Flexible IP`, - Long: `Generate a virtual MAC on a given Flexible IP.`, - Namespace: "fip", - Resource: "mac", - Verb: "create", - // Deprecated: false, - ArgsType: reflect.TypeOf(flexibleip.GenerateMACAddrRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "fip-id", - Short: `Flexible IP ID on which to generate a Virtual MAC`, - Required: true, - Deprecated: false, - Positional: false, - }, - { - Name: "mac-type", - Short: `TODO`, - Required: true, - Deprecated: false, - Positional: false, - EnumValues: []string{"unknown_type", "vmware", "xen", "kvm"}, - }, - core.ZoneArgSpec(scw.ZoneFrPar2), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*flexibleip.GenerateMACAddrRequest) - - client := core.ExtractClient(ctx) - api := flexibleip.NewAPI(client) - return api.GenerateMACAddr(request) - - }, - } -} - -func fipMacDuplicate() *core.Command { - return &core.Command{ - Short: `Duplicate a Virtual MAC`, - Long: `Duplicate a Virtual MAC from a given Flexible IP onto another attached on the same server.`, - Namespace: "fip", - Resource: "mac", - Verb: "duplicate", - // Deprecated: false, - ArgsType: reflect.TypeOf(flexibleip.DuplicateMACAddrRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "fip-id", - Short: `Flexible IP ID on which to duplicate the Virtual MAC`, - Required: true, - Deprecated: false, - Positional: false, - }, - { - Name: "duplicate-from-fip-id", - Short: `Flexible IP ID to duplicate the Virtual MAC from`, - Required: true, - Deprecated: false, - Positional: false, - }, - core.ZoneArgSpec(scw.ZoneFrPar2), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*flexibleip.DuplicateMACAddrRequest) - - client := core.ExtractClient(ctx) - api := flexibleip.NewAPI(client) - return api.DuplicateMACAddr(request) - - }, - } -} - -func fipMacDelete() *core.Command { - return &core.Command{ - Short: `Remove a virtual MAC from a Flexible IP`, - Long: `Remove a virtual MAC from a Flexible IP.`, - Namespace: "fip", - Resource: "mac", - Verb: "delete", - // Deprecated: false, - ArgsType: reflect.TypeOf(flexibleip.DeleteMACAddrRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "fip-id", - Short: `Flexible IP ID from which to delete the Virtual MAC`, - Required: true, - Deprecated: false, - Positional: false, - }, - core.ZoneArgSpec(scw.ZoneFrPar2), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*flexibleip.DeleteMACAddrRequest) - - client := core.ExtractClient(ctx) - api := flexibleip.NewAPI(client) - e = api.DeleteMACAddr(request) - if e != nil { - return nil, e - } - return &core.SuccessResult{ - Resource: "mac", - Verb: "delete", - }, nil - }, - } -} diff --git a/internal/namespaces/rdb/v1/rdb_cli.go b/internal/namespaces/rdb/v1/rdb_cli.go index d188f2449b..0295ae1aed 100644 --- a/internal/namespaces/rdb/v1/rdb_cli.go +++ b/internal/namespaces/rdb/v1/rdb_cli.go @@ -47,12 +47,9 @@ func GetGeneratedCommands() *core.Commands { rdbInstanceDelete(), rdbInstanceClone(), rdbInstanceGetCertificate(), - rdbInstanceRenewCertificate(), rdbLogPrepare(), rdbLogList(), rdbLogGet(), - rdbLogPurge(), - rdbLogListDetails(), rdbACLList(), rdbACLAdd(), rdbACLDelete(), @@ -891,20 +888,6 @@ func rdbInstanceUpdate() *core.Command { Deprecated: false, Positional: false, }, - { - Name: "logs-policy.max-age-retention", - Short: `Max age of remote logs to keep on the database instance`, - Required: false, - Deprecated: false, - Positional: false, - }, - { - Name: "logs-policy.total-disk-retention", - Short: `Max disk size of remote logs to keep on the database instance`, - Required: false, - Deprecated: false, - Positional: false, - }, core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw), }, Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { @@ -1022,42 +1005,6 @@ func rdbInstanceGetCertificate() *core.Command { } } -func rdbInstanceRenewCertificate() *core.Command { - return &core.Command{ - Short: `Renew the TLS certificate of an instance`, - Long: `Renew the TLS certificate of an instance.`, - Namespace: "rdb", - Resource: "instance", - Verb: "renew-certificate", - // Deprecated: false, - ArgsType: reflect.TypeOf(rdb.RenewInstanceCertificateRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "instance-id", - Short: `UUID of the instance you want logs of`, - Required: true, - Deprecated: false, - Positional: true, - }, - core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*rdb.RenewInstanceCertificateRequest) - - client := core.ExtractClient(ctx) - api := rdb.NewAPI(client) - e = api.RenewInstanceCertificate(request) - if e != nil { - return nil, e - } - return &core.SuccessResult{ - Resource: "instance", - Verb: "renew-certificate", - }, nil - }, - } -} - func rdbLogPrepare() *core.Command { return &core.Command{ Short: `Prepare logs of a given instance`, @@ -1170,79 +1117,6 @@ func rdbLogGet() *core.Command { } } -func rdbLogPurge() *core.Command { - return &core.Command{ - Short: `Purge remote instances logs`, - Long: `Purge remote instances logs.`, - Namespace: "rdb", - Resource: "log", - Verb: "purge", - // Deprecated: false, - ArgsType: reflect.TypeOf(rdb.PurgeInstanceLogsRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "instance-id", - Short: `UUID of the instance you want logs of`, - Required: true, - Deprecated: false, - Positional: false, - }, - { - Name: "log-name", - Short: `Specific log name to purge`, - Required: false, - Deprecated: false, - Positional: false, - }, - core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*rdb.PurgeInstanceLogsRequest) - - client := core.ExtractClient(ctx) - api := rdb.NewAPI(client) - e = api.PurgeInstanceLogs(request) - if e != nil { - return nil, e - } - return &core.SuccessResult{ - Resource: "log", - Verb: "purge", - }, nil - }, - } -} - -func rdbLogListDetails() *core.Command { - return &core.Command{ - Short: `List remote instances logs details`, - Long: `List remote instances logs details.`, - Namespace: "rdb", - Resource: "log", - Verb: "list-details", - // Deprecated: false, - ArgsType: reflect.TypeOf(rdb.ListInstanceLogsDetailsRequest{}), - ArgSpecs: core.ArgSpecs{ - { - Name: "instance-id", - Short: `UUID of the instance you want logs of`, - Required: true, - Deprecated: false, - Positional: false, - }, - core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw), - }, - Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*rdb.ListInstanceLogsDetailsRequest) - - client := core.ExtractClient(ctx) - api := rdb.NewAPI(client) - return api.ListInstanceLogsDetails(request) - - }, - } -} - func rdbACLList() *core.Command { return &core.Command{ Short: `List ACL rules of a given instance`, @@ -1280,7 +1154,7 @@ func rdbACLList() *core.Command { func rdbACLAdd() *core.Command { return &core.Command{ Short: `Add an ACL instance to a given instance`, - Long: `Add an additional ACL rule to a database instance.`, + Long: `Add an ACL instance to a given instance.`, Namespace: "rdb", Resource: "acl", Verb: "add",