@@ -2,10 +2,8 @@ package delete
22
33import (
44 "context"
5- "encoding/json"
65 "fmt"
76
8- "github.com/goccy/go-yaml"
97 "github.com/spf13/cobra"
108 "github.com/stackitcloud/stackit-cli/internal/cmd/params"
119 "github.com/stackitcloud/stackit-cli/internal/pkg/args"
@@ -76,12 +74,9 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
7674
7775 // Wait for async operation not relevant. Key ring deletion is synchronous.
7876
79- // Get the key ring so it can be outputted in the state it is after the deletion.
80- resp , err := apiClient .GetKeyRingExecute (ctx , model .ProjectId , model .Region , model .KeyRingId )
81- if err != nil {
82- params .Printer .Debug (print .ErrorLevel , "get KMS Key Ring: %w" , err )
83- }
84- return outputResult (params .Printer , model .OutputFormat , resp )
77+ // Don't output anything. It's a deletion.
78+ params .Printer .Info ("Deleted the key ring %q\n " , keyRingLabel )
79+ return nil
8580 },
8681 }
8782 return cmd
@@ -116,28 +111,3 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *kms.APIClie
116111 req := apiClient .DeleteKeyRing (ctx , model .ProjectId , model .Region , model .KeyRingId )
117112 return req
118113}
119-
120- func outputResult (p * print.Printer , outputFormat string , resp * kms.KeyRing ) error {
121- if resp == nil {
122- return fmt .Errorf ("response from 'GetKeyExecute()' is nil" )
123- }
124-
125- switch outputFormat {
126- case print .JSONOutputFormat :
127- details , err := json .MarshalIndent (resp , "" , " " )
128- if err != nil {
129- return fmt .Errorf ("marshal output to JSON: %w" , err )
130- }
131- p .Outputln (string (details ))
132- case print .YAMLOutputFormat :
133- details , err := yaml .MarshalWithOptions (resp , yaml .IndentSequence (true ), yaml .UseJSONMarshaler ())
134- if err != nil {
135- return fmt .Errorf ("marshal output to YAML: %w" , err )
136- }
137- p .Outputln (string (details ))
138-
139- default :
140- p .Outputf ("Deleted key ring: %s\n " , utils .PtrString (resp .DisplayName ))
141- }
142- return nil
143- }
0 commit comments