Documentation
¶
Overview ¶
Package billing is the obot-billing subscription of a billed Obot Cloud environment. Client asks obot-billing itself. Provider provides the entitlements the subscription grants, and the restriction for staying over them, from the Subscription the leader stores.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RequestSync ¶
RequestSync asks the leader to sync the Subscription with billing now, by setting SubscriptionSyncAnnotation. A sync that's already pending covers the request, so it isn't written again. Without a Subscription, which only a billed environment has, it returns a not-found error.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client calls billing's API for Obot with the environment's billing key.
func (*Client) CreateSession ¶
CreateSession opens the billing pages for an owner and returns a one-time link to them. Billing sends the owner back to returnURL when they're done.
func (*Client) FetchSubscription ¶
FetchSubscription reads the environment's subscription, entitlements included. It refuses an answer with a negative limit, which nothing could enforce.
type Provider ¶
type Provider struct {
// Client asks obot-billing itself.
Client *Client
// contains filtered or unexported fields
}
Provider provides a billed environment's entitlements, in place of its license.
func NewProvider ¶
NewProvider returns the provider for the environment that client's billing key belongs to. Requests read the Subscription all the time, so it's read from the cache, which follows the leader's writes within moments. Startup reads it before the cache starts, and those reads go to storage.
func (*Provider) Entitlements ¶
Entitlements are what the subscription grants.
func (*Provider) Restricted ¶
Restricted reports whether only admins and owners can use the environment. It's restricted once usage has been over the limits for the grace period, or once billing hasn't answered for the grace period past the end of the period it last answered with.