Skip to content

Commit 3af196e

Browse files
authored
feat(automation): onboard volume automation commands (#1629)
relates to STACKITCLI-347
1 parent 594df5c commit 3af196e

20 files changed

Lines changed: 2575 additions & 0 deletions

‎docs/stackit_beta_volume_automation.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ stackit beta volume automation [flags]
3030
### SEE ALSO
3131

3232
* [stackit beta volume](./stackit_beta_volume.md) - Provides functionality for Volume
33+
* [stackit beta volume automation create](./stackit_beta_volume_automation_create.md) - Creates a Volume Automation
34+
* [stackit beta volume automation delete](./stackit_beta_volume_automation_delete.md) - Deletes a Volume Automation
35+
* [stackit beta volume automation describe](./stackit_beta_volume_automation_describe.md) - Shows details of a Volume Automation
3336
* [stackit beta volume automation execution](./stackit_beta_volume_automation_execution.md) - Provides functionality for Volume Automation Execution
37+
* [stackit beta volume automation generate-payload](./stackit_beta_volume_automation_generate-payload.md) - Generates a payload to update volume automation
38+
* [stackit beta volume automation list](./stackit_beta_volume_automation_list.md) - List all Volume Automations
3439
* [stackit beta volume automation template](./stackit_beta_volume_automation_template.md) - Provides functionality for Volume Automation Templates
40+
* [stackit beta volume automation update](./stackit_beta_volume_automation_update.md) - Updates a Volume Automation
3541

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
## stackit beta volume automation create
2+
3+
Creates a Volume Automation
4+
5+
### Synopsis
6+
7+
Creates a Volume Automation.
8+
The input for the automation can be provided as a JSON string or a file path prefixed with "@".
9+
See https://docs.api.stackit.cloud/documentation/automation-service/version/v1#tag/Volume-Automations/operation/CreateVolumeAutomation for information regarding the payload structure.
10+
11+
12+
```
13+
stackit beta volume automation create [flags]
14+
```
15+
16+
### Examples
17+
18+
```
19+
Creates a Volume Automation with name "my-automation", template ID "xxx" and input from the file "./input-payload.json"
20+
$ stackit beta volume automation create --name my-automation --template-id xxx --input @./input-payload.json
21+
22+
Creates a Volume Automation with name "my-automation", description "CLI Example", template ID "xxx" and input from the file "./input-payload.json"
23+
$ stackit beta volume automation create --name my-automation --description "CLI Example" --template-id xxx --input @./input-payload.json
24+
25+
Creates a Volume Automation with name "my-automation", template ID "xxx", rrule schedule trigger "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR" and input from the file "./input-payload.json"
26+
$ stackit beta volume automation create --name my-automation --template-id xxx --trigger-schedule-rrule "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR" --input @./input-payload.json
27+
```
28+
29+
### Options
30+
31+
```
32+
--description string Description of the automation
33+
-h, --help Help for "stackit beta volume automation create"
34+
--input string Input for the automation (JSON). Can be a string or a file path, if prefixed with "@" (example: @./payload.json).
35+
--name string Name of the automation
36+
--template-id string Template ID which should be used for the automation
37+
--trigger-schedule-rrule string Trigger schedule (RRULE) for the automation
38+
```
39+
40+
### Options inherited from parent commands
41+
42+
```
43+
-y, --assume-yes If set, skips all confirmation prompts
44+
--async If set, runs the command asynchronously
45+
-o, --output-format string Output format, (one of: [json, pretty, none, yaml])
46+
-p, --project-id string Project ID
47+
--region string Target region for region-specific requests
48+
--verbosity string Verbosity of the CLI, (one of: [debug, info, warning, error]) (default "info")
49+
```
50+
51+
### SEE ALSO
52+
53+
* [stackit beta volume automation](./stackit_beta_volume_automation.md) - Provides functionality for Volume Automation
54+
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
## stackit beta volume automation delete
2+
3+
Deletes a Volume Automation
4+
5+
### Synopsis
6+
7+
Deletes a Volume Automation.
8+
9+
```
10+
stackit beta volume automation delete AUTOMATION_ID [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
Delete a Volume Automation with ID "xxx"
17+
$ stackit beta volume automation delete xxx
18+
```
19+
20+
### Options
21+
22+
```
23+
-h, --help Help for "stackit beta volume automation delete"
24+
```
25+
26+
### Options inherited from parent commands
27+
28+
```
29+
-y, --assume-yes If set, skips all confirmation prompts
30+
--async If set, runs the command asynchronously
31+
-o, --output-format string Output format, (one of: [json, pretty, none, yaml])
32+
-p, --project-id string Project ID
33+
--region string Target region for region-specific requests
34+
--verbosity string Verbosity of the CLI, (one of: [debug, info, warning, error]) (default "info")
35+
```
36+
37+
### SEE ALSO
38+
39+
* [stackit beta volume automation](./stackit_beta_volume_automation.md) - Provides functionality for Volume Automation
40+
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
## stackit beta volume automation describe
2+
3+
Shows details of a Volume Automation
4+
5+
### Synopsis
6+
7+
Shows details of a Volume Automation.
8+
9+
```
10+
stackit beta volume automation describe AUTOMATION_ID [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
Describe the Volume Automation with ID "xxx"
17+
$ stackit beta volume automation describe xxx
18+
```
19+
20+
### Options
21+
22+
```
23+
-h, --help Help for "stackit beta volume automation describe"
24+
```
25+
26+
### Options inherited from parent commands
27+
28+
```
29+
-y, --assume-yes If set, skips all confirmation prompts
30+
--async If set, runs the command asynchronously
31+
-o, --output-format string Output format, (one of: [json, pretty, none, yaml])
32+
-p, --project-id string Project ID
33+
--region string Target region for region-specific requests
34+
--verbosity string Verbosity of the CLI, (one of: [debug, info, warning, error]) (default "info")
35+
```
36+
37+
### SEE ALSO
38+
39+
* [stackit beta volume automation](./stackit_beta_volume_automation.md) - Provides functionality for Volume Automation
40+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
## stackit beta volume automation generate-payload
2+
3+
Generates a payload to update volume automation
4+
5+
### Synopsis
6+
7+
Generates a JSON payload with values to be used as --input for volume automation update.
8+
See https://docs.api.stackit.cloud/documentation/automation-service/version/v1#tag/Volume-Automations/operation/PartialUpdateVolumeAutomation for information regarding the input structure.
9+
10+
```
11+
stackit beta volume automation generate-payload [flags]
12+
```
13+
14+
### Examples
15+
16+
```
17+
Generate a payload with values of a volume automation, and adapt it with custom values to different configuration options.
18+
$ stackit beta volume automation generate-payload --automation-id XXX --file-path ./input-payload.json
19+
<Modify payload in file>
20+
$ stackit beta volume automation update xxx --input @./input-payload.json
21+
22+
Generate a payload with values of a volume automation, and preview it in the terminal.
23+
$ stackit beta volume automation generate-payload --automation-id XXX
24+
```
25+
26+
### Options
27+
28+
```
29+
--automation-id string Automation ID from which the input values should be used
30+
-f, --file-path string If set, writes the payload to the given file. If unset, writes the payload to the standard output
31+
-h, --help Help for "stackit beta volume automation generate-payload"
32+
```
33+
34+
### Options inherited from parent commands
35+
36+
```
37+
-y, --assume-yes If set, skips all confirmation prompts
38+
--async If set, runs the command asynchronously
39+
-o, --output-format string Output format, (one of: [json, pretty, none, yaml])
40+
-p, --project-id string Project ID
41+
--region string Target region for region-specific requests
42+
--verbosity string Verbosity of the CLI, (one of: [debug, info, warning, error]) (default "info")
43+
```
44+
45+
### SEE ALSO
46+
47+
* [stackit beta volume automation](./stackit_beta_volume_automation.md) - Provides functionality for Volume Automation
48+
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
## stackit beta volume automation list
2+
3+
List all Volume Automations
4+
5+
### Synopsis
6+
7+
List all Volume Automations.
8+
9+
```
10+
stackit beta volume automation list [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
List all Volume Automations
17+
$ stackit beta volume automation list
18+
19+
List up to 10 Volume Automations
20+
$ stackit beta volume automation list --limit 10
21+
```
22+
23+
### Options
24+
25+
```
26+
-h, --help Help for "stackit beta volume automation list"
27+
--limit int Maximum number of entries to list
28+
```
29+
30+
### Options inherited from parent commands
31+
32+
```
33+
-y, --assume-yes If set, skips all confirmation prompts
34+
--async If set, runs the command asynchronously
35+
-o, --output-format string Output format, (one of: [json, pretty, none, yaml])
36+
-p, --project-id string Project ID
37+
--region string Target region for region-specific requests
38+
--verbosity string Verbosity of the CLI, (one of: [debug, info, warning, error]) (default "info")
39+
```
40+
41+
### SEE ALSO
42+
43+
* [stackit beta volume automation](./stackit_beta_volume_automation.md) - Provides functionality for Volume Automation
44+
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
## stackit beta volume automation update
2+
3+
Updates a Volume Automation
4+
5+
### Synopsis
6+
7+
Updates a Volume Automation.
8+
The input for the automation can be provided as a JSON string or a file path prefixed with "@".
9+
Updates are always applied as a patch. Omitted fields in the JSON will be ignored and remain unchanged after the update. Fields can be removed by setting them explicitly to null.
10+
See https://docs.api.stackit.cloud/documentation/automation-service/version/v1#tag/Volume-Automations/operation/PartialUpdateVolumeAutomation for information regarding the payload structure.
11+
12+
13+
```
14+
stackit beta volume automation update AUTOMATION_ID [flags]
15+
```
16+
17+
### Examples
18+
19+
```
20+
Update volume automation with ID "xxx" with input from the file "./input-payload.json"
21+
$ stackit beta volume automation update xxx --input @./input-payload.json
22+
23+
Update volume automation with ID "xxx" with name "my-updated-automation"
24+
$ stackit beta volume automation update xxx --name "my-updated-automation"
25+
26+
Update volume automation with ID "xxx" with description "Updated automation from STACKIT CLI"
27+
$ stackit beta volume automation update xxx --description "Updated automation from STACKIT CLI"
28+
29+
Update volume automation with ID "xxx" with disabling trigger schedule rrule
30+
$ stackit beta volume automation update xxx --disable-trigger-schedule
31+
32+
Update volume automation with ID "xxx" with trigger schedule rrule "FREQ=WEEKLY;BYDAY=MO"
33+
$ stackit beta volume automation update xxx --trigger-schedule-rrule "FREQ=WEEKLY;BYDAY=MO"
34+
```
35+
36+
### Options
37+
38+
```
39+
--description string Description of the automation
40+
--disable-trigger-schedule If set, trigger schedule will be disabled
41+
-h, --help Help for "stackit beta volume automation update"
42+
--input string Input for the automation (JSON). Can be a string or a file path, if prefixed with "@" (example: @./payload.json).
43+
--name string Name of the automation
44+
--trigger-schedule-rrule string Trigger schedule (RRULE) for the automation
45+
```
46+
47+
### Options inherited from parent commands
48+
49+
```
50+
-y, --assume-yes If set, skips all confirmation prompts
51+
--async If set, runs the command asynchronously
52+
-o, --output-format string Output format, (one of: [json, pretty, none, yaml])
53+
-p, --project-id string Project ID
54+
--region string Target region for region-specific requests
55+
--verbosity string Verbosity of the CLI, (one of: [debug, info, warning, error]) (default "info")
56+
```
57+
58+
### SEE ALSO
59+
60+
* [stackit beta volume automation](./stackit_beta_volume_automation.md) - Provides functionality for Volume Automation
61+

‎internal/cmd/beta/volume/automation/automation.go‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@ package automation
33
import (
44
"github.com/spf13/cobra"
55

6+
"github.com/stackitcloud/stackit-cli/internal/cmd/beta/volume/automation/create"
7+
"github.com/stackitcloud/stackit-cli/internal/cmd/beta/volume/automation/delete"
8+
"github.com/stackitcloud/stackit-cli/internal/cmd/beta/volume/automation/describe"
69
"github.com/stackitcloud/stackit-cli/internal/cmd/beta/volume/automation/execution"
10+
generatepayload "github.com/stackitcloud/stackit-cli/internal/cmd/beta/volume/automation/generate-payload"
11+
"github.com/stackitcloud/stackit-cli/internal/cmd/beta/volume/automation/list"
712
"github.com/stackitcloud/stackit-cli/internal/cmd/beta/volume/automation/template"
13+
"github.com/stackitcloud/stackit-cli/internal/cmd/beta/volume/automation/update"
814
"github.com/stackitcloud/stackit-cli/internal/pkg/types"
915
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
1016
)
@@ -22,6 +28,12 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
2228
}
2329

2430
func addSubcommands(cmd *cobra.Command, params *types.CmdParams) {
31+
cmd.AddCommand(create.NewCmd(params))
32+
cmd.AddCommand(delete.NewCmd(params))
33+
cmd.AddCommand(describe.NewCmd(params))
2534
cmd.AddCommand(execution.NewCmd(params))
35+
cmd.AddCommand(generatepayload.NewCmd(params))
36+
cmd.AddCommand(list.NewCmd(params))
2637
cmd.AddCommand(template.NewCmd(params))
38+
cmd.AddCommand(update.NewCmd(params))
2739
}

0 commit comments

Comments
 (0)