usage

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoBillingAccountCandidate = errors.New("organization has no billing account candidate")
View Source
var ErrUsageDisabled = errors.New("usage disabled")

Functions

func CacheOrganizationLimits

func CacheOrganizationLimits(orgID string, limits *pb.OrganizationLimits, readStartedAt time.Time, syncedAt time.Time) error

func EnsureAccountWithinLimits

func EnsureAccountWithinLimits(ctx context.Context, usageService Service, accountID string, state *pb.AccountState) error

func EnsureOrganizationWithinLimits

func EnsureOrganizationWithinLimits(
	ctx context.Context,
	usageService Service,
	organizationID string,
	state *pb.OrganizationState,
	canvas *pb.CanvasState,
) error

func LimitViolationError

func LimitViolationError(violations []*pb.LimitViolation) error

func MarkOrganizationSyncedIfUnset

func MarkOrganizationSyncedIfUnset(orgID string) error

func RefreshOrganizationLimitsCache

func RefreshOrganizationLimitsCache(ctx context.Context, usageService Service, orgID string) (*pb.OrganizationLimits, error)

func SyncOrganization

func SyncOrganization(ctx context.Context, usageService Service, orgID string) error

func SyncOrganizationForce

func SyncOrganizationForce(ctx context.Context, usageService Service, orgID string) error

Types

type Service

type Service interface {
	Enabled() bool
	SetupAccount(ctx context.Context, accountID string) (*pb.SetupAccountResponse, error)
	SetupOrganization(ctx context.Context, organizationID, accountID string) (*pb.SetupOrganizationResponse, error)
	DescribeAccountLimits(ctx context.Context, accountID string) (*pb.DescribeAccountLimitsResponse, error)
	DescribeOrganizationLimits(ctx context.Context, organizationID string) (*pb.DescribeOrganizationLimitsResponse, error)
	DescribeOrganizationUsage(ctx context.Context, organizationID string) (*pb.DescribeOrganizationUsageResponse, error)
	CheckAccountLimits(ctx context.Context, accountID string, state *pb.AccountState) (*pb.CheckAccountLimitsResponse, error)
	CheckOrganizationLimits(
		ctx context.Context,
		organizationID string,
		state *pb.OrganizationState,
		canvas *pb.CanvasState,
	) (*pb.CheckOrganizationLimitsResponse, error)
}

func NewServiceFromEnv

func NewServiceFromEnv() (Service, error)

Jump to

Keyboard shortcuts

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