(ch *cmdutil.Helper)
| 7 | ) |
| 8 | |
| 9 | func ListCmd(ch *cmdutil.Helper) *cobra.Command { |
| 10 | var force bool |
| 11 | |
| 12 | listCmd := &cobra.Command{ |
| 13 | Use: "list", |
| 14 | Short: "List subscription for an organization", |
| 15 | Args: cobra.NoArgs, |
| 16 | RunE: func(cmd *cobra.Command, args []string) error { |
| 17 | client, err := ch.Client() |
| 18 | if err != nil { |
| 19 | return err |
| 20 | } |
| 21 | |
| 22 | resp, err := client.GetBillingSubscription(cmd.Context(), &adminv1.GetBillingSubscriptionRequest{ |
| 23 | Org: ch.Org, |
| 24 | SuperuserForceAccess: force, |
| 25 | }) |
| 26 | if err != nil { |
| 27 | return err |
| 28 | } |
| 29 | |
| 30 | if resp.Subscription == nil { |
| 31 | ch.PrintfWarn("No subscription found for organization %q.\n", ch.Org) |
| 32 | return nil |
| 33 | } |
| 34 | |
| 35 | ch.PrintfSuccess("Subscription for organization %q\n", ch.Org) |
| 36 | ch.PrintSubscriptions([]*adminv1.Subscription{resp.Subscription}) |
| 37 | return nil |
| 38 | }, |
| 39 | } |
| 40 | |
| 41 | listCmd.Flags().BoolVar(&force, "force", false, "Allows superusers to bypass certain checks") |
| 42 | _ = listCmd.Flags().MarkHidden("force") |
| 43 | |
| 44 | return listCmd |
| 45 | } |
no test coverage detected