Skip to content

Commit b9876c3

Browse files
committed
chore: merge master
2 parents 0b68c4f + 69e094c commit b9876c3

File tree

3 files changed

+119
-3
lines changed

3 files changed

+119
-3
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
Manage endpoints associated with a deployment.
44

55
USAGE:
6-
scw datawarehouse endpoint
6+
scw datawarehouse endpoint <command>
7+
8+
AVAILABLE COMMANDS:
9+
create Create a new endpoint for a deployment
10+
delete Delete an endpoint from a deployment
711

812
FLAGS:
913
-h, --help help for endpoint
@@ -14,3 +18,5 @@ GLOBAL FLAGS:
1418
-D, --debug Enable debug mode
1519
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
1620
-p, --profile string The config profile to use
21+
22+
Use "scw datawarehouse endpoint [command] --help" for more information about a command.

docs/commands/datawarehouse.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Data Warehouse API.
1414
- [List deployments](#list-deployments)
1515
- [Update a deployment](#update-a-deployment)
1616
- [Endpoint management commands](#endpoint-management-commands)
17+
- [Create a new endpoint for a deployment](#create-a-new-endpoint-for-a-deployment)
18+
- [Delete an endpoint from a deployment](#delete-an-endpoint-from-a-deployment)
1719
- [List available presets](#list-available-presets)
1820
- [List available presets](#list-available-presets)
1921
- [User management commands](#user-management-commands)
@@ -241,15 +243,47 @@ scw datawarehouse deployment update <deployment-id ...> [arg=value ...]
241243

242244
Manage endpoints associated with a deployment.
243245

244-
Manage endpoints associated with a deployment.
246+
247+
### Create a new endpoint for a deployment
248+
249+
Create a new endpoint for a deployment.
250+
251+
**Usage:**
252+
253+
```
254+
scw datawarehouse endpoint create [arg=value ...]
255+
```
256+
257+
258+
**Args:**
259+
260+
| Name | | Description |
261+
|------|---|-------------|
262+
| deployment-id | | UUID of the deployment |
263+
| endpoint.private-network.private-network-id | | UUID of the Private Network |
264+
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |
265+
266+
267+
268+
### Delete an endpoint from a deployment
269+
270+
Delete an endpoint from a deployment.
245271

246272
**Usage:**
247273

248274
```
249-
scw datawarehouse endpoint
275+
scw datawarehouse endpoint delete [arg=value ...]
250276
```
251277

252278

279+
**Args:**
280+
281+
| Name | | Description |
282+
|------|---|-------------|
283+
| endpoint-id | Required | UUID of the Endpoint to delete |
284+
| region | Default: `fr-par`<br />One of: `fr-par` | Region to target. If none is passed will use default region from the config |
285+
286+
253287

254288
## List available presets
255289

internal/namespaces/datawarehouse/v1beta1/datawarehouse_cli.go

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ func GetGeneratedCommands() *core.Commands {
3838
datawarehouseUserCreate(),
3939
datawarehouseUserUpdate(),
4040
datawarehouseUserDelete(),
41+
datawarehouseEndpointDelete(),
42+
datawarehouseEndpointCreate(),
4143
datawarehouseDatabaseList(),
4244
datawarehouseDatabaseCreate(),
4345
datawarehouseDatabaseDelete(),
@@ -706,6 +708,80 @@ func datawarehouseUserDelete() *core.Command {
706708
}
707709
}
708710

711+
func datawarehouseEndpointDelete() *core.Command {
712+
return &core.Command{
713+
Short: `Delete an endpoint from a deployment`,
714+
Long: `Delete an endpoint from a deployment.`,
715+
Namespace: "datawarehouse",
716+
Resource: "endpoint",
717+
Verb: "delete",
718+
// Deprecated: false,
719+
ArgsType: reflect.TypeOf(datawarehouse.DeleteEndpointRequest{}),
720+
ArgSpecs: core.ArgSpecs{
721+
{
722+
Name: "endpoint-id",
723+
Short: `UUID of the Endpoint to delete`,
724+
Required: true,
725+
Deprecated: false,
726+
Positional: false,
727+
},
728+
core.RegionArgSpec(scw.RegionFrPar),
729+
},
730+
Run: func(ctx context.Context, args any) (i any, e error) {
731+
request := args.(*datawarehouse.DeleteEndpointRequest)
732+
733+
client := core.ExtractClient(ctx)
734+
api := datawarehouse.NewAPI(client)
735+
e = api.DeleteEndpoint(request)
736+
if e != nil {
737+
return nil, e
738+
}
739+
740+
return &core.SuccessResult{
741+
Resource: "endpoint",
742+
Verb: "delete",
743+
}, nil
744+
},
745+
}
746+
}
747+
748+
func datawarehouseEndpointCreate() *core.Command {
749+
return &core.Command{
750+
Short: `Create a new endpoint for a deployment`,
751+
Long: `Create a new endpoint for a deployment.`,
752+
Namespace: "datawarehouse",
753+
Resource: "endpoint",
754+
Verb: "create",
755+
// Deprecated: false,
756+
ArgsType: reflect.TypeOf(datawarehouse.CreateEndpointRequest{}),
757+
ArgSpecs: core.ArgSpecs{
758+
{
759+
Name: "deployment-id",
760+
Short: `UUID of the deployment`,
761+
Required: false,
762+
Deprecated: false,
763+
Positional: false,
764+
},
765+
{
766+
Name: "endpoint.private-network.private-network-id",
767+
Short: `UUID of the Private Network`,
768+
Required: false,
769+
Deprecated: false,
770+
Positional: false,
771+
},
772+
core.RegionArgSpec(scw.RegionFrPar),
773+
},
774+
Run: func(ctx context.Context, args any) (i any, e error) {
775+
request := args.(*datawarehouse.CreateEndpointRequest)
776+
777+
client := core.ExtractClient(ctx)
778+
api := datawarehouse.NewAPI(client)
779+
780+
return api.CreateEndpoint(request)
781+
},
782+
}
783+
}
784+
709785
func datawarehouseDatabaseList() *core.Command {
710786
return &core.Command{
711787
Short: `List databases within a deployment`,

0 commit comments

Comments
 (0)