Skip to content

Mongodb backup schedule, update-schedule, restore #316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/stackit_mongodbflex_backup.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,8 @@ stackit mongodbflex backup [flags]
* [stackit mongodbflex](./stackit_mongodbflex.md) - Provides functionality for MongoDB Flex
* [stackit mongodbflex backup describe](./stackit_mongodbflex_backup_describe.md) - Shows details of a backup for a MongoDB Flex instance
* [stackit mongodbflex backup list](./stackit_mongodbflex_backup_list.md) - Lists all backups which are available for a MongoDB Flex instance
* [stackit mongodbflex backup restore](./stackit_mongodbflex_backup_restore.md) - Restores a MongoDB Flex instance from a backup
* [stackit mongodbflex backup restore-jobs](./stackit_mongodbflex_backup_restore-jobs.md) - Lists all restore jobs which have been run for a MongoDB Flex instance
* [stackit mongodbflex backup schedule](./stackit_mongodbflex_backup_schedule.md) - Shows details of the backup schedule and retention policy of a MongoDB Flex instance
* [stackit mongodbflex backup update-schedule](./stackit_mongodbflex_backup_update-schedule.md) - Updates the backup schedule and retention policy for a MongoDB Flex instance

6 changes: 3 additions & 3 deletions docs/stackit_mongodbflex_backup_restore-jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ stackit mongodbflex backup restore-jobs [flags]

```
List all restore jobs of instance with ID "xxx"
$ stackit mongodbflex backup list --instance-id xxx
$ stackit mongodbflex backup restore-jobs --instance-id xxx

List all restore jobs of instance with ID "xxx" in JSON format
$ stackit mongodbflex backup list --instance-id xxx --output-format json
$ stackit mongodbflex backup restore-jobs --instance-id xxx --output-format json

List up to 10 restore jobs of instance with ID "xxx"
$ stackit mongodbflex backup list --instance-id xxx --limit 10
$ stackit mongodbflex backup restore-jobs --instance-id xxx --limit 10
```

### Options
Expand Down
51 changes: 51 additions & 0 deletions docs/stackit_mongodbflex_backup_restore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
## stackit mongodbflex backup restore

Restores a MongoDB Flex instance from a backup

### Synopsis

Restores a MongoDB Flex instance from a backup of an instance or clones a MongoDB Flex instance from a point-in-time snapshot.
The backup is specified by a backup ID and the point-in-time snapshot is specified by a timestamp.
You can specify the instance to which the backup will be applied. If not specified, the backup will be applied to the same instance from which it was taken.

```
stackit mongodbflex backup restore [flags]
```

### Examples

```
Restore a MongoDB Flex instance with ID "yyy" using backup with ID "zzz"
$ stackit mongodbflex backup restore --instance-id yyy --backup-id zzz

Clone a MongoDB Flex instance with ID "yyy" via point-in-time restore to timestamp "2024-05-14T14:31:48Z"
$ stackit mongodbflex backup restore --instance-id yyy --timestamp 2024-05-14T14:31:48Z

Restore a MongoDB Flex instance with ID "yyy", using backup from instance with ID "zzz" with backup ID "xxx"
$ stackit mongodbflex backup restore --instance-id zzz --backup-instance-id yyy --backup-id xxx
```

### Options

```
--backup-id string Backup ID
--backup-instance-id string Instance ID of the target instance to restore the backup to
-h, --help Help for "stackit mongodbflex backup restore"
--instance-id string Instance ID
--timestamp string Timestamp of the snapshot to use as a source for cloning the instance in a date-time with the RFC3339 layout format, e.g. 2024-01-01T00:00:00Z
```

### Options inherited from parent commands

```
-y, --assume-yes If set, skips all confirmation prompts
--async If set, runs the command asynchronously
-o, --output-format string Output format, one of ["json" "pretty" "none"]
-p, --project-id string Project ID
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
```

### SEE ALSO

* [stackit mongodbflex backup](./stackit_mongodbflex_backup.md) - Provides functionality for MongoDB Flex instance backups

43 changes: 43 additions & 0 deletions docs/stackit_mongodbflex_backup_schedule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## stackit mongodbflex backup schedule

Shows details of the backup schedule and retention policy of a MongoDB Flex instance

### Synopsis

Shows details of the backup schedule and retention policy of a MongoDB Flex instance.

```
stackit mongodbflex backup schedule [flags]
```

### Examples

```
Get details of the backup schedule of a MongoDB Flex instance with ID "xxx"
$ stackit mongodbflex backup schedule --instance-id xxx

Get details of the backup schedule of a MongoDB Flex instance with ID "xxx" in JSON format
$ stackit mongodbflex backup schedule --instance-id xxx --output-format json
```

### Options

```
-h, --help Help for "stackit mongodbflex backup schedule"
--instance-id string Instance ID
```

### Options inherited from parent commands

```
-y, --assume-yes If set, skips all confirmation prompts
--async If set, runs the command asynchronously
-o, --output-format string Output format, one of ["json" "pretty" "none"]
-p, --project-id string Project ID
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
```

