snapshot

package
v1.0.0-beta.164 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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"`
}

type SnapshotEvent

type SnapshotEvent struct {
	Entitlement entitlement.Entitlement `json:"entitlement"`
	Namespace   models.NamespaceID      `json:"namespace"`
	Subject     models.Subject          `json:"subject"`
	Feature     productcatalog.Feature  `json:"feature"`
	// Operation is delete if the entitlement gets deleted, in that case the balance object is empty
	Operation ValueOperationType `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"`

	Value              *EntitlementValue  `json:"value,omitempty"`
	CurrentUsagePeriod *recurrence.Period `json:"currentUsagePeriod,omitempty"`
}

func (SnapshotEvent) EventMetadata

func (e SnapshotEvent) EventMetadata() metadata.EventMetadata

func (SnapshotEvent) EventName

func (e SnapshotEvent) EventName() string

func (SnapshotEvent) Validate

func (e SnapshotEvent) Validate() error

type ValueOperationType

type ValueOperationType string
const (
	ValueOperationUpdate ValueOperationType = "update"
	ValueOperationDelete ValueOperationType = "delete"
)

Jump to

Keyboard shortcuts

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