MCPcopy Create free account
hub / github.com/rilldata/rill / ListCmd

Function ListCmd

cli/cmd/billing/subscription/list.go:9–45  ·  view source on GitHub ↗
(ch *cmdutil.Helper)

Source from the content-addressed store, hash-verified

7)
8
9func 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}

Callers 1

SubscriptionCmdFunction · 0.70

Calls 6

PrintfWarnMethod · 0.80
PrintfSuccessMethod · 0.80
PrintSubscriptionsMethod · 0.80
ContextMethod · 0.65
ClientMethod · 0.45

Tested by

no test coverage detected