### SEE ALSO

* [stackit mongodbflex backup](./stackit_mongodbflex_backup.md) - Provides functionality for MongoDB Flex instance backups

51 changes: 51 additions & 0 deletions docs/stackit_mongodbflex_backup_update-schedule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
## stackit mongodbflex backup update-schedule

Updates the backup schedule and retention policy for a MongoDB Flex instance

### Synopsis

Updates the backup schedule and retention policy for a MongoDB Flex instance.
The current backup schedule and retention policy can be seen in the output of the "stackit mongodbflex backup schedule" command.
The backup schedule is defined in the cron scheduling system format e.g. '0 0 * * *'.
See below for more detail on the retention policy options.

```
stackit mongodbflex backup update-schedule [flags]
```

### Examples

```
Update the backup schedule of a MongoDB Flex instance with ID "xxx"
$ stackit mongodbflex backup update-schedule --instance-id xxx --schedule '6 6 * * *'

Update the retention days for snapshots of a MongoDB Flex instance with ID "xxx" to 5 days
$ stackit mongodbflex backup update-schedule --instance-id xxx --save-snapshot-days 5
```

### Options

```
-h, --help Help for "stackit mongodbflex backup update-schedule"
--instance-id string Instance ID
--save-daily-snapshot-days int Number of days to retain daily snapshots. Should be less than or equal to the number of days of the selected weekly or monthly value.
--save-monthly-snapshot-months int Number of months to retain monthly snapshots
--save-snapshot-days int Number of days to retain snapshots. Should be less than or equal to the value of the daily backup.
--save-weekly-snapshot-weeks int Number of weeks to retain weekly snapshots. Should be less than or equal to the number of weeks of the selected monthly value.
--schedule string Backup schedule, in the cron scheduling system format e.g. '0 0 * * *'
```

### Options inherited from parent commands

```
-y, --assume-yes If set, skips all confirmation prompts
--async If set, runs the command asynchronously
-o, --output-format string Output format, one of ["json" "pretty" "none"]
-p, --project-id string Project ID
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
```

### SEE ALSO

* [stackit mongodbflex backup](./stackit_mongodbflex_backup.md) - Provides functionality for MongoDB Flex instance backups

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/stackitcloud/stackit-sdk-go/core v0.12.0
github.com/stackitcloud/stackit-sdk-go/services/authorization v0.2.0
github.com/stackitcloud/stackit-sdk-go/services/dns v0.9.1
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.12.0
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.13.0
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.14.0
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.13.0
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.8.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ github.com/stackitcloud/stackit-sdk-go/services/logme v0.14.0 h1:vvQFCN5sKZA9tdz
github.com/stackitcloud/stackit-sdk-go/services/logme v0.14.0/go.mod h1:bj9cn1treNSxKTRCEmESwqfENN8vCYn60HUnEA0P83c=
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.14.0 h1:tK6imWrbZ5TgQJbukWCUz7yDgcvvFMX8wamxkPTLuDo=
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.14.0/go.mod h1:kPetkX9hNm9HkRyiKQL/tlgdi8frZdMP8afg0mEvQ9s=
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.12.0 h1:/m6N/CdsFxomexsowU7PwT1S4UTmI39PnEvvWGsDh1s=
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.12.0/go.mod h1:iFerEzGmkg6R13ldFUyHUWHm0ac9cS4ftTDLhP0k/dU=
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.13.0 h1:Dhanx9aV5VRfpHg22Li07661FbRT5FR9/M6FowN08a8=
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.13.0/go.mod h1:iFerEzGmkg6R13ldFUyHUWHm0ac9cS4ftTDLhP0k/dU=
github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.9.0 h1:rWgy4/eCIgyA2dUuc4a30pldmS6taQDwiLqoeZmyeP8=
github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.9.0/go.mod h1:dkVMJI88eJ3Xs0ZV15r4tUpgitUGJXcvrX3RL4Zq2bQ=
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.14.0 h1:zkhm0r0OZ5NbHJFrm+7B+h11QL0bNLC53nzXhqCaLWo=
Expand Down
6 changes: 6 additions & 0 deletions internal/cmd/mongodbflex/backup/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ package backup
import (
"github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/describe"
"github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/list"
"github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/restore"
restorejobs "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/restore-jobs"
"github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/schedule"
updateschedule "github.com/stackitcloud/stackit-cli/internal/cmd/mongodbflex/backup/update-schedule"
"github.com/stackitcloud/stackit-cli/internal/pkg/args"
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
Expand All @@ -24,6 +27,9 @@ func NewCmd(p *print.Printer) *cobra.Command {
}

func addSubcommands(cmd *cobra.Command, p *print.Printer) {
cmd.AddCommand(updateschedule.NewCmd(p))
cmd.AddCommand(schedule.NewCmd(p))
cmd.AddCommand(restore.NewCmd(p))
cmd.AddCommand(list.NewCmd(p))
cmd.AddCommand(describe.NewCmd(p))
cmd.AddCommand(restorejobs.NewCmd(p))
Expand Down
Loading