Skip to content
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

Onboard PostgreSQL Flex instance clone command #150

Merged
merged 15 commits into from
Mar 19, 2024
Merged
1 change: 1 addition & 0 deletions docs/stackit_postgresflex.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ stackit postgresflex [flags]
### SEE ALSO

* [stackit](./stackit.md) - Manage STACKIT resources using the command line
* [stackit postgresflex backups](./stackit_postgresflex_backups.md) - Provides functionality for PostgreSQL Flex instance backups
* [stackit postgresflex instance](./stackit_postgresflex_instance.md) - Provides functionality for PostgreSQL Flex instances
* [stackit postgresflex options](./stackit_postgresflex_options.md) - Lists PostgreSQL Flex options
* [stackit postgresflex user](./stackit_postgresflex_user.md) - Provides functionality for PostgreSQL Flex users
Expand Down
34 changes: 34 additions & 0 deletions docs/stackit_postgresflex_backups.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## stackit postgresflex backups

Provides functionality for PostgreSQL Flex instance backups

### Synopsis

Provides functionality for PostgreSQL Flex instance backups.

```
stackit postgresflex backups [flags]
```

### Options

```
-h, --help Help for "stackit postgresflex backups"
```

### 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"]
-p, --project-id string Project ID
```

### SEE ALSO

* [stackit postgresflex](./stackit_postgresflex.md) - Provides functionality for PostgreSQL Flex
* [stackit postgresflex backups describe](./stackit_postgresflex_backups_describe.md) - Shows details of a backup for a specific PostgreSQL Flex instance
* [stackit postgresflex backups list](./stackit_postgresflex_backups_list.md) - Lists all backups which are available for a specific PostgreSQL Flex instance
* [stackit postgresflex backups update-schedule](./stackit_postgresflex_backups_update-schedule.md) - Updates backup schedule for a specific PostgreSQL Flex instance

42 changes: 42 additions & 0 deletions docs/stackit_postgresflex_backups_describe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
## stackit postgresflex backups describe

Shows details of a backup for a specific PostgreSQL Flex instance

### Synopsis

Shows details of a backup for a specific PostgreSQL Flex instance.

```
stackit postgresflex backups describe BACKUP_ID [flags]
```

### Examples

```
Get details of a backup with ID "xxx" for a PostgreSQL Flex instance with ID "yyy"
$ stackit postgresflex backups describe xxx --instance-id yyy

Get details of a backup with ID "xxx" for a PostgreSQL Flex instance with ID "yyy" in a table format
$ stackit postgresflex backups describe xxx --instance-id yyy --output-format pretty
```

### Options

```
-h, --help Help for "stackit postgresflex backups describe"
--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"]
-p, --project-id string Project ID
```

### SEE ALSO

* [stackit postgresflex backups](./stackit_postgresflex_backups.md) - Provides functionality for PostgreSQL Flex instance backups

45 changes: 45 additions & 0 deletions docs/stackit_postgresflex_backups_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
## stackit postgresflex backups list

Lists all backups which are available for a specific PostgreSQL Flex instance

### Synopsis

Lists all backups which are available for a specific PostgreSQL Flex instance.

```
stackit postgresflex backups list [flags]
```

### Examples

```
List all backups of instance with ID "xxx"
$ stackit postgresflex backups list xxx

List all backups of instance with ID "xxx" in JSON format
$ stackit postgresflex backups list xxx --output-format json

List up to 10 backups of instance with ID "xxx"
$ stackit postgresflex backups list xxx --limit 10
```

### Options

```
-h, --help Help for "stackit postgresflex backups list"
--limit int Maximum number of entries to list
```

### 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"]
-p, --project-id string Project ID
```

### SEE ALSO

* [stackit postgresflex backups](./stackit_postgresflex_backups.md) - Provides functionality for PostgreSQL Flex instance backups

39 changes: 39 additions & 0 deletions docs/stackit_postgresflex_backups_update-schedule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## stackit postgresflex backups update-schedule

Updates backup schedule for a specific PostgreSQL Flex instance

### Synopsis

Updates backup schedule for a specific PostgreSQL Flex instance.

```
stackit postgresflex backups update-schedule INSTANCE_ID [flags]
```

### Examples

```
Update the backup schedule of a PostgreSQL Flex instance with ID "xxx"
$ stackit postgresflex backups update-schedule xxx --backup-schedule '6 6 * * *'
```

### Options

