Skip to content

Commit 67c9517

Browse files
feat(scf): onboard scf space command
Relates to STACKITCLI-483
1 parent d9e7518 commit 67c9517

29 files changed

Lines changed: 2486 additions & 57 deletions

‎docs/stackit_beta_scf.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ stackit beta scf [flags]
3232
* [stackit beta](./stackit_beta.md) - Contains beta STACKIT CLI commands
3333
* [stackit beta scf organization](./stackit_beta_scf_organization.md) - Provides functionality for STACKIT Cloud Foundry organizations
3434
* [stackit beta scf platform](./stackit_beta_scf_platform.md) - Provides functionality for STACKIT Cloud Foundry platforms
35+
* [stackit beta scf space](./stackit_beta_scf_space.md) - Provides functionality for STACKIT Cloud Foundry spaces
3536

‎docs/stackit_beta_scf_space.md‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## stackit beta scf space
2+
3+
Provides functionality for STACKIT Cloud Foundry spaces
4+
5+
### Synopsis
6+
7+
Provides functionality for STACKIT Cloud Foundry spaces.
8+
9+
```
10+
stackit beta scf space [flags]
11+
```
12+
13+
### Options
14+
15+
```
16+
-h, --help Help for "stackit beta scf space"
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 beta scf](./stackit_beta_scf.md) - Provides functionality for STACKIT Cloud Foundry
33+
* [stackit beta scf space create](./stackit_beta_scf_space_create.md) - Creates a STACKIT Cloud Foundry space
34+
* [stackit beta scf space delete](./stackit_beta_scf_space_delete.md) - Deletes a STACKIT Cloud Foundry space
35+
* [stackit beta scf space describe](./stackit_beta_scf_space_describe.md) - Shows details of a STACKIT Cloud Foundry space
36+
* [stackit beta scf space list](./stackit_beta_scf_space_list.md) - Lists all STACKIT Cloud Foundry spaces of an organization
37+
* [stackit beta scf space role](./stackit_beta_scf_space_role.md) - Manages roles of STACKIT Cloud Foundry spaces
38+
* [stackit beta scf space update](./stackit_beta_scf_space_update.md) - Updates a STACKIT Cloud Foundry space
39+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
## stackit beta scf space create
2+
3+
Creates a STACKIT Cloud Foundry space
4+
5+
### Synopsis
6+
7+
Creates a STACKIT Cloud Foundry space in an organization.
8+
9+
```
10+
stackit beta scf space create [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
Create a STACKIT Cloud Foundry space with name "my-space" in the organization with ID "xxx"
17+
$ stackit beta scf space create --organization-id xxx --name my-space
18+
```
19+
20+
### Options
21+
22+
```
23+
-h, --help Help for "stackit beta scf space create"
24+
--name string Name of the space
25+
--organization-id string The UUID of the organization
26+
```
27+
28+
### Options inherited from parent commands
29+
30+
```
31+
-y, --assume-yes If set, skips all confirmation prompts
32+
--async If set, runs the command asynchronously
33+
-o, --output-format string Output format, (one of: [json, pretty, none, yaml])
34+
-p, --project-id string Project ID
35+
--region string Target region for region-specific requests
36+
--verbosity string Verbosity of the CLI, (one of: [debug, info, warning, error]) (default "info")
37+
```
38+
39+
### SEE ALSO
40+
41+
* [stackit beta scf space](./stackit_beta_scf_space.md) - Provides functionality for STACKIT Cloud Foundry spaces
42+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## stackit beta scf space delete
2+
3+
Deletes a STACKIT Cloud Foundry space
4+
5+
### Synopsis
6+
7+
Deletes a STACKIT Cloud Foundry space.
8+
9+
```
10+
stackit beta scf space delete SPACE_ID [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
Delete the STACKIT Cloud Foundry space with ID "yyy" in the organization with ID "xxx"
17+
$ stackit beta scf space delete yyy --organization-id xxx
18+
```
19+
20+
### Options
21+
22+
```
23+
-h, --help Help for "stackit beta scf space delete"
24+
--organization-id string The UUID of the organization
25+
```
26+
27+
### Options inherited from parent commands
28+
29+
```
30+
-y, --assume-yes If set, skips all confirmation prompts
31+
--async If set, runs the command asynchronously
32+
-o, --output-format string Output format, (one of: [json, pretty, none, yaml])
33+
-p, --project-id string Project ID
34+
--region string Target region for region-specific requests
35+
--verbosity string Verbosity of the CLI, (one of: [debug, info, warning, error]) (default "info")
36+
```
37+
38+
### SEE ALSO
39+
40+
* [stackit beta scf space](./stackit_beta_scf_space.md) - Provides functionality for STACKIT Cloud Foundry spaces
41+
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
## stackit beta scf space describe
2+
3+
Shows details of a STACKIT Cloud Foundry space
4+
5+
### Synopsis
6+
7+
Shows details of a STACKIT Cloud Foundry space.
8+
9+
```
10+
stackit beta scf space describe SPACE_ID [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
Get details of the STACKIT Cloud Foundry space with ID "yyy" in the organization with ID "xxx"
17+
$ stackit beta scf space describe yyy --organization-id xxx
18+
19+
Get details of the STACKIT Cloud Foundry space with ID "yyy" in the organization with ID "xxx" in JSON format
20+
$ stackit beta scf space describe yyy --organization-id xxx --output-format json
21+
```
22+
23+
### Options
24+
25+
```
26+
-h, --help Help for "stackit beta scf space describe"
27+
--organization-id string The UUID of the organization
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 scf space](./stackit_beta_scf_space.md) - Provides functionality for STACKIT Cloud Foundry spaces
44+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
## stackit beta scf space list
2+
3+
Lists all STACKIT Cloud Foundry spaces of an organization
4+
5+
### Synopsis
6+
7+
Lists all STACKIT Cloud Foundry spaces of an organization. The number of fetched spaces is limited to 5000.
8+
9+
```
10+
stackit beta scf space list [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
List all STACKIT Cloud Foundry spaces of the organization with ID "xxx"
17+
$ stackit beta scf space list --organization-id xxx
18+
19+
List up to 10 STACKIT Cloud Foundry spaces of the organization with ID "xxx"
20+
$ stackit beta scf space list --organization-id xxx --limit 10
21+
```
22+
23+
### Options
24+
25+
```
26+
-h, --help Help for "stackit beta scf space list"
27+
--limit int Maximum number of entries to list
28+
--organization-id string The UUID of the organization
29+
```
30+
31+
### Options inherited from parent commands
32+
33+
```
34+
-y, --assume-yes If set, skips all confirmation prompts
35+
--async If set, runs the command asynchronously
36+
-o, --output-format string Output format, (one of: [json, pretty, none, yaml])
37+
-p, --project-id string Project ID
38+
--region string Target region for region-specific requests
39+
--verbosity string Verbosity of the CLI, (one of: [debug, info, warning, error]) (default "info")
40+
```
41+
42+
### SEE ALSO
43+
44+
* [stackit beta scf space](./stackit_beta_scf_space.md) - Provides functionality for STACKIT Cloud Foundry spaces
45+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## stackit beta scf space role
2+
3+
Manages roles of STACKIT Cloud Foundry spaces
4+
5+
### Synopsis
6+
7+
Manages roles of STACKIT Cloud Foundry spaces.
8+
9+
```
10+
stackit beta scf space role [flags]
11+
```
12+
13+
### Options
14+
15+
```
16+
-h, --help Help for "stackit beta scf space role"
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 beta scf space](./stackit_beta_scf_space.md) - Provides functionality for STACKIT Cloud Foundry spaces
33+
* [stackit beta scf space role set](./stackit_beta_scf_space_role_set.md) - Assigns a role to a user of a STACKIT Cloud Foundry space
34+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
## stackit beta scf space role set
2+
3+
Assigns a role to a user of a STACKIT Cloud Foundry space
4+
5+
### Synopsis
6+
7+
Assigns a role to a user of a STACKIT Cloud Foundry space. The user is identified either by its GUID or by its username.
8+
9+
```
10+
stackit beta scf space role set SPACE_ID [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
Assign the role "space_developer" to the user with GUID "zzz" in the STACKIT Cloud Foundry space with ID "yyy" of the organization with ID "xxx"
17+
$ stackit beta scf space role set yyy --organization-id xxx --role space_developer --user-guid zzz
18+
19+
Assign the role "space_auditor" to the user with username "jane.doe" in the STACKIT Cloud Foundry space with ID "yyy" of the organization with ID "xxx"
20+
$ stackit beta scf space role set yyy --organization-id xxx --role space_auditor --user-name jane.doe
21+
```
22+
23+
### Options
24+
25+
```
26+
-h, --help Help for "stackit beta scf space role set"
27+
--organization-id string The UUID of the organization
28+
--role string The role to assign to the user (one of: [space_auditor, space_developer, space_manager, space_supporter])
29+
--user-guid string The GUID of the user to assign the role to
30+
--user-name string The username of the user to assign the role to
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 beta scf space role](./stackit_beta_scf_space_role.md) - Manages roles of STACKIT Cloud Foundry spaces
47+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
## stackit beta scf space update
2+
3+
Updates a STACKIT Cloud Foundry space
4+
5+
### Synopsis
6+
7+
Updates a STACKIT Cloud Foundry space.
8+
9+
```
10+
stackit beta scf space update SPACE_ID [flags]
11+
```
12+
13+
### Examples
14+
15+
```
16+
Rename the STACKIT Cloud Foundry space with ID "yyy" in the organization with ID "xxx"
17+
$ stackit beta scf space update yyy --organization-id xxx --name new-name
18+
```
19+
20+
### Options
21+
22+
```
23+
-h, --help Help for "stackit beta scf space update"
24+
--name string New name of the space
25+
--organization-id string The UUID of the organization
26+
```
27+
28+
### Options inherited from parent commands
29+
30+
```
31+
-y, --assume-yes If set, skips all confirmation prompts
32+
--async If set, runs the command asynchronously
33+
-o, --output-format string Output format, (one of: [json, pretty, none, yaml])
34+
-p, --project-id string Project ID
35+
--region string Target region for region-specific requests
36+
--verbosity string Verbosity of the CLI, (one of: [debug, info, warning, error]) (default "info")
37+
```
38+
39+
### SEE ALSO
40+
41+
* [stackit beta scf space](./stackit_beta_scf_space.md) - Provides functionality for STACKIT Cloud Foundry spaces
42+

‎internal/cmd/beta/scf/organization/role/set/set.go‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1515
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
1616
"github.com/stackitcloud/stackit-cli/internal/pkg/services/scf/client"
17+
scfUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/scf/utils"
1718
"github.com/stackitcloud/stackit-cli/internal/pkg/types"
1819
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
1920
)
@@ -66,7 +67,7 @@ func NewCmd(p *types.CmdParams) *cobra.Command {
6667
return err
6768
}
6869

69-
prompt := fmt.Sprintf("Are you sure you want to assign role %q to user %q in STACKIT Cloud Foundry organization %q?", model.Role, userLabel(model), model.OrganizationId)
70+
prompt := fmt.Sprintf("Are you sure you want to assign role %q to user %q in STACKIT Cloud Foundry organization %q?", model.Role, scfUtils.UserLabel(model.UserGuid, model.UserName), model.OrganizationId)
7071
err = p.Printer.PromptForConfirmation(prompt)
7172
if err != nil {
7273
return err
@@ -130,15 +131,7 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient scf.DefaultA
130131

131132
func outputResult(p *print.Printer, model *inputModel, resp *scf.OrgRoleResponse) error {
132133
return p.OutputResult(model.OutputFormat, resp, func() error {
133-
p.Outputf("Assigned role %q to user %q in STACKIT Cloud Foundry organization %s\n", model.Role, userLabel(model), model.OrganizationId)
134+
p.Outputf("Assigned role %q to user %q in STACKIT Cloud Foundry organization %s\n", model.Role, scfUtils.UserLabel(model.UserGuid, model.UserName), model.OrganizationId)
134135
return nil
135136
})
136137
}
137-
138-
// userLabel returns the user identifier given on the command line, either the GUID or the username
139-
func userLabel(model *inputModel) string {
140-
if model.UserGuid != nil {
141-
return *model.UserGuid
142-
}
143-
return utils.PtrString(model.UserName)
144-
}

0 commit comments

Comments
 (0)