subscriptionsync

package
v1.0.0-beta.228 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllCmd = func() *cobra.Command {
	var force bool

	cmd := &cobra.Command{
		Use:   "all",
		Short: "Sync all subscriptions",
		RunE: func(cmd *cobra.Command, args []string) error {
			return internal.App.BillingSubscriptionReconciler.All(cmd.Context(), reconciler.ReconcilerAllInput{
				ReconcilerListSubscriptionsInput: reconciler.ReconcilerListSubscriptionsInput{
					Namespaces: namespaces,
					Customers:  customerIDs,
					Lookback:   lookback,
				},
				Force: force,
			})
		},
	}

	cmd.PersistentFlags().StringSliceVar(&namespaces, "n", nil, "filter by namespaces")
	cmd.PersistentFlags().StringSliceVar(&customerIDs, "c", nil, "filter by customer ids")
	cmd.PersistentFlags().DurationVar(&lookback, "l", defaultLookback, "lookback period")
	cmd.PersistentFlags().BoolVar(&force, "f", false, "force reconciliation (even if the sync state would not necessarily require it)")
	return cmd
}
View Source
var Cmd = &cobra.Command{
	Use:   "subscriptionsync",
	Short: "Subscription sync operations",
}
View Source
var ListCmd = func() *cobra.Command {
	cmd := &cobra.Command{
		Use:   "list",
		Short: "List subscriptions which can be synced",
		RunE: func(cmd *cobra.Command, args []string) error {
			subs, err := internal.App.BillingSubscriptionReconciler.ListSubscriptions(cmd.Context(), reconciler.ReconcilerListSubscriptionsInput{
				Namespaces: namespaces,
				Customers:  customerIDs,
				Lookback:   lookback,
			})
			if err != nil {
				return err
			}

			for _, sub := range subs {
				activeTo := ""
				if sub.ActiveTo != nil {
					activeTo = fmt.Sprintf(" ActiveTo: %s", sub.ActiveTo.Format(time.RFC3339))
				}

				fmt.Printf("Namespace: %s ID: %s CustomerID: %s ActiveFrom: %s%s\n",
					sub.Namespace,
					sub.ID,
					sub.CustomerId,
					sub.ActiveFrom.Format(time.RFC3339),
					activeTo)
			}

			return nil
		},
	}

	cmd.PersistentFlags().StringSliceVar(&namespaces, "n", nil, "filter by namespaces")
	cmd.PersistentFlags().StringSliceVar(&customerIDs, "c", nil, "filter by customer ids")
	cmd.PersistentFlags().DurationVar(&lookback, "l", defaultLookback, "lookback period")

	return cmd
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL