diff --git a/cmd/scw/testdata/test-all-usage-redis-endpoint-update-usage.golden b/cmd/scw/testdata/test-all-usage-redis-endpoint-update-usage.golden new file mode 100644 index 0000000000..94e8f45ffa --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-redis-endpoint-update-usage.golden @@ -0,0 +1,21 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟥🟥🟥 STDERR️️ 🟥🟥🟥️ +Update information about a Redis™ Database Instance (Redis™ cluster) endpoint. Full details about the endpoint, like `ips`, `port`, `private_network` and `public_network` specifications are returned in the response. + +USAGE: + scw redis endpoint update [arg=value ...] + +ARGS: + endpoint-id + [private-network.id] UUID of the Private Network to connect to the Database Instance + [private-network.service-ips.{index}] Endpoint IPv4 address with a CIDR notation. You must provide at least one IPv4 per node. + [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 | nl-ams-2 | pl-waw-1 | pl-waw-2) + +FLAGS: + -h, --help help for update + +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-redis-endpoint-usage.golden b/cmd/scw/testdata/test-all-usage-redis-endpoint-usage.golden index 252d8255b3..ba8db538de 100644 --- a/cmd/scw/testdata/test-all-usage-redis-endpoint-usage.golden +++ b/cmd/scw/testdata/test-all-usage-redis-endpoint-usage.golden @@ -10,6 +10,7 @@ AVAILABLE COMMANDS: delete Delete an endpoint for a cluster get Get an endpoint set Set endpoints for a cluster + update Update an endpoint FLAGS: -h, --help help for endpoint diff --git a/docs/commands/redis.md b/docs/commands/redis.md index cf38fc68f1..7f2450652f 100644 --- a/docs/commands/redis.md +++ b/docs/commands/redis.md @@ -22,6 +22,7 @@ Managed Database for Redis™ API. - [Delete an endpoint for a cluster](#delete-an-endpoint-for-a-cluster) - [Get an endpoint](#get-an-endpoint) - [Set endpoints for a cluster](#set-endpoints-for-a-cluster) + - [Update an endpoint](#update-an-endpoint) - [Node Types management commands](#node-types-management-commands) - [List available node types](#list-available-node-types) - [Settings management commands](#settings-management-commands) @@ -427,6 +428,28 @@ scw redis endpoint set [arg=value ...] +### Update an endpoint + +Update information about a Redis™ Database Instance (Redis™ cluster) endpoint. Full details about the endpoint, like `ips`, `port`, `private_network` and `public_network` specifications are returned in the response. + +**Usage:** + +``` +scw redis endpoint update [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| endpoint-id | Required | | +| private-network.id | | UUID of the Private Network to connect to the Database Instance | +| private-network.service-ips.{index} | | Endpoint IPv4 address with a CIDR notation. You must provide at least one IPv4 per node. | +| zone | Default: `fr-par-1`
One of: `fr-par-1`, `fr-par-2`, `nl-ams-1`, `nl-ams-2`, `pl-waw-1`, `pl-waw-2` | Zone to target. If none is passed will use default zone from the config | + + + ## Node Types management commands Nodes are the compute units that make up your Redis™ Database Instance. Different node types are available with varying amounts of RAM and vCPU. diff --git a/internal/namespaces/redis/v1/redis_cli.go b/internal/namespaces/redis/v1/redis_cli.go index ade60b1b42..14a51a8d18 100644 --- a/internal/namespaces/redis/v1/redis_cli.go +++ b/internal/namespaces/redis/v1/redis_cli.go @@ -48,6 +48,7 @@ func GetGeneratedCommands() *core.Commands { redisEndpointAdd(), redisEndpointDelete(), redisEndpointGet(), + redisEndpointUpdate(), ) } func redisRoot() *core.Command { @@ -1116,3 +1117,46 @@ func redisEndpointGet() *core.Command { }, } } + +func redisEndpointUpdate() *core.Command { + return &core.Command{ + Short: `Update an endpoint`, + Long: `Update information about a Redis™ Database Instance (Redis™ cluster) endpoint. Full details about the endpoint, like ` + "`" + `ips` + "`" + `, ` + "`" + `port` + "`" + `, ` + "`" + `private_network` + "`" + ` and ` + "`" + `public_network` + "`" + ` specifications are returned in the response.`, + Namespace: "redis", + Resource: "endpoint", + Verb: "update", + // Deprecated: false, + ArgsType: reflect.TypeOf(redis.UpdateEndpointRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "endpoint-id", + Required: true, + Deprecated: false, + Positional: false, + }, + { + Name: "private-network.id", + Short: `UUID of the Private Network to connect to the Database Instance`, + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "private-network.service-ips.{index}", + Short: `Endpoint IPv4 address with a CIDR notation. You must provide at least one IPv4 per node.`, + Required: false, + Deprecated: false, + Positional: false, + }, + core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneNlAms1, scw.ZoneNlAms2, scw.ZonePlWaw1, scw.ZonePlWaw2), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*redis.UpdateEndpointRequest) + + client := core.ExtractClient(ctx) + api := redis.NewAPI(client) + return api.UpdateEndpoint(request) + + }, + } +}