From 61df4be9249a0200e9ef0fc970f8675bce2eb503 Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Wed, 22 Mar 2023 19:03:57 +0000 Subject: [PATCH] feat: update generated APIs --- .../test-all-usage-fip-mac-move-usage.golden | 20 +++++ .../test-all-usage-fip-mac-usage.golden | 1 + ...l-usage-iam-group-set-members-usage.golden | 27 +++++++ .../test-all-usage-iam-group-usage.golden | 1 + ...st-all-usage-iam-policy-clone-usage.golden | 18 +++++ .../test-all-usage-iam-policy-usage.golden | 1 + docs/commands/fip.md | 22 +++++ docs/commands/iam.md | 42 ++++++++++ go.mod | 2 +- go.sum | 4 +- internal/namespaces/iam/v1alpha1/iam_cli.go | 80 +++++++++++++++++++ .../testdata/test-get-cluster-simple.golden | 1 + .../test-wait-cluster-wait-for-pools.golden | 3 +- 13 files changed, 218 insertions(+), 4 deletions(-) create mode 100644 cmd/scw/testdata/test-all-usage-fip-mac-move-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-iam-group-set-members-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-iam-policy-clone-usage.golden diff --git a/cmd/scw/testdata/test-all-usage-fip-mac-move-usage.golden b/cmd/scw/testdata/test-all-usage-fip-mac-move-usage.golden new file mode 100644 index 0000000000..cec10797da --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-fip-mac-move-usage.golden @@ -0,0 +1,20 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Move a Virtual MAC from a given Flexible IP onto another Flexible IP. + +USAGE: + scw fip mac move [arg=value ...] + +ARGS: + fip-id + [dst-fip-id] + [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) + +FLAGS: + -h, --help help for move + +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 diff --git a/cmd/scw/testdata/test-all-usage-fip-mac-usage.golden b/cmd/scw/testdata/test-all-usage-fip-mac-usage.golden index 6d45355733..5e20df6bc5 100644 --- a/cmd/scw/testdata/test-all-usage-fip-mac-usage.golden +++ b/cmd/scw/testdata/test-all-usage-fip-mac-usage.golden @@ -9,6 +9,7 @@ AVAILABLE COMMANDS: create Generate a virtual MAC on a given Flexible IP delete Remove a virtual MAC from a Flexible IP duplicate Duplicate a Virtual MAC + move Move a virtual MAC FLAGS: -h, --help help for mac diff --git a/cmd/scw/testdata/test-all-usage-iam-group-set-members-usage.golden b/cmd/scw/testdata/test-all-usage-iam-group-set-members-usage.golden new file mode 100644 index 0000000000..49185257d5 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-iam-group-set-members-usage.golden @@ -0,0 +1,27 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Overwrite users and applications configuration in a group. Any information that you add using this command will overwrite the previous configuration. + +USAGE: + scw iam group set-members [arg=value ...] + +ARGS: + group-id + user-ids.{index} + application-ids.{index} + +FLAGS: + -h, --help help for set-members + +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 + +SEE ALSO: + # Remove a group member + scw iam group remove-member + + # Create a group + scw iam group create diff --git a/cmd/scw/testdata/test-all-usage-iam-group-usage.golden b/cmd/scw/testdata/test-all-usage-iam-group-usage.golden index 76279215b1..84ad8abad1 100644 --- a/cmd/scw/testdata/test-all-usage-iam-group-usage.golden +++ b/cmd/scw/testdata/test-all-usage-iam-group-usage.golden @@ -12,6 +12,7 @@ AVAILABLE COMMANDS: get Get a group list List groups remove-member Remove a user or an application from a group + set-members Overwrite users and applications of a group update Update a group FLAGS: diff --git a/cmd/scw/testdata/test-all-usage-iam-policy-clone-usage.golden b/cmd/scw/testdata/test-all-usage-iam-policy-clone-usage.golden new file mode 100644 index 0000000000..69a927320b --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-iam-policy-clone-usage.golden @@ -0,0 +1,18 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Clone a policy. You must define specify the `policy_id` parameter in your request. + +USAGE: + scw iam policy clone [arg=value ...] + +ARGS: + policy-id + +FLAGS: + -h, --help help for clone + +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 diff --git a/cmd/scw/testdata/test-all-usage-iam-policy-usage.golden b/cmd/scw/testdata/test-all-usage-iam-policy-usage.golden index fd96596526..1247714c21 100644 --- a/cmd/scw/testdata/test-all-usage-iam-policy-usage.golden +++ b/cmd/scw/testdata/test-all-usage-iam-policy-usage.golden @@ -6,6 +6,7 @@ USAGE: scw iam policy AVAILABLE COMMANDS: + clone Clone a policy create Create a new policy delete Delete a policy get Get an existing policy diff --git a/docs/commands/fip.md b/docs/commands/fip.md index 4dd7567ef5..112786bc6f 100644 --- a/docs/commands/fip.md +++ b/docs/commands/fip.md @@ -14,6 +14,7 @@ Flexible IP API. - [Generate a virtual MAC on a given Flexible IP](#generate-a-virtual-mac-on-a-given-flexible-ip) - [Remove a virtual MAC from a Flexible IP](#remove-a-virtual-mac-from-a-flexible-ip) - [Duplicate a Virtual MAC](#duplicate-a-virtual-mac) + - [Move a virtual MAC](#move-a-virtual-mac) ## Flexible IP management commands @@ -244,3 +245,24 @@ scw fip mac duplicate [arg=value ...] +### Move a virtual MAC + +Move a Virtual MAC from a given Flexible IP onto another Flexible IP. + +**Usage:** + +``` +scw fip mac move [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| fip-id | Required | | +| dst-fip-id | | | +| zone | Default: `fr-par-1`
One of: `fr-par-1`, `fr-par-2`, `nl-ams-1` | Zone to target. If none is passed will use default zone from the config | + + + diff --git a/docs/commands/iam.md b/docs/commands/iam.md index 8a2c3eb7e3..2c8131e255 100644 --- a/docs/commands/iam.md +++ b/docs/commands/iam.md @@ -21,6 +21,7 @@ IAM API. - [Get a group](#get-a-group) - [List groups](#list-groups) - [Remove a user or an application from a group](#remove-a-user-or-an-application-from-a-group) + - [Overwrite users and applications of a group](#overwrite-users-and-applications-of-a-group) - [Update a group](#update-a-group) - [JWTs management commands](#jwts-management-commands) - [Delete a JWT](#delete-a-jwt) @@ -29,6 +30,7 @@ IAM API. - [Permission sets management commands](#permission-sets-management-commands) - [List permission sets](#list-permission-sets) - [Policies management commands](#policies-management-commands) + - [Clone a policy](#clone-a-policy) - [Create a new policy](#create-a-new-policy) - [Delete a policy](#delete-a-policy) - [Get an existing policy](#get-an-existing-policy) @@ -433,6 +435,27 @@ scw iam group remove-member [arg=value ...] +### Overwrite users and applications of a group + +Overwrite users and applications configuration in a group. Any information that you add using this command will overwrite the previous configuration. + +**Usage:** + +``` +scw iam group set-members [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| group-id | Required | | +| user-ids.{index} | Required | | +| application-ids.{index} | Required | | + + + ### Update a group Update the parameters of group, including `name` and `description`. @@ -548,6 +571,25 @@ scw iam permission-set list [arg=value ...] Policies management commands. +### Clone a policy + +Clone a policy. You must define specify the `policy_id` parameter in your request. + +**Usage:** + +``` +scw iam policy clone [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| policy-id | Required | | + + + ### Create a new policy Create a new application. You must define the `name` parameter in the request. You can specify parameters such as `user_id`, `groups_id`, `application_id`, `no_principal`, `rules` and its child attributes. diff --git a/go.mod b/go.mod index daf68728b0..d8be6c9060 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/moby/buildkit v0.11.4 github.com/opencontainers/go-digest v1.0.0 github.com/pkg/errors v0.9.1 - github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15.0.20230322094918-cd420ebc2d11 + github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15.0.20230322175238-aa881483e689 github.com/spf13/cobra v1.6.1 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.8.2 diff --git a/go.sum b/go.sum index 804bb8495c..6e7b8faa97 100644 --- a/go.sum +++ b/go.sum @@ -192,8 +192,8 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15.0.20230322094918-cd420ebc2d11 h1:tZBnGI0NIyTUV9+UYQrTFw1gqIcY/TcUBCfLrC/IvKY= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15.0.20230322094918-cd420ebc2d11/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15.0.20230322175238-aa881483e689 h1:QPpApIAOwB3/9ZPu+SOu5bjoN7keDalTCpyCf2VYx4w= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15.0.20230322175238-aa881483e689/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg= github.com/secure-systems-lab/go-securesystemslib v0.4.0 h1:b23VGrQhTA8cN2CbBw7/FulN9fTtqYUdS5+Oxzt+DUE= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= diff --git a/internal/namespaces/iam/v1alpha1/iam_cli.go b/internal/namespaces/iam/v1alpha1/iam_cli.go index 067ce5d204..840756c569 100644 --- a/internal/namespaces/iam/v1alpha1/iam_cli.go +++ b/internal/namespaces/iam/v1alpha1/iam_cli.go @@ -46,6 +46,7 @@ func GetGeneratedCommands() *core.Commands { iamGroupCreate(), iamGroupGet(), iamGroupUpdate(), + iamGroupSetMembers(), iamGroupAddMember(), iamGroupRemoveMember(), iamGroupDelete(), @@ -54,6 +55,7 @@ func GetGeneratedCommands() *core.Commands { iamPolicyGet(), iamPolicyUpdate(), iamPolicyDelete(), + iamPolicyClone(), iamRuleUpdate(), iamRuleList(), iamPermissionSetList(), @@ -953,6 +955,56 @@ func iamGroupUpdate() *core.Command { } } +func iamGroupSetMembers() *core.Command { + return &core.Command{ + Short: `Overwrite users and applications of a group`, + Long: `Overwrite users and applications configuration in a group. Any information that you add using this command will overwrite the previous configuration.`, + Namespace: "iam", + Resource: "group", + Verb: "set-members", + // Deprecated: false, + ArgsType: reflect.TypeOf(iam.SetGroupMembersRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "group-id", + Required: true, + Deprecated: false, + Positional: false, + }, + { + Name: "user-ids.{index}", + Required: true, + Deprecated: false, + Positional: false, + }, + { + Name: "application-ids.{index}", + Required: true, + Deprecated: false, + Positional: false, + }, + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*iam.SetGroupMembersRequest) + + client := core.ExtractClient(ctx) + api := iam.NewAPI(client) + return api.SetGroupMembers(request) + + }, + SeeAlsos: []*core.SeeAlso{ + { + Command: "scw iam group remove-member", + Short: "Remove a group member", + }, + { + Command: "scw iam group create", + Short: "Create a group", + }, + }, + } +} + func iamGroupAddMember() *core.Command { return &core.Command{ Short: `Add a user or an application to a group`, @@ -1413,6 +1465,34 @@ func iamPolicyDelete() *core.Command { } } +func iamPolicyClone() *core.Command { + return &core.Command{ + Short: `Clone a policy`, + Long: `Clone a policy. You must define specify the ` + "`" + `policy_id` + "`" + ` parameter in your request.`, + Namespace: "iam", + Resource: "policy", + Verb: "clone", + // Deprecated: false, + ArgsType: reflect.TypeOf(iam.ClonePolicyRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "policy-id", + Required: true, + Deprecated: false, + Positional: false, + }, + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*iam.ClonePolicyRequest) + + client := core.ExtractClient(ctx) + api := iam.NewAPI(client) + return api.ClonePolicy(request) + + }, + } +} + func iamRuleUpdate() *core.Command { return &core.Command{ Short: `Set rules of a given policy`, diff --git a/internal/namespaces/k8s/v1/testdata/test-get-cluster-simple.golden b/internal/namespaces/k8s/v1/testdata/test-get-cluster-simple.golden index d62f81b84a..407096e02b 100644 --- a/internal/namespaces/k8s/v1/testdata/test-get-cluster-simple.golden +++ b/internal/namespaces/k8s/v1/testdata/test-get-cluster-simple.golden @@ -96,6 +96,7 @@ ID NAME STATUS VERSION NODE TYPE MIN "required_claim": [] }, "apiserver_cert_sans": [], + "private_network_id": null, "pools": [ { "id": "42b228cf-ad4b-458e-b69b-046f8aa3c10c", diff --git a/internal/namespaces/k8s/v1/testdata/test-wait-cluster-wait-for-pools.golden b/internal/namespaces/k8s/v1/testdata/test-wait-cluster-wait-for-pools.golden index 81b6f4b2f1..26ecdc4871 100644 --- a/internal/namespaces/k8s/v1/testdata/test-wait-cluster-wait-for-pools.golden +++ b/internal/namespaces/k8s/v1/testdata/test-wait-cluster-wait-for-pools.golden @@ -91,5 +91,6 @@ GroupsPrefix - "groups_prefix": "", "required_claim": [] }, - "apiserver_cert_sans": [] + "apiserver_cert_sans": [], + "private_network_id": null }