Skip to content

Commit c794352

Browse files
authored
Improve help and flags for MongoDB backups (#337)
* address acceptance comments * generate docs * make flags consistent * generate docs
1 parent 2d0a4b7 commit c794352

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

docs/stackit_mongodbflex_backup_restore.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Restores a MongoDB Flex instance from a backup
44

55
### Synopsis
66

7-
Restores a MongoDB Flex instance from a backup of an instance or clones a MongoDB Flex instance from a point-in-time snapshot.
8-
The backup is specified by a backup ID and the point-in-time snapshot is specified by a timestamp.
7+
Restores a MongoDB Flex instance from a backup of an instance or clones a MongoDB Flex instance from a point-in-time backup.
8+
The backup can be specified by a backup ID or a timestamp.
99
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.
1010

1111
```
@@ -32,7 +32,7 @@ stackit mongodbflex backup restore [flags]
3232
--backup-instance-id string Instance ID of the target instance to restore the backup to
3333
-h, --help Help for "stackit mongodbflex backup restore"
3434
--instance-id string Instance ID
35-
--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
35+
--timestamp string Timestamp to restore the instance to, in a date-time with the RFC3339 layout format, e.g. 2024-01-01T00:00:00Z
3636
```
3737

3838
### Options inherited from parent commands

docs/stackit_mongodbflex_backup_update-schedule.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ stackit mongodbflex backup update-schedule [flags]
1919
Update the backup schedule of a MongoDB Flex instance with ID "xxx"
2020
$ stackit mongodbflex backup update-schedule --instance-id xxx --schedule '6 6 * * *'
2121
22-
Update the retention days for snapshots of a MongoDB Flex instance with ID "xxx" to 5 days
23-
$ stackit mongodbflex backup update-schedule --instance-id xxx --save-snapshot-days 5
22+
Update the retention days for backups of a MongoDB Flex instance with ID "xxx" to 5 days
23+
$ stackit mongodbflex backup update-schedule --instance-id xxx --store-for-days 5
2424
```
2525

2626
### Options
2727

2828
```
2929
-h, --help Help for "stackit mongodbflex backup update-schedule"
3030
--instance-id string Instance ID
31-
--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.
32-
--save-monthly-snapshot-months int Number of months to retain monthly snapshots
33-
--save-snapshot-days int Number of days to retain snapshots. Should be less than or equal to the value of the daily backup.
34-
--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.
3531
--schedule string Backup schedule, in the cron scheduling system format e.g. '0 0 * * *'
32+
--store-daily-backup-days int Number of days to retain daily backups. Should be less than or equal to the number of days of the selected weekly or monthly value.
33+
--store-for-days int Number of days to retain backups. Should be less than or equal to the value of the daily backup.
34+
--store-monthly-backups-months int Number of months to retain monthly backups
35+
--store-weekly-backup-weeks int Number of weeks to retain weekly backups. Should be less than or equal to the number of weeks of the selected monthly value.
3636
```
3737

3838
### Options inherited from parent commands

internal/cmd/mongodbflex/backup/restore/restore.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ func NewCmd(p *print.Printer) *cobra.Command {
3939
Use: "restore",
4040
Short: "Restores a MongoDB Flex instance from a backup",
4141
Long: fmt.Sprintf("%s\n%s\n%s",
42-
"Restores a MongoDB Flex instance from a backup of an instance or clones a MongoDB Flex instance from a point-in-time snapshot.",
43-
"The backup is specified by a backup ID and the point-in-time snapshot is specified by a timestamp.",
42+
"Restores a MongoDB Flex instance from a backup of an instance or clones a MongoDB Flex instance from a point-in-time backup.",
43+
"The backup can be specified by a backup ID or a timestamp.",
4444
"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.",
4545
),
4646
Args: args.NoArgs,
@@ -141,7 +141,7 @@ func configureFlags(cmd *cobra.Command) {
141141
cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "Instance ID")
142142
cmd.Flags().Var(flags.UUIDFlag(), backupInstanceIdFlag, "Instance ID of the target instance to restore the backup to")
143143
cmd.Flags().String(backupIdFlag, "", "Backup ID")
144-
cmd.Flags().String(timestampFlag, "", "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")
144+
cmd.Flags().String(timestampFlag, "", "Timestamp to restore the instance to, in a date-time with the RFC3339 layout format, e.g. 2024-01-01T00:00:00Z")
145145

146146
err := flags.MarkFlagsRequired(cmd, instanceIdFlag)
147147
cobra.CheckErr(err)

internal/cmd/mongodbflex/backup/update-schedule/update_schedule.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ import (
2121
const (
2222
instanceIdFlag = "instance-id"
2323
scheduleFlag = "schedule"
24-
snapshotRetentionDaysFlag = "save-snapshot-days"
25-
dailySnapshotRetentionDaysFlag = "save-daily-snapshot-days"
26-
weeklySnapshotRetentionWeeksFlag = "save-weekly-snapshot-weeks"
27-
monthlySnapshotRetentionMonthsFlag = "save-monthly-snapshot-months"
24+
snapshotRetentionDaysFlag = "store-for-days"
25+
dailySnapshotRetentionDaysFlag = "store-daily-backup-days"
26+
weeklySnapshotRetentionWeeksFlag = "store-weekly-backup-weeks"
27+
monthlySnapshotRetentionMonthsFlag = "store-monthly-backups-months"
2828

2929
// Default values for the backup schedule options
3030
defaultBackupSchedule = "0 0/6 * * *"
@@ -62,8 +62,8 @@ func NewCmd(p *print.Printer) *cobra.Command {
6262
`Update the backup schedule of a MongoDB Flex instance with ID "xxx"`,
6363
"$ stackit mongodbflex backup update-schedule --instance-id xxx --schedule '6 6 * * *'"),
6464
examples.NewExample(
65-
`Update the retention days for snapshots of a MongoDB Flex instance with ID "xxx" to 5 days`,
66-
"$ stackit mongodbflex backup update-schedule --instance-id xxx --save-snapshot-days 5"),
65+
`Update the retention days for backups of a MongoDB Flex instance with ID "xxx" to 5 days`,
66+
"$ stackit mongodbflex backup update-schedule --instance-id xxx --store-for-days 5"),
6767
),
6868

6969
RunE: func(cmd *cobra.Command, args []string) error {
@@ -121,10 +121,10 @@ func NewCmd(p *print.Printer) *cobra.Command {
121121
func configureFlags(cmd *cobra.Command) {
122122
cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "Instance ID")
123123
cmd.Flags().String(scheduleFlag, "", "Backup schedule, in the cron scheduling system format e.g. '0 0 * * *'")
124-
cmd.Flags().Int64(snapshotRetentionDaysFlag, 0, "Number of days to retain snapshots. Should be less than or equal to the value of the daily backup.")
125-
cmd.Flags().Int64(dailySnapshotRetentionDaysFlag, 0, "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.")
126-
cmd.Flags().Int64(weeklySnapshotRetentionWeeksFlag, 0, "Number of weeks to retain weekly snapshots. Should be less than or equal to the number of weeks of the selected monthly value.")
127-
cmd.Flags().Int64(monthlySnapshotRetentionMonthsFlag, 0, "Number of months to retain monthly snapshots")
124+
cmd.Flags().Int64(snapshotRetentionDaysFlag, 0, "Number of days to retain backups. Should be less than or equal to the value of the daily backup.")
125+
cmd.Flags().Int64(dailySnapshotRetentionDaysFlag, 0, "Number of days to retain daily backups. Should be less than or equal to the number of days of the selected weekly or monthly value.")
126+
cmd.Flags().Int64(weeklySnapshotRetentionWeeksFlag, 0, "Number of weeks to retain weekly backups. Should be less than or equal to the number of weeks of the selected monthly value.")
127+
cmd.Flags().Int64(monthlySnapshotRetentionMonthsFlag, 0, "Number of months to retain monthly backups")
128128

129129
err := flags.MarkFlagsRequired(cmd, instanceIdFlag)
130130
cobra.CheckErr(err)

0 commit comments

Comments
 (0)