Skip to content

Commit 415b658

Browse files
scaleway-botyfodil
andauthored
fix(mongodb): add missing UpdateSnapshot endpoint in documentation (#4217)
Co-authored-by: Yacine Fodil <[email protected]>
1 parent 6a01239 commit 415b658

File tree

4 files changed

+90
-0
lines changed

4 files changed

+90
-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 the parameters of a snapshot of a Database Instance. You can update the `name` and `expires_at` parameters.
4+
5+
USAGE:
6+
scw mongodb snapshot update <snapshot-id ...> [arg=value ...]
7+
8+
ARGS:
9+
snapshot-id UUID of the Snapshot
10+
[name] Name of the snapshot
11+
[expires-at] Expiration date of the snapshot (must follow the ISO 8601 format)
12+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
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-mongodb-snapshot-usage.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ AVAILABLE COMMANDS:
1111
get Get a Database Instance snapshot
1212
list List snapshots
1313
restore Restore a Database Instance snapshot
14+
update Update a Database Instance snapshot
1415

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

docs/commands/mongodb.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ This API allows you to manage your Managed Databases for MongoDB.
1818
- [Get a Database Instance snapshot](#get-a-database-instance-snapshot)
1919
- [List snapshots](#list-snapshots)
2020
- [Restore a Database Instance snapshot](#restore-a-database-instance-snapshot)
21+
- [Update a Database Instance snapshot](#update-a-database-instance-snapshot)
2122
- [User management commands](#user-management-commands)
2223
- [List users of a Database Instance](#list-users-of-a-database-instance)
2324
- [Update a user on a Database Instance](#update-a-user-on-a-database-instance)
@@ -327,6 +328,28 @@ scw mongodb snapshot restore <snapshot-id ...> [arg=value ...]
327328

328329

329330

331+
### Update a Database Instance snapshot
332+
333+
Update the parameters of a snapshot of a Database Instance. You can update the `name` and `expires_at` parameters.
334+
335+
**Usage:**
336+
337+
```
338+
scw mongodb snapshot update <snapshot-id ...> [arg=value ...]
339+
```
340+
341+
342+
**Args:**
343+
344+
| Name | | Description |
345+
|------|---|-------------|
346+
| snapshot-id | Required | UUID of the Snapshot |
347+
| name | | Name of the snapshot |
348+
| expires-at | | Expiration date of the snapshot (must follow the ISO 8601 format) |
349+
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |
350+
351+
352+
330353
## User management commands
331354

332355
Users are profiles to which you can attribute database-level permissions. They allow you to define permissions specific to each type of database usage.

internal/namespaces/mongodb/v1alpha1/mongodb_cli.go

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func GetGeneratedCommands() *core.Commands {
3636
mongodbInstanceGetCertificate(),
3737
mongodbSnapshotCreate(),
3838
mongodbSnapshotGet(),
39+
mongodbSnapshotUpdate(),
3940
mongodbSnapshotRestore(),
4041
mongodbSnapshotList(),
4142
mongodbSnapshotDelete(),
@@ -582,6 +583,50 @@ func mongodbSnapshotGet() *core.Command {
582583
}
583584
}
584585

586+
func mongodbSnapshotUpdate() *core.Command {
587+
return &core.Command{
588+
Short: `Update a Database Instance snapshot`,
589+
Long: `Update the parameters of a snapshot of a Database Instance. You can update the ` + "`" + `name` + "`" + ` and ` + "`" + `expires_at` + "`" + ` parameters.`,
590+
Namespace: "mongodb",
591+
Resource: "snapshot",
592+
Verb: "update",
593+
// Deprecated: false,
594+
ArgsType: reflect.TypeOf(mongodb.UpdateSnapshotRequest{}),
595+
ArgSpecs: core.ArgSpecs{
596+
{
597+
Name: "snapshot-id",
598+
Short: `UUID of the Snapshot`,
599+
Required: true,
600+
Deprecated: false,
601+
Positional: true,
602+
},
603+
{
604+
Name: "name",
605+
Short: `Name of the snapshot`,
606+
Required: false,
607+
Deprecated: false,
608+
Positional: false,
609+
},
610+
{
611+
Name: "expires-at",
612+
Short: `Expiration date of the snapshot (must follow the ISO 8601 format)`,
613+
Required: false,
614+
Deprecated: false,
615+
Positional: false,
616+
},
617+
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw),
618+
},
619+
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
620+
request := args.(*mongodb.UpdateSnapshotRequest)
621+
622+
client := core.ExtractClient(ctx)
623+
api := mongodb.NewAPI(client)
624+
return api.UpdateSnapshot(request)
625+
626+
},
627+
}
628+
}
629+
585630
func mongodbSnapshotRestore() *core.Command {
586631
return &core.Command{
587632
Short: `Restore a Database Instance snapshot`,

0 commit comments

Comments
 (0)