Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions internal/cmd/server/security-group/attach/attach.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package attach

import (
"github.com/spf13/cobra"
"github.com/stackitcloud/stackit-cli/internal/pkg/types"
)

func NewCmd(params *types.CmdParams) *cobra.Command {
cmd := &cobra.Command{
Use: "attach",
Short: "Attach a security group to a server",
Long: "Attach a security group to a server.",
Run: func(cmd *cobra.Command, args []string) {
params.Printer.Info("Attaching security group to server...")
},
}
return cmd
}
1 change: 1 addition & 0 deletions internal/cmd/server/security-group/attach/attach_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package attach
18 changes: 18 additions & 0 deletions internal/cmd/server/security-group/detach/detach.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package detach

import (
"github.com/spf13/cobra"
"github.com/stackitcloud/stackit-cli/internal/pkg/types"
)

func NewCmd(params *types.CmdParams) *cobra.Command {
cmd := &cobra.Command{
Use: "detach",
Short: "Detach a security group from a server",
Long: "Detach a security group from a server.",
Run: func(cmd *cobra.Command, args []string) {
params.Printer.Info("Detaching security group from server...")
},
}
return cmd
}
1 change: 1 addition & 0 deletions internal/cmd/server/security-group/detach/detach_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package detach
28 changes: 28 additions & 0 deletions internal/cmd/server/security-group/security-group.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package securitygroup

import (
"github.com/stackitcloud/stackit-cli/internal/cmd/server/security-group/attach"
"github.com/stackitcloud/stackit-cli/internal/cmd/server/security-group/detach"
"github.com/stackitcloud/stackit-cli/internal/pkg/args"
"github.com/stackitcloud/stackit-cli/internal/pkg/types"
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"

"github.com/spf13/cobra"
)

func NewCmd(params *types.CmdParams) *cobra.Command {
cmd := &cobra.Command{
Use: "security-group",
Short: "Allows attaching/detaching security groups to servers",
Long: "Allows attaching/detaching security groups to servers.",
Args: args.NoArgs,
Run: utils.CmdHelp,
}
addSubcommands(cmd, params)
return cmd
}

func addSubcommands(cmd *cobra.Command, params *types.CmdParams) {
cmd.AddCommand(attach.NewCmd(params))
cmd.AddCommand(detach.NewCmd(params))
}
2 changes: 2 additions & 0 deletions internal/cmd/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/stackitcloud/stackit-cli/internal/cmd/server/reboot"
"github.com/stackitcloud/stackit-cli/internal/cmd/server/rescue"
"github.com/stackitcloud/stackit-cli/internal/cmd/server/resize"
securitygroup "github.com/stackitcloud/stackit-cli/internal/cmd/server/security-group"
serviceaccount "github.com/stackitcloud/stackit-cli/internal/cmd/server/service-account"
"github.com/stackitcloud/stackit-cli/internal/cmd/server/start"
"github.com/stackitcloud/stackit-cli/internal/cmd/server/stop"
Expand Down Expand Up @@ -51,6 +52,7 @@ func addSubcommands(cmd *cobra.Command, params *types.CmdParams) {
cmd.AddCommand(describe.NewCmd(params))
cmd.AddCommand(list.NewCmd(params))
cmd.AddCommand(publicip.NewCmd(params))
cmd.AddCommand(securitygroup.NewCmd(params))
cmd.AddCommand(serviceaccount.NewCmd(params))
cmd.AddCommand(update.NewCmd(params))
cmd.AddCommand(volume.NewCmd(params))
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/server/service-account/detach/detach.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
serverLabel = model.ServerId
}

prompt := fmt.Sprintf("Are your sure you want to detach service account %q from a server %q?", model.ServiceAccMail, serverLabel)
prompt := fmt.Sprintf("Are you sure you want to detach service account %q from a server %q?", model.ServiceAccMail, serverLabel)
Comment thread
s-inter marked this conversation as resolved.
err = params.Printer.PromptForConfirmation(prompt)
if err != nil {
return err
Expand Down