@@ -45,6 +45,8 @@ func GetGeneratedCommands() *core.Commands {
4545 cockpitGrafanaUserList (),
4646 cockpitGrafanaUserDelete (),
4747 cockpitGrafanaUserResetPassword (),
48+ cockpitPlanList (),
49+ cockpitPlanSelect (),
4850 )
4951}
5052func cockpitRoot () * core.Command {
@@ -727,3 +729,66 @@ func cockpitGrafanaUserResetPassword() *core.Command {
727729 },
728730 }
729731}
732+
733+ func cockpitPlanList () * core.Command {
734+ return & core.Command {
735+ Short : `List plans` ,
736+ Long : `List all pricing plans.` ,
737+ Namespace : "cockpit" ,
738+ Resource : "plan" ,
739+ Verb : "list" ,
740+ // Deprecated: false,
741+ ArgsType : reflect .TypeOf (cockpit.ListPlansRequest {}),
742+ ArgSpecs : core.ArgSpecs {
743+ {
744+ Name : "order-by" ,
745+ Required : false ,
746+ Deprecated : false ,
747+ Positional : false ,
748+ EnumValues : []string {"name_asc" , "name_desc" },
749+ },
750+ },
751+ Run : func (ctx context.Context , args interface {}) (i interface {}, e error ) {
752+ request := args .(* cockpit.ListPlansRequest )
753+
754+ client := core .ExtractClient (ctx )
755+ api := cockpit .NewAPI (client )
756+ opts := []scw.RequestOption {scw .WithAllPages ()}
757+ resp , err := api .ListPlans (request , opts ... )
758+ if err != nil {
759+ return nil , err
760+ }
761+ return resp .Plans , nil
762+
763+ },
764+ }
765+ }
766+
767+ func cockpitPlanSelect () * core.Command {
768+ return & core.Command {
769+ Short : `Select pricing plan` ,
770+ Long : `Select the wanted pricing plan.` ,
771+ Namespace : "cockpit" ,
772+ Resource : "plan" ,
773+ Verb : "select" ,
774+ // Deprecated: false,
775+ ArgsType : reflect .TypeOf (cockpit.SelectPlanRequest {}),
776+ ArgSpecs : core.ArgSpecs {
777+ core .ProjectIDArgSpec (),
778+ {
779+ Name : "plan-id" ,
780+ Required : false ,
781+ Deprecated : false ,
782+ Positional : false ,
783+ },
784+ },
785+ Run : func (ctx context.Context , args interface {}) (i interface {}, e error ) {
786+ request := args .(* cockpit.SelectPlanRequest )
787+
788+ client := core .ExtractClient (ctx )
789+ api := cockpit .NewAPI (client )
790+ return api .SelectPlan (request )
791+
792+ },
793+ }
794+ }
0 commit comments