```
--backup-schedule string Backup schedule
-h, --help Help for "stackit postgresflex backups update-schedule"
```

### 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"]
-p, --project-id string Project ID
```

### SEE ALSO

* [stackit postgresflex backups](./stackit_postgresflex_backups.md) - Provides functionality for PostgreSQL Flex instance backups

1 change: 1 addition & 0 deletions docs/stackit_postgresflex_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ stackit postgresflex instance [flags]
### SEE ALSO

* [stackit postgresflex](./stackit_postgresflex.md) - Provides functionality for PostgreSQL Flex
* [stackit postgresflex instance clone](./stackit_postgresflex_instance_clone.md) - Clones a PostgreSQL Flex instance
* [stackit postgresflex instance create](./stackit_postgresflex_instance_create.md) - Creates a PostgreSQL Flex instance
* [stackit postgresflex instance delete](./stackit_postgresflex_instance_delete.md) - Deletes a PostgreSQL Flex instance
* [stackit postgresflex instance describe](./stackit_postgresflex_instance_describe.md) - Shows details of a PostgreSQL Flex instance
Expand Down
47 changes: 47 additions & 0 deletions docs/stackit_postgresflex_instance_clone.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
## stackit postgresflex instance clone

Clones a PostgreSQL Flex instance

### Synopsis

Clones a PostgreSQL Flex instance from a selected point in time.

```
stackit postgresflex instance clone INSTANCE_ID [flags]
```

### Examples

```
Clone a PostgreSQL Flex instance with ID "xxx" . The recovery timestamp should be specified in UTC time following the format provided in the example.
$ stackit postgresflex instance clone xxx --recovery-timestamp 2023-04-17T09:28:00+00:00

Clone a PostgreSQL Flex instance with ID "xxx" from a selected recovery timestamp and specify storage class. If not specified, storage class from the existing instance will be used.
$ stackit postgresflex instance clone xxx --recovery-timestamp 2023-04-17T09:28:00+00:00 --storage-class premium-perf6-stackit

Clone a PostgreSQL Flex instance with ID "xxx" from a selected recovery timestamp and specify storage size. If not specified, storage size from the existing instance will be used.
$ stackit postgresflex instance clone xxx --recovery-timestamp 2023-04-17T09:28:00+00:00 --storage-size 10
```

### Options

```
-h, --help Help for "stackit postgresflex instance clone"
--recovery-timestamp string Recovery timestamp for the instance, in a date-time with the layout format, e.g. 2024-03-12T09:28:00+00:00
--storage-class string Storage class
--storage-size int Storage size (in GB)
```

### 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"]
-p, --project-id string Project ID
```

### SEE ALSO

* [stackit postgresflex instance](./stackit_postgresflex_instance.md) - Provides functionality for PostgreSQL Flex instances

1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/stackitcloud/stackit-cli
go 1.21

require (
github.com/depp/bytesize v1.1.0
GokceGK marked this conversation as resolved.
Show resolved Hide resolved
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/google/go-cmp v0.6.0
github.com/google/uuid v1.6.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/depp/bytesize v1.1.0 h1:HUJEFG8nW/vrfflMw0TB/5ZrwSuGAw3xrgyzKqzVLf4=
github.com/depp/bytesize v1.1.0/go.mod h1:W5nYZIYKjq8tqfzkVVwMblQwIRI4KcZGJz4DbNT9wwY=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
Expand Down
29 changes: 29 additions & 0 deletions internal/cmd/postgresflex/backups/backups.go
GokceGK marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package backups

import (
"github.com/stackitcloud/stackit-cli/internal/cmd/postgresflex/backups/describe"
"github.com/stackitcloud/stackit-cli/internal/cmd/postgresflex/backups/list"
updateschedule "github.com/stackitcloud/stackit-cli/internal/cmd/postgresflex/backups/update-schedule"
"github.com/stackitcloud/stackit-cli/internal/pkg/args"
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"

"github.com/spf13/cobra"
)

func NewCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "backups",
Short: "Provides functionality for PostgreSQL Flex instance backups",
Long: "Provides functionality for PostgreSQL Flex instance backups.",
Args: args.NoArgs,
Run: utils.CmdHelp,
}
addSubcommands(cmd)
return cmd
}

func addSubcommands(cmd *cobra.Command) {
cmd.AddCommand(list.NewCmd())
cmd.AddCommand(describe.NewCmd())
cmd.AddCommand(updateschedule.NewCmd())
}
Loading