Skip to content

Commit 1ae0709

Browse files
feat(datawarehouse): add support for get-certificate (#5292)
Co-authored-by: Rémy Léone <rleone@scaleway.com>
1 parent c68c037 commit 1ae0709

File tree

4 files changed

+78
-5
lines changed

4 files changed

+78
-5
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Retrieve the TLS certificate associated with a deployment.
4+
5+
USAGE:
6+
scw datawarehouse deployment get-certificate <deployment-id ...> [arg=value ...]
7+
8+
ARGS:
9+
deployment-id UUID of the deployment
10+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par)
11+
12+
FLAGS:
13+
-h, --help help for get-certificate
14+
--list-sub-commands List all subcommands
15+
16+
GLOBAL FLAGS:
17+
-c, --config string The path to the config file
18+
-D, --debug Enable debug mode
19+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
20+
-p, --profile string The config profile to use

cmd/scw/testdata/test-all-usage-datawarehouse-deployment-usage.golden

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ USAGE:
66
scw datawarehouse deployment <command>
77

88
AVAILABLE COMMANDS:
9-
create Create a deployment
10-
delete Delete a deployment
11-
get Get a deployment
12-
list List deployments
13-
update Update a deployment
9+
create Create a deployment
10+
delete Delete a deployment
11+
get Get a deployment
12+
get-certificate Get deployment TLS certificate
13+
list List deployments
14+
update Update a deployment
1415

1516
FLAGS:
1617
-h, --help help for deployment

docs/commands/datawarehouse.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Data Warehouse API.
1010
- [Create a deployment](#create-a-deployment)
1111
- [Delete a deployment](#delete-a-deployment)
1212
- [Get a deployment](#get-a-deployment)
13+
- [Get deployment TLS certificate](#get-deployment-tls-certificate)
1314
- [List deployments](#list-deployments)
1415
- [Update a deployment](#update-a-deployment)
1516
- [Endpoint management commands](#endpoint-management-commands)
@@ -167,6 +168,26 @@ scw datawarehouse deployment get <deployment-id ...> [arg=value ...]
167168

168169

169170

171+
### Get deployment TLS certificate
172+
173+
Retrieve the TLS certificate associated with a deployment.
174+
175+
**Usage:**
176+
177+
```
178+
scw datawarehouse deployment get-certificate <deployment-id ...> [arg=value ...]
179+
```
180+
181+
182+
**Args:**
183+
184+
| Name | | Description |
185+
|------|---|-------------|
186+
| deployment-id | Required | UUID of the deployment |
187+
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |
188+
189+
190+
170191
### List deployments
171192

172193
List all deployments in the specified region, for a given Scaleway Project. By default, the deployments returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. You can define additional parameters for your query, such as `tags` and `name`. For the `name` parameter, the value you provide will be checked against the whole name string to see if it includes the string you put in the parameter.

internal/namespaces/datawarehouse/v1beta1/datawarehouse_cli.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ func GetGeneratedCommands() *core.Commands {
3333
datawarehouseDeploymentCreate(),
3434
datawarehouseDeploymentUpdate(),
3535
datawarehouseDeploymentDelete(),
36+
datawarehouseDeploymentGetCertificate(),
3637
datawarehouseUserList(),
3738
datawarehouseUserCreate(),
3839
datawarehouseUserUpdate(),
@@ -469,6 +470,36 @@ func datawarehouseDeploymentDelete() *core.Command {
469470
}
470471
}
471472

473+
func datawarehouseDeploymentGetCertificate() *core.Command {
474+
return &core.Command{
475+
Short: `Get deployment TLS certificate`,
476+
Long: `Retrieve the TLS certificate associated with a deployment.`,
477+
Namespace: "datawarehouse",
478+
Resource: "deployment",
479+
Verb: "get-certificate",
480+
// Deprecated: false,
481+
ArgsType: reflect.TypeOf(datawarehouse.GetDeploymentCertificateRequest{}),
482+
ArgSpecs: core.ArgSpecs{
483+
{
484+
Name: "deployment-id",
485+
Short: `UUID of the deployment`,
486+
Required: true,
487+
Deprecated: false,
488+
Positional: true,
489+
},
490+
core.RegionArgSpec(scw.RegionFrPar),
491+
},
492+
Run: func(ctx context.Context, args any) (i any, e error) {
493+
request := args.(*datawarehouse.GetDeploymentCertificateRequest)
494+
495+
client := core.ExtractClient(ctx)
496+
api := datawarehouse.NewAPI(client)
497+
498+
return api.GetDeploymentCertificate(request)
499+
},
500+
}
501+
}
502+
472503
func datawarehouseUserList() *core.Command {
473504
return &core.Command{
474505
Short: `List users associated with a deployment`,

0 commit comments

Comments
 (0)