File tree Expand file tree Collapse file tree 7 files changed +194
-0
lines changed
Expand file tree Collapse file tree 7 files changed +194
-0
lines changed Original file line number Diff line number Diff line change 1+ package create
2+
3+ import (
4+ "github.com/spf13/cobra"
5+ "github.com/stackitcloud/stackit-cli/internal/pkg/args"
6+ "github.com/stackitcloud/stackit-cli/internal/pkg/examples"
7+ "github.com/stackitcloud/stackit-cli/internal/pkg/print"
8+ )
9+
10+ func NewCmd (p * print.Printer ) * cobra.Command {
11+ cmd := & cobra.Command {
12+ Use : "create" ,
13+ Short : "create security groups" ,
14+ Long : "create security groups" ,
15+ Args : args .NoArgs ,
16+ Example : examples .Build (
17+ examples .NewExample (`example 1` , `foo bar baz` ),
18+ examples .NewExample (`example 2` , `foo bar baz` ),
19+ ),
20+ RunE : func (cmd * cobra.Command , args []string ) error {
21+ return executeCreate (cmd , p , args )
22+ },
23+ }
24+ cmd .Flags ().String ("dummy" , "foo" , "fooify" )
25+ return cmd
26+ }
27+
28+ func executeCreate (cmd * cobra.Command , p * print.Printer , args []string ) error {
29+ p .Info ("executing create command" )
30+ return nil
31+ }
Original file line number Diff line number Diff line change 1+ package delete
2+
3+ import (
4+ "github.com/spf13/cobra"
5+ "github.com/stackitcloud/stackit-cli/internal/pkg/args"
6+ "github.com/stackitcloud/stackit-cli/internal/pkg/examples"
7+ "github.com/stackitcloud/stackit-cli/internal/pkg/print"
8+ )
9+
10+ func NewCmd (p * print.Printer ) * cobra.Command {
11+ cmd := & cobra.Command {
12+ Use : "delete" ,
13+ Short : "delete security groups" ,
14+ Long : "delete security groups" ,
15+ Args : args .NoArgs ,
16+ Example : examples .Build (
17+ examples .NewExample (`example 1` , `foo bar baz` ),
18+ examples .NewExample (`example 2` , `foo bar baz` ),
19+ ),
20+ RunE : func (cmd * cobra.Command , args []string ) error {
21+ return executeDelete (cmd , p , args )
22+ },
23+ }
24+ cmd .Flags ().String ("dummy" , "foo" , "fooify" )
25+ return cmd
26+ }
27+
28+ func executeDelete (cmd * cobra.Command , p * print.Printer , args []string ) error {
29+ p .Info ("executing create command" )
30+ return nil
31+ }
Original file line number Diff line number Diff line change 1+ package describe
2+
3+ import (
4+ "github.com/spf13/cobra"
5+ "github.com/stackitcloud/stackit-cli/internal/pkg/args"
6+ "github.com/stackitcloud/stackit-cli/internal/pkg/examples"
7+ "github.com/stackitcloud/stackit-cli/internal/pkg/print"
8+ )
9+
10+ func NewCmd (p * print.Printer ) * cobra.Command {
11+ cmd := & cobra.Command {
12+ Use : "describe" ,
13+ Short : "describe security groups" ,
14+ Long : "describe security groups" ,
15+ Args : args .NoArgs ,
16+ Example : examples .Build (
17+ examples .NewExample (`example 1` , `foo bar baz` ),
18+ examples .NewExample (`example 2` , `foo bar baz` ),
19+ ),
20+ RunE : func (cmd * cobra.Command , args []string ) error {
21+ return executeDescribe (cmd , p , args )
22+ },
23+ }
24+ cmd .Flags ().String ("dummy" , "foo" , "fooify" )
25+ return cmd
26+ }
27+
28+ func executeDescribe (cmd * cobra.Command , p * print.Printer , args []string ) error {
29+ p .Info ("executing describe command" )
30+ return nil
31+ }
Original file line number Diff line number Diff line change 1+ package list
2+
3+ import (
4+ "github.com/spf13/cobra"
5+ "github.com/stackitcloud/stackit-cli/internal/pkg/args"
6+ "github.com/stackitcloud/stackit-cli/internal/pkg/examples"
7+ "github.com/stackitcloud/stackit-cli/internal/pkg/print"
8+ )
9+
10+ func NewCmd (p * print.Printer ) * cobra.Command {
11+ cmd := & cobra.Command {
12+ Use : "list" ,
13+ Short : "list security groups" ,
14+ Long : "list security groups" ,
15+ Args : args .NoArgs ,
16+ Example : examples .Build (
17+ examples .NewExample (`example 1` , `foo bar baz` ),
18+ examples .NewExample (`example 2` , `foo bar baz` ),
19+ ),
20+ RunE : func (cmd * cobra.Command , args []string ) error {
21+ return executeList (cmd , p , args )
22+ },
23+ }
24+ cmd .Flags ().String ("dummy" , "foo" , "fooify" )
25+ return cmd
26+ }
27+
28+ func executeList (cmd * cobra.Command , p * print.Printer , args []string ) error {
29+ p .Info ("executing list command" )
30+ return nil
31+ }
Original file line number Diff line number Diff line change 1+ package security_group
2+
3+ import (
4+ "github.com/stackitcloud/stackit-cli/internal/cmd/auth/security_group/create"
5+ "github.com/stackitcloud/stackit-cli/internal/cmd/auth/security_group/delete"
6+ "github.com/stackitcloud/stackit-cli/internal/cmd/auth/security_group/describe"
7+ "github.com/stackitcloud/stackit-cli/internal/cmd/auth/security_group/list"
8+ "github.com/stackitcloud/stackit-cli/internal/cmd/auth/security_group/update"
9+ "github.com/stackitcloud/stackit-cli/internal/pkg/args"
10+ "github.com/stackitcloud/stackit-cli/internal/pkg/print"
11+
12+ "github.com/stackitcloud/stackit-cli/internal/pkg/utils"
13+
14+ "github.com/spf13/cobra"
15+ )
16+
17+ func NewCmd (p * print.Printer ) * cobra.Command {
18+ cmd := & cobra.Command {
19+ Use : "security-group" ,
20+ Short : "manage security groups." ,
21+ Long : "manage the lifecycle of security groups." ,
22+ Args : args .NoArgs ,
23+ Run : utils .CmdHelp ,
24+ }
25+ addSubcommands (cmd , p )
26+ return cmd
27+ }
28+
29+ func addSubcommands (cmd * cobra.Command , p * print.Printer ) {
30+ cmd .AddCommand (
31+ create .NewCmd (p ),
32+ delete .NewCmd (p ),
33+ describe .NewCmd (p ),
34+ list .NewCmd (p ),
35+ update .NewCmd (p ),
36+ )
37+ }
Original file line number Diff line number Diff line change 1+ package update
2+
3+ import (
4+ "github.com/spf13/cobra"
5+ "github.com/stackitcloud/stackit-cli/internal/pkg/args"
6+ "github.com/stackitcloud/stackit-cli/internal/pkg/examples"
7+ "github.com/stackitcloud/stackit-cli/internal/pkg/print"
8+ )
9+
10+ func NewCmd (p * print.Printer ) * cobra.Command {
11+ cmd := & cobra.Command {
12+ Use : "update" ,
13+ Short : "update security groups" ,
14+ Long : "update security groups" ,
15+ Args : args .NoArgs ,
16+ Example : examples .Build (
17+ examples .NewExample (`example 1` , `foo bar baz` ),
18+ examples .NewExample (`example 2` , `foo bar baz` ),
19+ ),
20+ RunE : func (cmd * cobra.Command , args []string ) error {
21+ return executeUpdate (cmd , p , args )
22+ },
23+ }
24+ cmd .Flags ().String ("dummy" , "foo" , "fooify" )
25+ return cmd
26+ }
27+
28+ func executeUpdate (cmd * cobra.Command , p * print.Printer , args []string ) error {
29+ p .Info ("executing update command" )
30+ return nil
31+ }
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package beta
33import (
44 "fmt"
55
6+ "github.com/stackitcloud/stackit-cli/internal/cmd/auth/security_group"
67 keypair "github.com/stackitcloud/stackit-cli/internal/cmd/beta/key-pair"
78 "github.com/stackitcloud/stackit-cli/internal/cmd/beta/network"
89 networkArea "github.com/stackitcloud/stackit-cli/internal/cmd/beta/network-area"
@@ -49,5 +50,6 @@ func addSubcommands(cmd *cobra.Command, p *print.Printer) {
4950 cmd .AddCommand (volume .NewCmd (p ))
5051 cmd .AddCommand (networkinterface .NewCmd (p ))
5152 cmd .AddCommand (publicip .NewCmd (p ))
53+ cmd .AddCommand (security_group .NewCmd (p ))
5254 cmd .AddCommand (keypair .NewCmd (p ))
5355}
You can’t perform that action at this time.
0 commit comments