43 lines
2.0 KiB
Go
43 lines
2.0 KiB
Go
// Package models holds the MongoDB documents written by more than one Vantage
|
|
// service. Documents only the control plane touches stay in
|
|
// server/internal/models.
|
|
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"go.mongodb.org/mongo-driver/v2/bson"
|
|
)
|
|
|
|
// Instance is one deployment of Vantage: its own subdomain, users, servers,
|
|
// keys, workflows, monitors and secrets. It is the unit a licence attaches to.
|
|
//
|
|
// A paying customer may hold several. That grouping is called an Account and
|
|
// lives only in the admin control plane - this service never sees it.
|
|
type Instance struct {
|
|
ID bson.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
|
|
InstanceID string `bson:"instance_id" json:"instance_id"`
|
|
Name string `bson:"name" json:"name"`
|
|
Slug string `bson:"slug" json:"slug"`
|
|
CreatedAt time.Time `bson:"created_at" json:"created_at"`
|
|
|
|
// LicenseBlob is the authoritative licence. LicenseTier and LicenseExpiry
|
|
// are a denormalised cache for listing and for the admin service's queries,
|
|
// rewritten from the verified payload every time a blob is accepted.
|
|
// Nothing reads them for enforcement.
|
|
//
|
|
// The blob is json:"-" because there is no reason to spray it through API
|
|
// responses. It is signed public data, not a secret.
|
|
LicenseBlob string `bson:"license_blob,omitempty" json:"-"`
|
|
LicenseTier string `bson:"license_tier,omitempty" json:"license_tier,omitempty"`
|
|
LicenseExpiry *time.Time `bson:"license_expiry,omitempty" json:"license_expiry,omitempty"`
|
|
|
|
// LockedAt and PurgeAfter are written by vantage-admin's cloudprov when the
|
|
// account that owns this instance is under a dispute. LockedAt makes the
|
|
// control plane refuse the instance everywhere; PurgeAfter, set only once a
|
|
// dispute has failed, authorises the reaper to delete it. Both absent is the
|
|
// normal state, and nothing but admin ever sets them.
|
|
LockedAt *time.Time `bson:"locked_at,omitempty" json:"locked_at,omitempty"`
|
|
PurgeAfter *time.Time `bson:"purge_after,omitempty" json:"purge_after,omitempty"`
|
|
}
|