35 lines
1.5 KiB
Go
35 lines
1.5 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"`
|
|
}
|