Skip to content

Commit b3c7dff

Browse files
author
Yago Carlos Fernandez Gou
committed
Onboard Intake (1/3): introduce intake runner command
1 parent 6ab8220 commit b3c7dff

25 files changed

+2432
-0
lines changed

docs/stackit.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ stackit [flags]
3434
* [stackit dns](./stackit_dns.md) - Provides functionality for DNS
3535
* [stackit git](./stackit_git.md) - Provides functionality for STACKIT Git
3636
* [stackit image](./stackit_image.md) - Manage server images
37+
* [stackit intake](./stackit_intake.md) - Provides functionality for STACKIT Intake
3738
* [stackit key-pair](./stackit_key-pair.md) - Provides functionality for SSH key pairs
3839
* [stackit load-balancer](./stackit_load-balancer.md) - Provides functionality for Load Balancer
3940
* [stackit logme](./stackit_logme.md) - Provides functionality for LogMe

docs/stackit_intake.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## stackit intake
2+
3+
Provides functionality for STACKIT Intake
4+
5+
### Synopsis
6+
7+
Provides functionality for STACKIT Intake.
8+
9+
```
10+
stackit intake [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
17+
$ stackit intake
18+
```
19+
20+
### Options
21+
22+
```
23+
-h, --help Help for "stackit intake"
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](./stackit.md) - Manage STACKIT resources using the command line
40+
* [stackit intake runner](./stackit_intake_runner.md) - Provides functionality for Intake Runners
41+

docs/stackit_intake_runner.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## stackit intake runner
2+
3+
Provides functionality for Intake Runners
4+
5+
### Synopsis
6+
7+
Provides functionality for Intake Runners.
8+
9+
```
10+
stackit intake runner [flags]
11+
```
12+
13+
### Options
14+
15+
```
16+
-h, --help Help for "stackit intake runner"
17+
```
18+
19+
### Options inherited from parent commands
20+
21+
```
22+
-y, --assume-yes If set, skips all confirmation prompts
23+
--async If set, runs the command asynchronously
24+
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
25+
-p, --project-id string Project ID
26+
--region string Target region for region-specific requests
27+
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
28+
```
29+
30+
### SEE ALSO
31+
32+
* [stackit intake](./stackit_intake.md) - Provides functionality for STACKIT Intake
33+
* [stackit intake runner create](./stackit_intake_runner_create.md) - Creates a new Intake Runner
34+
* [stackit intake runner delete](./stackit_intake_runner_delete.md) - Deletes an Intake Runner
35+
* [stackit intake runner describe](./stackit_intake_runner_describe.md) - Shows details of an Intake Runner
36+
* [stackit intake runner list](./stackit_intake_runner_list.md) - Lists all Intake Runners
37+
* [stackit intake runner update](./stackit_intake_runner_update.md) - Updates an Intake Runner
38+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
## stackit intake runner create
2+
3+
Creates a new Intake Runner
4+
5+
### Synopsis
6+
7+
Creates a new Intake Runner.
8+
9+
```
10+
stackit intake runner create [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
Create a new Intake Runner with a display name and message capacity limits
17+
$ stackit intake runner create --display-name my-runner --max-message-size-kib 1000 --max-messages-per-hour 5000
18+
19+
Create a new Intake Runner with a description and labels
20+
$ stackit intake runner create --display-name my-runner --max-message-size-kib 1000 --max-messages-per-hour 5000 --description "Main runner for production" --labels="env=prod,team=billing"
21+
```
22+
23+
### Options
24+
25+
```
26+
--description string Description
27+
--display-name string Display name
28+
-h, --help Help for "stackit intake runner create"
29+
--labels stringToString Labels in key=value format, separated by commas. Example: --labels "key1=value1,key2=value2" (default [])
30+
--max-message-size-kib int Maximum message size in KiB
31+
--max-messages-per-hour int Maximum number of messages per hour
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 intake runner](./stackit_intake_runner.md) - Provides functionality for Intake Runners
48+
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
## stackit intake runner delete
2+
3+
Deletes an Intake Runner
4+
5+
### Synopsis
6+
7+
Deletes an Intake Runner.
8+
9+
```
10+
stackit intake runner delete RUNNER_ID [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
Delete an Intake Runner with ID "xxx"
17+
$ stackit intake runner delete xxx
18+
```
19+
20+
### Options
21+
22+
```
23+
-h, --help Help for "stackit intake runner 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 intake runner](./stackit_intake_runner.md) - Provides functionality for Intake Runners
40+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
## stackit intake runner describe
2+
3+
Shows details of an Intake Runner
4+
5+
### Synopsis
6+
7+
Shows details of an Intake Runner.
8+
9+
```
10+
stackit intake runner describe RUNNER_ID [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
Get details of an Intake Runner with ID "xxx"
17+
$ stackit intake runner describe xxx
18+
19+
Get details of an Intake Runner with ID "xxx" in JSON format
20+
$ stackit intake runner describe xxx --output-format json
21+
```
22+
23+
### Options
24+
25+
```
26+
-h, --help Help for "stackit intake runner describe"
27+
```
28+
29+
### Options inherited from parent commands
30+
31+
```
32+
-y, --assume-yes If set, skips all confirmation prompts
33+
--async If set, runs the command asynchronously
34+
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
35+
-p, --project-id string Project ID
36+
--region string Target region for region-specific requests
37+
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
38+
```
39+
40+
### SEE ALSO
41+
42+
* [stackit intake runner](./stackit_intake_runner.md) - Provides functionality for Intake Runners
43+

docs/stackit_intake_runner_list.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
## stackit intake runner list
2+
3+
Lists all Intake Runners
4+
5+
### Synopsis
6+
7+
Lists all Intake Runners for the current project.
8+
9+
```
10+
stackit intake runner list [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
List all Intake Runners
17+
$ stackit intake runner list
18+
19+
List all Intake Runners in JSON format
20+
$ stackit intake runner list --output-format json
21+
22+
List up to 5 Intake Runners
23+
$ stackit intake runner list --limit 5
24+
```
25+
26+
### Options
27+
28+
```
29+
-h, --help Help for "stackit intake runner list"
30+
--limit int Maximum number of entries to list
31+
```
32+
33+
### Options inherited from parent commands
34+
35+
```
36+
-y, --assume-yes If set, skips all confirmation prompts
37+
--async If set, runs the command asynchronously
38+
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
39+
-p, --project-id string Project ID
40+
--region string Target region for region-specific requests
41+
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
42+
```
43+
44+
### SEE ALSO
45+
46+
* [stackit intake runner](./stackit_intake_runner.md) - Provides functionality for Intake Runners
47+
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
## stackit intake runner update
2+
3+
Updates an Intake Runner
4+
5+
### Synopsis
6+
7+
Updates an Intake Runner. Only the specified fields are updated.
8+
9+
```
10+
stackit intake runner update RUNNER_ID [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
Update the display name of an Intake Runner with ID "xxx"
17+
$ stackit intake runner update xxx --display-name "new-runner-name"
18+
19+
Update the message capacity limits for an Intake Runner with ID "xxx"
20+
$ stackit intake runner update xxx --max-message-size-kib 2000 --max-messages-per-hour 10000
21+
22+
Clear the labels of an Intake Runner with ID "xxx" by providing an empty value
23+
$ stackit intake runner update xxx --labels ""
24+
```
25+
26+
### Options
27+
28+
```
29+
--description string Description
30+
--display-name string Display name
31+
-h, --help Help for "stackit intake runner update"
32+
--labels string Labels in key=value format. To clear all labels, provide an empty string, e.g. --labels ""
33+
--max-message-size-kib int Maximum message size in KiB. Note: Overall message capacity cannot be decreased.
34+
--max-messages-per-hour int Maximum number of messages per hour. Note: Overall message capacity cannot be decreased.
35+
```
36+
37+
### Options inherited from parent commands
38+
39+
```
40+
-y, --assume-yes If set, skips all confirmation prompts
41+
--async If set, runs the command asynchronously
42+
-o, --output-format string Output format, one of ["json" "pretty" "none" "yaml"]
43+
-p, --project-id string Project ID
44+
--region string Target region for region-specific requests
45+
--verbosity string Verbosity of the CLI, one of ["debug" "info" "warning" "error"] (default "info")
46+
```
47+
48+
### SEE ALSO
49+
50+
* [stackit intake runner](./stackit_intake_runner.md) - Provides functionality for Intake Runners
51+

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ require (
181181
github.com/sonatard/noctx v0.1.0 // indirect
182182
github.com/sourcegraph/go-diff v0.7.0 // indirect
183183
github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect
184+
github.com/stackitcloud/stackit-sdk-go/services/intake v0.1.0 // indirect
184185
github.com/stbenjam/no-sprintf-host-port v0.2.0 // indirect
185186
github.com/stretchr/objx v0.5.2 // indirect
186187
github.com/stretchr/testify v1.11.1 // indirect

internal/cmd/intake/common/util.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package common
2+
3+
import (
4+
"fmt"
5+
"strings"
6+
)
7+
8+
// ParseLabels parses the labels flag value into a map.
9+
// An empty string clears the labels, returning a pointer to an empty map.
10+
func ParseLabels(labelsVal string) (map[string]string, error) {
11+
if labelsVal == "" {
12+
// User wants to clear labels
13+
return map[string]string{}, nil
14+
}
15+
16+
// User provided labels, parse them
17+
parsedLabels := make(map[string]string)
18+
pairs := strings.Split(labelsVal, ",")
19+
for _, pair := range pairs {
20+
kv := strings.SplitN(pair, "=", 2)
21+
if len(kv) != 2 || kv[0] == "" {
22+
return nil, fmt.Errorf("invalid label format, expected key=value: %q", pair)
23+
}
24+
parsedLabels[kv[0]] = kv[1]
25+
}
26+
return parsedLabels, nil
27+
}

0 commit comments

Comments
 (0)