Skip to content

Commit 9aec524

Browse files
author
Juan Jesús Padrón Hernández
committed
fix(sca): move o alpha package
1 parent d4cf417 commit 9aec524

18 files changed

Lines changed: 80 additions & 30 deletions

File tree

‎internal/cmd/alpha/alpha.go‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package alpha
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/stackitcloud/stackit-cli/internal/cmd/alpha/sca"
7+
"github.com/stackitcloud/stackit-cli/internal/pkg/types"
8+
9+
"github.com/stackitcloud/stackit-cli/internal/pkg/args"
10+
"github.com/stackitcloud/stackit-cli/internal/pkg/examples"
11+
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
12+
13+
"github.com/spf13/cobra"
14+
)
15+
16+
func NewCmd(params *types.CmdParams) *cobra.Command {
17+
cmd := &cobra.Command{
18+
Use: "alpha",
19+
Short: "Contains alpha STACKIT CLI commands",
20+
Long: fmt.Sprintf("%s\n%s",
21+
"Contains beta STACKIT CLI commands.",
22+
"The commands under this group are still in an alpha state, and functionality may be incomplete or have breaking changes."),
23+
Args: args.NoArgs,
24+
Run: utils.CmdHelp,
25+
Example: examples.Build(
26+
examples.NewExample(
27+
"See the currently available beta commands",
28+
"$ stackit alpha --help"),
29+
examples.NewExample(
30+
"Execute a alpha command",
31+
"$ stackit alpha MY_COMMAND"),
32+
),
33+
}
34+
addSubcommands(cmd, params)
35+
return cmd
36+
}
37+
38+
func addSubcommands(cmd *cobra.Command, params *types.CmdParams) {
39+
cmd.AddCommand(sca.NewCmd(params))
40+
}
File renamed without changes.

internal/cmd/sca/application/create-from-payload/create_from_payload.go renamed to internal/cmd/alpha/sca/application/create-from-payload/create_from_payload.go

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,24 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
3636
cmd := &cobra.Command{
3737
Use: "create-from-payload",
3838
Short: "Create a SCA application from payload",
39-
Long: "Create a STACKIT Kubernetes Engine (SCA) application from payload.",
40-
Args: args.NoArgs,
39+
Long: fmt.Sprintf("%s\n%s\n%s",
40+
"Create a STACKIT Kubernetes Engine (SCA) application from payload.",
41+
`The payload can be provided as a JSON string or a file path prefixed with "@".`,
42+
"See https://docs.api.stackit.cloud/documentation/sca/version/v1alpha#tag/Applications/operation/Applications_CreateApplication for information regarding the payload structure.",
43+
),
44+
Args: args.NoArgs,
4145
Example: examples.Build(
42-
// TODO: fix examples
4346
examples.NewExample(
44-
`Create a SCA application with ID "xxx" from an environment with ID "yyy"`,
45-
"$ stackit sca application describe xxx --environment-id yyy"),
47+
`Create a SCA application using an API payload sourced from the file "./payload.json"`,
48+
"$ stackit alpha sca cluster create-from-payload --name application-name --payload @./payload.json"),
49+
examples.NewExample(
50+
`Create a SCA application using an API payload provided as a JSON string`,
51+
`$ stackit alpha sca cluster create-from-payload --name application-name --payload "{...}"`),
4652
examples.NewExample(
47-
`Get details of all SCA application with ID "xxx" from an environment with ID "yyy" in JSON format`,
48-
"$ stackit sca application describe xxx --environment-id yyy --output-format json"),
53+
`Generate a payload with default values, and adapt it with custom values for the different configuration options`,
54+
`$ stackit alpha sca application generate-payload --file-path ./payload.json`,
55+
`<Modify payload in file, if needed>`,
56+
`$ stackit alpha sca application create-from-payload --name application-name --payload @./payload.json`),
4957
),
5058
RunE: func(cmd *cobra.Command, _ []string) error {
5159
ctx := context.Background()

internal/cmd/sca/application/create-from-payload/create_from_payload_test.go renamed to internal/cmd/alpha/sca/application/create-from-payload/create_from_payload_test.go

File renamed without changes.

internal/cmd/sca/application/create/create.go renamed to internal/cmd/alpha/sca/application/create/create.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,19 +91,19 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
9191
Example: examples.Build(
9292
examples.NewExample(
9393
`Create a SCA application with name "application-name" and image "my-image" for an environment with ID "yyy"`,
94-
"$ stackit sca application create --name application-name --image my-image --environment-id yyy"),
94+
"$ stackit alpha sca application create --name application-name --image my-image --environment-id yyy"),
9595
examples.NewExample(
9696
`Create a SCA application with name "application-name" and image "my-image" with 2 instances`,
97-
"$ stackit sca application create --name application-name --image my-image --instances 2"),
97+
"$ stackit alpha sca application create --name application-name --image my-image --instances 2"),
9898
examples.NewExample(
9999
`Create a SCA application with name "application-name" and image "my-image" exposing port 8888 of the container`,
100-
"$ stackit sca application create --name application-name --image my-image --port 8888"),
100+
"$ stackit alpha sca application create --name application-name --image my-image --port 8888"),
101101
examples.NewExample(
102102
`Create a SCA application with name "application-name" and image "my-image" disabling public networking`,
103-
"$ stackit sca application create --name application-name --image my-image --public=false"),
103+
"$ stackit alpha sca application create --name application-name --image my-image --public=false"),
104104
examples.NewExample(
105105
`Create a SCA application with name "application-name" and image "my-image" and environment variables ENV1=value1 and ENV2=value2`,
106-
"$ stackit sca application create --name application-name --image my-image --environment-vars ENV1=value1,ENV2=value2"),
106+
"$ stackit alpha sca application create --name application-name --image my-image --environment-vars ENV1=value1,ENV2=value2"),
107107
),
108108
RunE: func(cmd *cobra.Command, args []string) error {
109109
ctx := context.Background()
File renamed without changes.

internal/cmd/sca/application/delete/delete.go renamed to internal/cmd/alpha/sca/application/delete/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
3737
Example: examples.Build(
3838
examples.NewExample(
3939
`Delete a SCA application with ID "xxx" from an environment with ID "yyy"`,
40-
"$ stackit sca application delete xxx --environment-id yyy"),
40+
"$ stackit alpha sca application delete xxx --environment-id yyy"),
4141
),
4242
RunE: func(cmd *cobra.Command, args []string) error {
4343
ctx := context.Background()
File renamed without changes.

internal/cmd/sca/application/describe/describe.go renamed to internal/cmd/alpha/sca/application/describe/describe.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
4141
Example: examples.Build(
4242
examples.NewExample(
4343
`Get details of a SCA application with ID "xxx" from an environment with ID "yyy"`,
44-
"$ stackit sca application describe xxx --environment-id yyy"),
44+
"$ stackit alpha sca application describe xxx --environment-id yyy"),
4545
examples.NewExample(
4646
`Get details of all SCA application with ID "xxx" from an environment with ID "yyy" in JSON format`,
47-
"$ stackit sca application describe xxx --environment-id yyy --output-format json"),
47+
"$ stackit alpha sca application describe xxx --environment-id yyy --output-format json"),
4848
),
4949
RunE: func(cmd *cobra.Command, args []string) error {
5050
ctx := context.Background()

internal/cmd/sca/application/describe/describe_test.go renamed to internal/cmd/alpha/sca/application/describe/describe_test.go

File renamed without changes.

0 commit comments

Comments
 (0)