From 4be0afa48e5cbe06da1c029629e0f93784bd1c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diogo=20Ferr=C3=A3o?= Date: Wed, 22 May 2024 11:07:13 +0100 Subject: [PATCH 1/4] address acceptance comments --- .../cmd/mongodbflex/backup/restore/restore.go | 6 +++--- .../backup/update-schedule/update_schedule.go | 20 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/internal/cmd/mongodbflex/backup/restore/restore.go b/internal/cmd/mongodbflex/backup/restore/restore.go index c043e4292..d74611db3 100644 --- a/internal/cmd/mongodbflex/backup/restore/restore.go +++ b/internal/cmd/mongodbflex/backup/restore/restore.go @@ -39,8 +39,8 @@ func NewCmd(p *print.Printer) *cobra.Command { Use: "restore", Short: "Restores a MongoDB Flex instance from a backup", Long: fmt.Sprintf("%s\n%s\n%s", - "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.", + "Restores a MongoDB Flex instance from a backup of an instance or clones a MongoDB Flex instance from a point-in-time backup.", + "The backup can be specified by a backup ID or 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.", ), Args: args.NoArgs, @@ -141,7 +141,7 @@ func configureFlags(cmd *cobra.Command) { cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "Instance ID") cmd.Flags().Var(flags.UUIDFlag(), backupInstanceIdFlag, "Instance ID of the target instance to restore the backup to") cmd.Flags().String(backupIdFlag, "", "Backup ID") - 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") + 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") err := flags.MarkFlagsRequired(cmd, instanceIdFlag) cobra.CheckErr(err) diff --git a/internal/cmd/mongodbflex/backup/update-schedule/update_schedule.go b/internal/cmd/mongodbflex/backup/update-schedule/update_schedule.go index cf296ea92..97e04699f 100644 --- a/internal/cmd/mongodbflex/backup/update-schedule/update_schedule.go +++ b/internal/cmd/mongodbflex/backup/update-schedule/update_schedule.go @@ -21,10 +21,10 @@ import ( const ( instanceIdFlag = "instance-id" scheduleFlag = "schedule" - snapshotRetentionDaysFlag = "save-snapshot-days" - dailySnapshotRetentionDaysFlag = "save-daily-snapshot-days" - weeklySnapshotRetentionWeeksFlag = "save-weekly-snapshot-weeks" - monthlySnapshotRetentionMonthsFlag = "save-monthly-snapshot-months" + snapshotRetentionDaysFlag = "save-for-days" + dailySnapshotRetentionDaysFlag = "store-daily-backup-days" + weeklySnapshotRetentionWeeksFlag = "store-weekly-backup-weeks" + monthlySnapshotRetentionMonthsFlag = "save-monthly-backups-months" // Default values for the backup schedule options defaultBackupSchedule = "0 0/6 * * *" @@ -62,8 +62,8 @@ func NewCmd(p *print.Printer) *cobra.Command { `Update the backup schedule of a MongoDB Flex instance with ID "xxx"`, "$ stackit mongodbflex backup update-schedule --instance-id xxx --schedule '6 6 * * *'"), examples.NewExample( - `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"), + `Update the retention days for backup of a MongoDB Flex instance with ID "xxx" to 5 days`, + "$ stackit mongodbflex backup update-schedule --instance-id xxx --save-for-days 5"), ), RunE: func(cmd *cobra.Command, args []string) error { @@ -121,10 +121,10 @@ func NewCmd(p *print.Printer) *cobra.Command { func configureFlags(cmd *cobra.Command) { cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "Instance ID") cmd.Flags().String(scheduleFlag, "", "Backup schedule, in the cron scheduling system format e.g. '0 0 * * *'") - cmd.Flags().Int64(snapshotRetentionDaysFlag, 0, "Number of days to retain snapshots. Should be less than or equal to the value of the daily backup.") - 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.") - 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.") - cmd.Flags().Int64(monthlySnapshotRetentionMonthsFlag, 0, "Number of months to retain monthly snapshots") + cmd.Flags().Int64(snapshotRetentionDaysFlag, 0, "Number of days to retain backups. Should be less than or equal to the value of the daily backup.") + 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.") + 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.") + cmd.Flags().Int64(monthlySnapshotRetentionMonthsFlag, 0, "Number of months to retain monthly backups") err := flags.MarkFlagsRequired(cmd, instanceIdFlag) cobra.CheckErr(err) From d2a13061a519c313238660134f44451e284949d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diogo=20Ferr=C3=A3o?= Date: Wed, 22 May 2024 11:09:57 +0100 Subject: [PATCH 2/4] generate docs --- docs/stackit_mongodbflex_backup_restore.md | 6 +++--- docs/stackit_mongodbflex_backup_update-schedule.md | 12 ++++++------ .../backup/update-schedule/update_schedule.go | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/stackit_mongodbflex_backup_restore.md b/docs/stackit_mongodbflex_backup_restore.md index 87185a3e2..18dadd1a3 100644 --- a/docs/stackit_mongodbflex_backup_restore.md +++ b/docs/stackit_mongodbflex_backup_restore.md @@ -4,8 +4,8 @@ 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. +Restores a MongoDB Flex instance from a backup of an instance or clones a MongoDB Flex instance from a point-in-time backup. +The backup can be specified by a backup ID or 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. ``` @@ -32,7 +32,7 @@ stackit mongodbflex backup restore [flags] --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 + --timestamp string Timestamp to restore the instance to, in a date-time with the RFC3339 layout format, e.g. 2024-01-01T00:00:00Z ``` ### Options inherited from parent commands diff --git a/docs/stackit_mongodbflex_backup_update-schedule.md b/docs/stackit_mongodbflex_backup_update-schedule.md index ee51091cf..242875fc8 100644 --- a/docs/stackit_mongodbflex_backup_update-schedule.md +++ b/docs/stackit_mongodbflex_backup_update-schedule.md @@ -19,8 +19,8 @@ stackit mongodbflex backup update-schedule [flags] 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 + Update the retention days for backups of a MongoDB Flex instance with ID "xxx" to 5 days + $ stackit mongodbflex backup update-schedule --instance-id xxx --save-for-days 5 ``` ### Options @@ -28,11 +28,11 @@ stackit mongodbflex backup update-schedule [flags] ``` -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. + --save-for-days int Number of days to retain backups. Should be less than or equal to the value of the daily backup. --schedule string Backup schedule, in the cron scheduling system format e.g. '0 0 * * *' + --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. + --store-monthly-backups-months int Number of months to retain monthly backups + --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. ``` ### Options inherited from parent commands diff --git a/internal/cmd/mongodbflex/backup/update-schedule/update_schedule.go b/internal/cmd/mongodbflex/backup/update-schedule/update_schedule.go index 97e04699f..b24bb546b 100644 --- a/internal/cmd/mongodbflex/backup/update-schedule/update_schedule.go +++ b/internal/cmd/mongodbflex/backup/update-schedule/update_schedule.go @@ -24,7 +24,7 @@ const ( snapshotRetentionDaysFlag = "save-for-days" dailySnapshotRetentionDaysFlag = "store-daily-backup-days" weeklySnapshotRetentionWeeksFlag = "store-weekly-backup-weeks" - monthlySnapshotRetentionMonthsFlag = "save-monthly-backups-months" + monthlySnapshotRetentionMonthsFlag = "store-monthly-backups-months" // Default values for the backup schedule options defaultBackupSchedule = "0 0/6 * * *" @@ -62,7 +62,7 @@ func NewCmd(p *print.Printer) *cobra.Command { `Update the backup schedule of a MongoDB Flex instance with ID "xxx"`, "$ stackit mongodbflex backup update-schedule --instance-id xxx --schedule '6 6 * * *'"), examples.NewExample( - `Update the retention days for backup of a MongoDB Flex instance with ID "xxx" to 5 days`, + `Update the retention days for backups of a MongoDB Flex instance with ID "xxx" to 5 days`, "$ stackit mongodbflex backup update-schedule --instance-id xxx --save-for-days 5"), ), From 2bacdfe3b88eddb6c4fec676bc9b69de31c5b986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diogo=20Ferr=C3=A3o?= Date: Wed, 22 May 2024 11:15:21 +0100 Subject: [PATCH 3/4] make flags consistent --- .../cmd/mongodbflex/backup/update-schedule/update_schedule.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/cmd/mongodbflex/backup/update-schedule/update_schedule.go b/internal/cmd/mongodbflex/backup/update-schedule/update_schedule.go index b24bb546b..5b2f71bba 100644 --- a/internal/cmd/mongodbflex/backup/update-schedule/update_schedule.go +++ b/internal/cmd/mongodbflex/backup/update-schedule/update_schedule.go @@ -21,7 +21,7 @@ import ( const ( instanceIdFlag = "instance-id" scheduleFlag = "schedule" - snapshotRetentionDaysFlag = "save-for-days" + snapshotRetentionDaysFlag = "store-for-days" dailySnapshotRetentionDaysFlag = "store-daily-backup-days" weeklySnapshotRetentionWeeksFlag = "store-weekly-backup-weeks" monthlySnapshotRetentionMonthsFlag = "store-monthly-backups-months" @@ -63,7 +63,7 @@ func NewCmd(p *print.Printer) *cobra.Command { "$ stackit mongodbflex backup update-schedule --instance-id xxx --schedule '6 6 * * *'"), examples.NewExample( `Update the retention days for backups of a MongoDB Flex instance with ID "xxx" to 5 days`, - "$ stackit mongodbflex backup update-schedule --instance-id xxx --save-for-days 5"), + "$ stackit mongodbflex backup update-schedule --instance-id xxx --store-for-days 5"), ), RunE: func(cmd *cobra.Command, args []string) error { From 667e8bc0433006784cacb4024c4c88a34cd6ecdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diogo=20Ferr=C3=A3o?= Date: Wed, 22 May 2024 11:18:13 +0100 Subject: [PATCH 4/4] generate docs --- docs/stackit_mongodbflex_backup_update-schedule.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/stackit_mongodbflex_backup_update-schedule.md b/docs/stackit_mongodbflex_backup_update-schedule.md index 242875fc8..872f52835 100644 --- a/docs/stackit_mongodbflex_backup_update-schedule.md +++ b/docs/stackit_mongodbflex_backup_update-schedule.md @@ -20,7 +20,7 @@ stackit mongodbflex backup update-schedule [flags] $ stackit mongodbflex backup update-schedule --instance-id xxx --schedule '6 6 * * *' Update the retention days for backups of a MongoDB Flex instance with ID "xxx" to 5 days - $ stackit mongodbflex backup update-schedule --instance-id xxx --save-for-days 5 + $ stackit mongodbflex backup update-schedule --instance-id xxx --store-for-days 5 ``` ### Options @@ -28,9 +28,9 @@ stackit mongodbflex backup update-schedule [flags] ``` -h, --help Help for "stackit mongodbflex backup update-schedule" --instance-id string Instance ID - --save-for-days int Number of days to retain backups. Should be less than or equal to the value of the daily backup. --schedule string Backup schedule, in the cron scheduling system format e.g. '0 0 * * *' --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. + --store-for-days int Number of days to retain backups. Should be less than or equal to the value of the daily backup. --store-monthly-backups-months int Number of months to retain monthly backups --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. ```