Skip to content

Commit 0c80ac5

Browse files
feat(redis): add UpdateEndpoint (#2905)
Co-authored-by: Rémy Léone <rleone@scaleway.com>
1 parent deae360 commit 0c80ac5

File tree

4 files changed

+89
-0
lines changed

4 files changed

+89
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
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.
4+
5+
USAGE:
6+
scw redis endpoint update [arg=value ...]
7+
8+
ARGS:
9+
endpoint-id
10+
[private-network.id] UUID of the Private Network to connect to the Database Instance
11+
[private-network.service-ips.{index}] Endpoint IPv4 address with a CIDR notation. You must provide at least one IPv4 per node.
12+
[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)
13+
14+
FLAGS:
15+
-h, --help help for update
16+
17+
GLOBAL FLAGS:
18+
-c, --config string The path to the config file
19+
-D, --debug Enable debug mode
20+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
21+
-p, --profile string The config profile to use

cmd/scw/testdata/test-all-usage-redis-endpoint-usage.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ AVAILABLE COMMANDS:
1010
delete Delete an endpoint for a cluster
1111
get Get an endpoint
1212
set Set endpoints for a cluster
13+
update Update an endpoint
1314

1415
FLAGS:
1516
-h, --help help for endpoint

docs/commands/redis.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Managed Database for Redis™ API.
2222
- [Delete an endpoint for a cluster](#delete-an-endpoint-for-a-cluster)
2323
- [Get an endpoint](#get-an-endpoint)
2424
- [Set endpoints for a cluster](#set-endpoints-for-a-cluster)
25+
- [Update an endpoint](#update-an-endpoint)
2526
- [Node Types management commands](#node-types-management-commands)
2627
- [List available node types](#list-available-node-types)
2728
- [Settings management commands](#settings-management-commands)
@@ -427,6 +428,28 @@ scw redis endpoint set [arg=value ...]
427428

428429

429430

431+
### Update an endpoint
432+
433+
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.
434+
435+
**Usage:**
436+
437+
```
438+
scw redis endpoint update [arg=value ...]
439+
```
440+
441+
442+
**Args:**
443+
444+
| Name | | Description |
445+
|------|---|-------------|
446+
| endpoint-id | Required | |
447+
| private-network.id | | UUID of the Private Network to connect to the Database Instance |
448+
| private-network.service-ips.{index} | | Endpoint IPv4 address with a CIDR notation. You must provide at least one IPv4 per node. |
449+
| zone | Default: `fr-par-1`<br />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 |
450+
451+
452+
430453
## Node Types management commands
431454

432455
Nodes are the compute units that make up your Redis™ Database Instance. Different node types are available with varying amounts of RAM and vCPU.

internal/namespaces/redis/v1/redis_cli.go

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ func GetGeneratedCommands() *core.Commands {
4848
redisEndpointAdd(),
4949
redisEndpointDelete(),
5050
redisEndpointGet(),
51+
redisEndpointUpdate(),
5152
)
5253
}
5354
func redisRoot() *core.Command {
@@ -1116,3 +1117,46 @@ func redisEndpointGet() *core.Command {
11161117
},
11171118
}
11181119
}
1120+
1121+
func redisEndpointUpdate() *core.Command {
1122+
return &core.Command{
1123+
Short: `Update an endpoint`,
1124+
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.`,
1125+
Namespace: "redis",
1126+
Resource: "endpoint",
1127+
Verb: "update",
1128+
// Deprecated: false,
1129+
ArgsType: reflect.TypeOf(redis.UpdateEndpointRequest{}),
1130+
ArgSpecs: core.ArgSpecs{
1131+
{
1132+
Name: "endpoint-id",
1133+
Required: true,
1134+
Deprecated: false,
1135+
Positional: false,
1136+
},
1137+
{
1138+
Name: "private-network.id",
1139+
Short: `UUID of the Private Network to connect to the Database Instance`,
1140+
Required: false,
1141+
Deprecated: false,
1142+
Positional: false,
1143+
},
1144+
{
1145+
Name: "private-network.service-ips.{index}",
1146+
Short: `Endpoint IPv4 address with a CIDR notation. You must provide at least one IPv4 per node.`,
1147+
Required: false,
1148+
Deprecated: false,
1149+
Positional: false,
1150+
},
1151+
core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneNlAms1, scw.ZoneNlAms2, scw.ZonePlWaw1, scw.ZonePlWaw2),
1152+
},
1153+
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
1154+
request := args.(*redis.UpdateEndpointRequest)
1155+
1156+
client := core.ExtractClient(ctx)
1157+
api := redis.NewAPI(client)
1158+
return api.UpdateEndpoint(request)
1159+
1160+
},
1161+
}
1162+
}

0 commit comments

Comments
 (0)