snapshot

package
v1.0.0-beta.124 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventSnapshot spec.EventName = "snapshot"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BalanceOperationType

type BalanceOperationType string
const (
	BalanceOperationUpdate BalanceOperationType = "update"
	BalanceOperationDelete BalanceOperationType = "delete"
)

type EntitlementBalanceSnapshotEvent

type EntitlementBalanceSnapshotEvent struct {
	Entitlement entitlement.Entitlement `json:"entitlement"`
	Namespace   models.NamespaceID      `json:"namespace"`
	Subject     models.SubjectKeyAndID  `json:"subject"`
	Feature     productcatalog.Feature  `json:"feature"`
	// Operation is delete if the entitlement gets deleted, in that case the balance object is empty
	Operation BalanceOperationType `json:"operation"`

	// CalculatedAt specifies when the balance calculation was performed. It can be used to verify
	// in edge-worker if the store already contains the required item.
	CalculatedAt *time.Time `json:"calculatedAt,omitempty"`

	Balance            *EntitlementValue  `json:"balance,omitempty"`
	CurrentUsagePeriod *recurrence.Period `json:"currentUsagePeriod,omitempty"`
}

func (EntitlementBalanceSnapshotEvent) Spec

func (EntitlementBalanceSnapshotEvent) Validate

type EntitlementValue

type EntitlementValue struct {
	// Balance Only available for metered entitlements. Metered entitlements are built around a balance calculation where feature usage is deducted from the issued grants. Balance represents the remaining balance of the entitlement, it's value never turns negative.
	Balance *float64 `json:"balance,omitempty"`

	// Config Only available for static entitlements. The JSON parsable config of the entitlement.
	Config *string `json:"config,omitempty"`

	// HasAccess Whether the subject has access to the feature. Shared across all entitlement types.
	HasAccess *bool `json:"hasAccess,omitempty"`

	// Overage Only available for metered entitlements. Overage represents the usage that wasn't covered by grants, e.g. if the subject had a total feature usage of 100 in the period but they were only granted 80, there would be 20 overage.
	Overage *float64 `json:"overage,omitempty"`

	// Usage Only available for metered entitlements. Returns the total feature usage in the current period.
	Usage *float64 `json:"usage,omitempty"`
}

Jump to

Keyboard shortcuts

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