@@ -77,23 +77,20 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
7777 return fmt .Errorf ("list volume performance classes: %w" , err )
7878 }
7979
80- if resp .Items == nil || len (* resp .Items ) == 0 {
81- projectLabel , err := projectname .GetProjectName (ctx , params .Printer , params .CliVersion , cmd )
82- if err != nil {
83- params .Printer .Debug (print .ErrorLevel , "get project name: %v" , err )
84- projectLabel = model .ProjectId
85- }
86- params .Printer .Info ("No volume performance class found for project %q\n " , projectLabel )
87- return nil
80+ items := resp .GetItems ()
81+
82+ projectLabel , err := projectname .GetProjectName (ctx , params .Printer , params .CliVersion , cmd )
83+ if err != nil {
84+ params .Printer .Debug (print .ErrorLevel , "get project name: %v" , err )
85+ projectLabel = model .ProjectId
8886 }
8987
9088 // Truncate output
91- items := * resp .Items
9289 if model .Limit != nil && len (items ) > int (* model .Limit ) {
9390 items = items [:* model .Limit ]
9491 }
9592
96- return outputResult (params .Printer , model .OutputFormat , items )
93+ return outputResult (params .Printer , model .OutputFormat , projectLabel , items )
9794 },
9895 }
9996 configureFlags (cmd )
@@ -138,8 +135,12 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *iaas.APICli
138135 return req
139136}
140137
141- func outputResult (p * print.Printer , outputFormat string , performanceClasses []iaas.VolumePerformanceClass ) error {
138+ func outputResult (p * print.Printer , outputFormat , projectLabel string , performanceClasses []iaas.VolumePerformanceClass ) error {
142139 return p .OutputResult (outputFormat , performanceClasses , func () error {
140+ if len (performanceClasses ) == 0 {
141+ p .Outputf ("No volume performance class found for project %q\n " , projectLabel )
142+ return nil
143+ }
143144 table := tables .NewTable ()
144145 table .SetHeader ("Name" , "Description" )
145146
0 commit comments