Skip to content

feat(cli): onboard iaas volume backup api #773

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

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b556241
add volume backup create
Benjosh95 May 20, 2025
ab287eb
wip
Benjosh95 May 23, 2025
544c357
add volume backup create tests
Benjosh95 May 26, 2025
2de3fa6
wip list
Benjosh95 May 27, 2025
a0f7113
add volume backup update and update tests
Benjosh95 Jun 1, 2025
0c54c96
add volume backup delete and delete tests
Benjosh95 Jun 1, 2025
d0f029d
add volume backup describe and describe tests
Benjosh95 Jun 1, 2025
afcf18c
add volume backup restore and restore tests
Benjosh95 Jun 1, 2025
e0e5ddd
generate docs for volume backup api
Benjosh95 Jun 1, 2025
e5842a9
Merge remote-tracking branch 'origin/main' into feat/onboard-iaas-bac…
Benjosh95 Jun 1, 2025
5b086cc
volume backup create sourcelabel fix
Benjosh95 Jun 1, 2025
cdbc224
fix according to review request
Benjosh95 Jun 2, 2025
088d62b
fix linting errors
Benjosh95 Jun 2, 2025
b868824
add required backup payload
Benjosh95 Jun 5, 2025
2cd6589
fix describe visual presentation
Benjosh95 Jun 5, 2025
8fcd900
fix list visual presentation
Benjosh95 Jun 5, 2025
1f3f7d5
add newest version of iaas service
Benjosh95 Jun 5, 2025
fc41358
Merge branch 'main' into feat/onboard-iaas-backup-api
Benjosh95 Jun 5, 2025
6a14a9a
fix backup create test
Benjosh95 Jun 5, 2025
ad6b8cb
add testcase for an empty backup slice
Benjosh95 Jun 10, 2025
bb135bc
add create backup is nil testcaste
Benjosh95 Jun 10, 2025
979810f
add handle for possible nil pointer
Benjosh95 Jun 10, 2025
7e4bc66
refactor loop
Benjosh95 Jun 10, 2025
7dd1055
refactor branching
Benjosh95 Jun 10, 2025
b3a7c1b
refactor reduce variable
Benjosh95 Jun 10, 2025
15dcd74
refactor examples
Benjosh95 Jun 10, 2025
d2f0798
changed labels format
Benjosh95 Jun 10, 2025
daf11f1
update examples
Benjosh95 Jun 10, 2025
101122b
update backup examples
Benjosh95 Jun 10, 2025
e0591af
update docs
Benjosh95 Jun 10, 2025
9d18c53
refactor configuration of flagOptions
Benjosh95 Jun 10, 2025
960c2c2
refactor create backup test vars
Benjosh95 Jun 11, 2025
cfa1b8e
Merge branch 'main' into feat/onboard-iaas-backup-api
Benjosh95 Jun 11, 2025
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
1 change: 1 addition & 0 deletions docs/stackit_volume.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ stackit volume [flags]
### SEE ALSO

* [stackit](./stackit.md) - Manage STACKIT resources using the command line
* [stackit volume backup](./stackit_volume_backup.md) - Provides functionality for volume backups
* [stackit volume create](./stackit_volume_create.md) - Creates a volume
* [stackit volume delete](./stackit_volume_delete.md) - Deletes a volume
* [stackit volume describe](./stackit_volume_describe.md) - Shows details of a volume
Expand Down
39 changes: 39 additions & 0 deletions docs/stackit_volume_backup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## stackit volume backup

Provides functionality for volume backups

### Synopsis

Provides functionality for volume backups.

```
stackit volume backup [flags]
```

### Options

```
-h, --help Help for "stackit volume backup"
```

### 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" "yaml"]
-p, --project-id string Project ID
--region string Target region for region-specific requests
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
```

### SEE ALSO

* [stackit volume](./stackit_volume.md) - Provides functionality for volumes
* [stackit volume backup create](./stackit_volume_backup_create.md) - Creates a backup from a specific source
* [stackit volume backup delete](./stackit_volume_backup_delete.md) - Deletes a backup
* [stackit volume backup describe](./stackit_volume_backup_describe.md) - Describes a backup
* [stackit volume backup list](./stackit_volume_backup_list.md) - Lists all backups
* [stackit volume backup restore](./stackit_volume_backup_restore.md) - Restores a backup
* [stackit volume backup update](./stackit_volume_backup_update.md) - Updates a backup

50 changes: 50 additions & 0 deletions docs/stackit_volume_backup_create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
## stackit volume backup create

Creates a backup from a specific source

### Synopsis

Creates a backup from a specific source (volume or snapshot).

```
stackit volume backup create [flags]
```

### Examples

```
Create a backup from a volume
$ stackit volume backup create --source-id xxx --source-type volume

Create a backup from a snapshot with a name
$ stackit volume backup create --source-id xxx --source-type snapshot --name my-backup

Create a backup with labels
$ stackit volume backup create --source-id xxx --source-type volume --labels key1=value1,key2=value2
```

### Options

```
-h, --help Help for "stackit volume backup create"
--labels stringToString Key-value string pairs as labels (default [])
--name string Name of the backup
--source-id string ID of the source from which a backup should be created
--source-type string Source type of the backup (volume or snapshot)
```

### 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" "yaml"]
-p, --project-id string Project ID
--region string Target region for region-specific requests
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
```

