Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComputeAccess ¶
type ComputeAccess struct {
Entitlement *ComputeEntitlement
Lease *SharedComputeLease
}
ComputeAccess groups an entitlement and its shared-capacity lease. It is not persisted as its own record.
type ComputeAccessActivation ¶
type ComputeAccessActivation struct {
OrganisationID string
EntitlementSource ComputeEntitlementSource
StartsAt time.Time
ExpiresAt *time.Time
}
ComputeAccessActivation describes the entitlement an organisation receives. Platform capacity is store configuration, not activation input.
type ComputeEntitlement ¶
type ComputeEntitlement struct {
ID string `gorm:"primary_key;default:gen_random_uuid()" json:"id"`
OrganisationID string `gorm:"not null;uniqueIndex:idx_compute_entitlement_org_source" json:"organisation_id"`
Source ComputeEntitlementSource `gorm:"not null;uniqueIndex:idx_compute_entitlement_org_source" json:"source"`
Status ComputeEntitlementStatus `gorm:"not null" json:"status"`
StartsAt time.Time `gorm:"not null" json:"starts_at"`
ExpiresAt *time.Time `gorm:"index" json:"expires_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
ComputeEntitlement records why an organisation may use compute.
type ComputeEntitlementSource ¶
type ComputeEntitlementSource string
const ComputeEntitlementSourceTrial ComputeEntitlementSource = "trial"
type ComputeEntitlementStatus ¶
type ComputeEntitlementStatus string
const ComputeEntitlementStatusActive ComputeEntitlementStatus = "active"
type Service ¶
type Service interface {
Activate(ctx context.Context, organisationID string) (*ComputeAccess, *errors.ServiceError)
}
Service manages the entitlement and shared-compute lease that back an organisation's use of managed compute. Activate creates the entitlement and shared-compute lease for an organisation on first use. If they already exist, it returns the existing compute access. Policy calls it to ensure access is granted before any compute is used.
func NewService ¶
func NewService(spec ServiceSpec) Service
NewService configures the default entitlement issued when managed compute is activated for the first time.
type ServiceSpec ¶
type SharedComputeLease ¶
type SharedComputeLease struct {
}
SharedComputeLease records platform capacity reserved for an organisation. Capacity remains reserved until runtime cleanup reaches the cleaned state.
type Store ¶
type Store interface {
Activate(ctx context.Context, activation ComputeAccessActivation) (*ComputeAccess, *errors.ServiceError)
}
Store atomically persists an entitlement and its shared-compute lease with the capacity-consuming resource that first activates them.