Skip to content

Commit

Permalink
fix(mongodb): add missing UpdateSnapshot endpoint in documentation (#…
Browse files Browse the repository at this point in the history
…4217)

Co-authored-by: Yacine Fodil <[email protected]>
  • Loading branch information
scaleway-bot and yfodil authored Oct 22, 2024
1 parent 6a01239 commit 415b658
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Update the parameters of a snapshot of a Database Instance. You can update the `name` and `expires_at` parameters.

USAGE:
scw mongodb snapshot update <snapshot-id ...> [arg=value ...]

ARGS:
snapshot-id UUID of the Snapshot
[name] Name of the snapshot
[expires-at] Expiration date of the snapshot (must follow the ISO 8601 format)
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)

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
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ AVAILABLE COMMANDS:
get Get a Database Instance snapshot
list List snapshots
restore Restore a Database Instance snapshot
update Update a Database Instance snapshot

FLAGS:
-h, --help help for snapshot
Expand Down
23 changes: 23 additions & 0 deletions docs/commands/mongodb.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ This API allows you to manage your Managed Databases for MongoDB.
- [Get a Database Instance snapshot](#get-a-database-instance-snapshot)
- [List snapshots](#list-snapshots)
- [Restore a Database Instance snapshot](#restore-a-database-instance-snapshot)
- [Update a Database Instance snapshot](#update-a-database-instance-snapshot)
- [User management commands](#user-management-commands)
- [List users of a Database Instance](#list-users-of-a-database-instance)
- [Update a user on a Database Instance](#update-a-user-on-a-database-instance)
Expand Down Expand Up @@ -327,6 +328,28 @@ scw mongodb snapshot restore <snapshot-id ...> [arg=value ...]



### Update a Database Instance snapshot

Update the parameters of a snapshot of a Database Instance. You can update the `name` and `expires_at` parameters.

**Usage:**

```
scw mongodb snapshot update <snapshot-id ...> [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| snapshot-id | Required | UUID of the Snapshot |
| name | | Name of the snapshot |
| expires-at | | Expiration date of the snapshot (must follow the ISO 8601 format) |
| 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 |



## User management commands

Users are profiles to which you can attribute database-level permissions. They allow you to define permissions specific to each type of database usage.
Expand Down
45 changes: 45 additions & 0 deletions internal/namespaces/mongodb/v1alpha1/mongodb_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func GetGeneratedCommands() *core.Commands {
mongodbInstanceGetCertificate(),
mongodbSnapshotCreate(),
mongodbSnapshotGet(),
mongodbSnapshotUpdate(),
mongodbSnapshotRestore(),
mongodbSnapshotList(),
mongodbSnapshotDelete(),
Expand Down Expand Up @@ -582,6 +583,50 @@ func mongodbSnapshotGet() *core.Command {
}
}

func mongodbSnapshotUpdate() *core.Command {
return &core.Command{
Short: `Update a Database Instance snapshot`,
Long: `Update the parameters of a snapshot of a Database Instance. You can update the ` + "`" + `name` + "`" + ` and ` + "`" + `expires_at` + "`" + ` parameters.`,
Namespace: "mongodb",
Resource: "snapshot",
Verb: "update",
// Deprecated: false,
ArgsType: reflect.TypeOf(mongodb.UpdateSnapshotRequest{}),
ArgSpecs: core.ArgSpecs{
{
Name: "snapshot-id",
Short: `UUID of the Snapshot`,
Required: true,
Deprecated: false,
Positional: true,
},
{
Name: "name",
Short: `Name of the snapshot`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "expires-at",
Short: `Expiration date of the snapshot (must follow the ISO 8601 format)`,
Required: false,
Deprecated: false,
Positional: false,
},
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*mongodb.UpdateSnapshotRequest)

client := core.ExtractClient(ctx)
api := mongodb.NewAPI(client)
return api.UpdateSnapshot(request)

},
}
}

func mongodbSnapshotRestore() *core.Command {
return &core.Command{
Short: `Restore a Database Instance snapshot`,
Expand Down

0 comments on commit 415b658

Please sign in to comment.