### SEE ALSO

* [stackit volume backup](./stackit_volume_backup.md) - Provides functionality for volume backups

40 changes: 40 additions & 0 deletions docs/stackit_volume_backup_delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## stackit volume backup delete

Deletes a backup

### Synopsis

Deletes a backup by its ID.

```
stackit volume backup delete BACKUP_ID [flags]
```

### Examples

```
Delete a backup with ID "xxx"
$ stackit volume backup delete xxx
```

### Options

```
-h, --help Help for "stackit volume backup delete"
```

### 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" "yaml"]
-p, --project-id string Project ID
--region string Target region for region-specific requests
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
```

### SEE ALSO

* [stackit volume backup](./stackit_volume_backup.md) - Provides functionality for volume backups

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

Describes a backup

### Synopsis

Describes a backup by its ID.

```
stackit volume backup describe BACKUP_ID [flags]
```

### Examples

```
Get details of a backup with ID "xxx"
$ stackit volume backup describe xxx

Get details of a backup with ID "xxx" in JSON format
$ stackit volume backup describe xxx --output-format json
```

### Options

```
-h, --help Help for "stackit volume backup describe"
```

### 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" "yaml"]
-p, --project-id string Project ID
--region string Target region for region-specific requests
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
```

### SEE ALSO

* [stackit volume backup](./stackit_volume_backup.md) - Provides functionality for volume backups

51 changes: 51 additions & 0 deletions docs/stackit_volume_backup_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
## stackit volume backup list

Lists all backups

### Synopsis

Lists all backups in a project.

```
stackit volume backup list [flags]
```

### Examples

```
List all backups
$ stackit volume backup list

List all backups in JSON format
$ stackit volume backup list --output-format json

List up to 10 backups
$ stackit volume backup list --limit 10

List backups with specific labels
$ stackit volume backup list --label-selector key1=value1,key2=value2
```

### Options

```
-h, --help Help for "stackit volume backup list"
--label-selector string Filter backups by labels
--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" "none" "yaml"]
-p, --project-id string Project ID
--region string Target region for region-specific requests
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
```

### SEE ALSO

* [stackit volume backup](./stackit_volume_backup.md) - Provides functionality for volume backups

40 changes: 40 additions & 0 deletions docs/stackit_volume_backup_restore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## stackit volume backup restore

Restores a backup

### Synopsis

Restores a backup by its ID.

```
stackit volume backup restore BACKUP_ID [flags]
```

### Examples

```
Restore a backup with ID "xxx"
$ stackit volume backup restore xxx
```

### Options

```
-h, --help Help for "stackit volume backup restore"
```

### 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" "yaml"]
-p, --project-id string Project ID
--region string Target region for region-specific requests
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
```

### SEE ALSO

* [stackit volume backup](./stackit_volume_backup.md) - Provides functionality for volume backups

45 changes: 45 additions & 0 deletions docs/stackit_volume_backup_update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
## stackit volume backup update

Updates a backup

### Synopsis

Updates a backup by its ID.

```
stackit volume backup update BACKUP_ID [flags]
```

### Examples

```
Update the name of a backup with ID "xxx"
$ stackit volume backup update xxx --name new-name

Update the labels of a backup with ID "xxx"
$ stackit volume backup update xxx --labels key1=value1,key2=value2
```

### Options

```
-h, --help Help for "stackit volume backup update"
--labels stringToString Key-value string pairs as labels (default [])
--name string Name of the backup
```

### 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" "yaml"]
-p, --project-id string Project ID
--region string Target region for region-specific requests
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
```

### SEE ALSO

* [stackit volume backup](./stackit_volume_backup.md) - Provides functionality for volume backups

36 changes: 36 additions & 0 deletions internal/cmd/volume/backup/backup.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package backup

import (
"github.com/stackitcloud/stackit-cli/internal/cmd/params"
"github.com/stackitcloud/stackit-cli/internal/cmd/volume/backup/create"
"github.com/stackitcloud/stackit-cli/internal/cmd/volume/backup/delete"
"github.com/stackitcloud/stackit-cli/internal/cmd/volume/backup/describe"
"github.com/stackitcloud/stackit-cli/internal/cmd/volume/backup/list"
"github.com/stackitcloud/stackit-cli/internal/cmd/volume/backup/restore"
"github.com/stackitcloud/stackit-cli/internal/cmd/volume/backup/update"
"github.com/stackitcloud/stackit-cli/internal/pkg/args"
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"

"github.com/spf13/cobra"
)

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

func addSubcommands(cmd *cobra.Command, params *params.CmdParams) {
cmd.AddCommand(create.NewCmd(params))
cmd.AddCommand(list.NewCmd(params))
cmd.AddCommand(update.NewCmd(params))
cmd.AddCommand(delete.NewCmd(params))
cmd.AddCommand(describe.NewCmd(params))
cmd.AddCommand(restore.NewCmd(params))
}
Loading
Loading