Classify resource keys as boolean or numeric, adapt the operator form to the selected key, and derive rule types server-side to prevent wrong-shape rules.
187 lines
7.7 KiB
Go
187 lines
7.7 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.29.0
|
|
|
|
package entitlements
|
|
|
|
import (
|
|
"database/sql"
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
"github.com/sqlc-dev/pqtype"
|
|
)
|
|
|
|
type BooleanEntitlement struct {
|
|
PoolID string `json:"pool_id"`
|
|
ResourceKey string `json:"resource_key"`
|
|
Granted bool `json:"granted"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type EntitlementSet struct {
|
|
SetID string `json:"set_id"`
|
|
Name string `json:"name"`
|
|
Description sql.NullString `json:"description"`
|
|
IsActive bool `json:"is_active"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type EntitlementSetRule struct {
|
|
RuleID string `json:"rule_id"`
|
|
SetID string `json:"set_id"`
|
|
RuleType string `json:"rule_type"`
|
|
ResourceKey sql.NullString `json:"resource_key"`
|
|
ResourceValue sql.NullInt64 `json:"resource_value"`
|
|
ResourcePerUnit sql.NullBool `json:"resource_per_unit"`
|
|
StackingPolicy sql.NullString `json:"stacking_policy"`
|
|
ResetPeriod sql.NullString `json:"reset_period"`
|
|
CreditAmount sql.NullInt32 `json:"credit_amount"`
|
|
CreditCurrency sql.NullString `json:"credit_currency"`
|
|
Description sql.NullString `json:"description"`
|
|
IsActive bool `json:"is_active"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type Grant struct {
|
|
GrantID string `json:"grant_id"`
|
|
ProductID string `json:"product_id"`
|
|
GrantedToBillingAccountID uuid.NullUUID `json:"granted_to_billing_account_id"`
|
|
GrantedToOrgID uuid.NullUUID `json:"granted_to_org_id"`
|
|
GrantedToPersonID uuid.NullUUID `json:"granted_to_person_id"`
|
|
GrantedByPersonID uuid.NullUUID `json:"granted_by_person_id"`
|
|
GrantReason string `json:"grant_reason"`
|
|
Description sql.NullString `json:"description"`
|
|
Quantity int32 `json:"quantity"`
|
|
ValidFrom time.Time `json:"valid_from"`
|
|
ValidUntil sql.NullTime `json:"valid_until"`
|
|
Status string `json:"status"`
|
|
RevokedAt sql.NullTime `json:"revoked_at"`
|
|
RevokedByPersonID uuid.NullUUID `json:"revoked_by_person_id"`
|
|
RevocationReason sql.NullString `json:"revocation_reason"`
|
|
Metadata pqtype.NullRawMessage `json:"metadata"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
ExtendsGrantID uuid.NullUUID `json:"extends_grant_id"`
|
|
}
|
|
|
|
type NumericEntitlement struct {
|
|
EntitlementID string `json:"entitlement_id"`
|
|
PoolID string `json:"pool_id"`
|
|
ResourceKey string `json:"resource_key"`
|
|
EntitlementType string `json:"entitlement_type"`
|
|
ResourceLimit int64 `json:"resource_limit"`
|
|
ResetPeriod sql.NullString `json:"reset_period"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type NumericEntitlementContribution struct {
|
|
ContributionID string `json:"contribution_id"`
|
|
EntitlementID string `json:"entitlement_id"`
|
|
ProvisionID string `json:"provision_id"`
|
|
ContributedValue int64 `json:"contributed_value"`
|
|
StackingPolicy string `json:"stacking_policy"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type NumericEntitlementUsage struct {
|
|
UsageID string `json:"usage_id"`
|
|
EntitlementID string `json:"entitlement_id"`
|
|
PoolID string `json:"pool_id"`
|
|
ResourceKey string `json:"resource_key"`
|
|
CurrentUsage int64 `json:"current_usage"`
|
|
CurrentPeriodStart sql.NullTime `json:"current_period_start"`
|
|
CurrentPeriodEnd sql.NullTime `json:"current_period_end"`
|
|
LastResetAt sql.NullTime `json:"last_reset_at"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type PoolAssignment struct {
|
|
AssignmentID string `json:"assignment_id"`
|
|
PoolID string `json:"pool_id"`
|
|
WorkspaceID string `json:"workspace_id"`
|
|
IsPrimary bool `json:"is_primary"`
|
|
Status string `json:"status"`
|
|
SuspendedAt sql.NullTime `json:"suspended_at"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type PoolProvision struct {
|
|
ProvisionID string `json:"provision_id"`
|
|
PoolID string `json:"pool_id"`
|
|
BillingAccountID uuid.NullUUID `json:"billing_account_id"`
|
|
SubscriptionID uuid.NullUUID `json:"subscription_id"`
|
|
PurchaseID uuid.NullUUID `json:"purchase_id"`
|
|
GrantID uuid.NullUUID `json:"grant_id"`
|
|
Quantity int32 `json:"quantity"`
|
|
Status string `json:"status"`
|
|
ActivatedAt time.Time `json:"activated_at"`
|
|
SuspendedAt sql.NullTime `json:"suspended_at"`
|
|
EndedAt sql.NullTime `json:"ended_at"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
EntitlementSetID string `json:"entitlement_set_id"`
|
|
ProductID string `json:"product_id"`
|
|
}
|
|
|
|
type PoolProvisionLadder struct {
|
|
ProvisionID string `json:"provision_id"`
|
|
PlanLadderID string `json:"plan_ladder_id"`
|
|
PoolID string `json:"pool_id"`
|
|
Status string `json:"status"`
|
|
ActivatedAt time.Time `json:"activated_at"`
|
|
EndedAt sql.NullTime `json:"ended_at"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
ProductID string `json:"product_id"`
|
|
ProvisionLadderID string `json:"provision_ladder_id"`
|
|
}
|
|
|
|
type PoolProvisionTransition struct {
|
|
TransitionID string `json:"transition_id"`
|
|
PoolID string `json:"pool_id"`
|
|
ProvisionID uuid.NullUUID `json:"provision_id"`
|
|
PlanLadderID string `json:"plan_ladder_id"`
|
|
FromRank sql.NullInt32 `json:"from_rank"`
|
|
ToRank sql.NullInt32 `json:"to_rank"`
|
|
TransitionType string `json:"transition_type"`
|
|
ActorType string `json:"actor_type"`
|
|
ActorID uuid.NullUUID `json:"actor_id"`
|
|
Reason sql.NullString `json:"reason"`
|
|
EffectiveAt time.Time `json:"effective_at"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
ProvisionLadderID uuid.NullUUID `json:"provision_ladder_id"`
|
|
}
|
|
|
|
type ResourceKey struct {
|
|
ResourceKey string `json:"resource_key"`
|
|
DisplayName string `json:"display_name"`
|
|
Description sql.NullString `json:"description"`
|
|
Unit string `json:"unit"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
Provider sql.NullString `json:"provider"`
|
|
Kind string `json:"kind"`
|
|
}
|
|
|
|
type ResourcePool struct {
|
|
PoolID string `json:"pool_id"`
|
|
OrgID string `json:"org_id"`
|
|
Name string `json:"name"`
|
|
Slug string `json:"slug"`
|
|
PoolType string `json:"pool_type"`
|
|
IsAutoManaged bool `json:"is_auto_managed"`
|
|
Description sql.NullString `json:"description"`
|
|
Status string `json:"status"`
|
|
SuspendedAt sql.NullTime `json:"suspended_at"`
|
|
ArchivedAt sql.NullTime `json:"archived_at"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|