Documentation
¶
Overview ¶
Package store holds the panel's PostgreSQL queries.
Index ¶
- Variables
- func NormalizeEmail(email string) (string, error)
- func NormalizeLocale(l string) string
- type Allocation
- type Blueprint
- type Coupon
- type CreditTransaction
- type DNSZone
- type Extension
- type ExtensionKV
- type Invoice
- type InvoiceItem
- type MailDomain
- type Mailbox
- type NewOrder
- type NewService
- type NewWebsite
- type Node
- type Passkey
- type Payment
- type PaymentHook
- type Product
- type ProductOption
- type ProductPlan
- type ResellerLimits
- type ResellerUsage
- type Service
- type Store
- func (s *Store) ActivateTheme(ctx context.Context, id string) error
- func (s *Store) ActiveTheme(ctx context.Context) (Theme, error)
- func (s *Store) AddPasskey(ctx context.Context, p Passkey) (Passkey, error)
- func (s *Store) AddWebsiteCron(ctx context.Context, websiteID, schedule, command string) error
- func (s *Store) AddWebsiteDatabase(ctx context.Context, websiteID, name string) (WebsiteDatabase, error)
- func (s *Store) AddWebsiteDomain(ctx context.Context, websiteID string, d WebsiteDomain) error
- func (s *Store) AdjustCredit(ctx context.Context, userID string, amount int64, ...) (int64, error)
- func (s *Store) ApplySubscriptionChange(ctx context.Context, sub Subscription, c SubscriptionChange, credit int64, ...) error
- func (s *Store) BlueprintExport(ctx context.Context, id string) (name string, raw []byte, err error)
- func (s *Store) BlueprintRaw(ctx context.Context, id string) ([]byte, error)
- func (s *Store) CancelOpenInvoices(ctx context.Context, subID string) error
- func (s *Store) ConsumeEmailToken(ctx context.Context, tokenHash []byte, purpose string) (User, error)
- func (s *Store) CountAdmins(ctx context.Context) (int, error)
- func (s *Store) CouponByCode(ctx context.Context, code string) (Coupon, error)
- func (s *Store) CreateAllocations(ctx context.Context, nodeID, ip string, ports []int) (int, error)
- func (s *Store) CreateChangeInvoice(ctx context.Context, sub Subscription, c SubscriptionChange, amount int64, ...) (string, error)
- func (s *Store) CreateCustomer(ctx context.Context, email, name, passwordHash, locale string) (User, error)
- func (s *Store) CreateDNSZone(ctx context.Context, z DNSZone) (DNSZone, error)
- func (s *Store) CreateEmailToken(ctx context.Context, tokenHash []byte, userID, purpose, email string, ...) error
- func (s *Store) CreateMailDomain(ctx context.Context, d MailDomain) (MailDomain, error)
- func (s *Store) CreateMailbox(ctx context.Context, m Mailbox) (Mailbox, error)
- func (s *Store) CreateNode(ctx context.Context, name, address string, tokenHash []byte, ...) (Node, error)
- func (s *Store) CreateOrder(ctx context.Context, o NewOrder) (Invoice, error)
- func (s *Store) CreateRenewal(ctx context.Context, sub Subscription, description string, ...) (string, error)
- func (s *Store) CreateResellerCustomer(ctx context.Context, resellerID, email, name, passwordHash string) (User, error)
- func (s *Store) CreateService(ctx context.Context, in NewService) (Service, error)
- func (s *Store) CreateSession(ctx context.Context, tokenHash []byte, userID, userAgent, ip string, ...) error
- func (s *Store) CreateUser(ctx context.Context, email, name, passwordHash string, isAdmin bool) (User, error)
- func (s *Store) CreateWebsite(ctx context.Context, n NewWebsite) (Website, error)
- func (s *Store) CreditHistory(ctx context.Context, userID string) ([]CreditTransaction, error)
- func (s *Store) DNSZoneByName(ctx context.Context, name string) (DNSZone, error)
- func (s *Store) DeleteAllocation(ctx context.Context, nodeID, id string) error
- func (s *Store) DeleteBlueprint(ctx context.Context, id string) error
- func (s *Store) DeleteCoupon(ctx context.Context, id string) error
- func (s *Store) DeleteDNSZone(ctx context.Context, id string) error
- func (s *Store) DeleteExtension(ctx context.Context, id string) error
- func (s *Store) DeleteMailDomain(ctx context.Context, id string) error
- func (s *Store) DeleteMailbox(ctx context.Context, domainID, id string) error
- func (s *Store) DeleteNode(ctx context.Context, id string) error
- func (s *Store) DeletePasskey(ctx context.Context, userID, id string) error
- func (s *Store) DeleteProduct(ctx context.Context, id string) error
- func (s *Store) DeleteService(ctx context.Context, id string) error
- func (s *Store) DeleteSession(ctx context.Context, tokenHash []byte) error
- func (s *Store) DeleteTheme(ctx context.Context, id string) error
- func (s *Store) DeleteWebsite(ctx context.Context, id string) error
- func (s *Store) DeleteWebsiteCron(ctx context.Context, websiteID, id string) error
- func (s *Store) DeleteWebsiteDatabase(ctx context.Context, websiteID, dbID string) (string, error)
- func (s *Store) DeleteWebsiteDomain(ctx context.Context, websiteID, domainID string) error
- func (s *Store) DisableTOTP(ctx context.Context, id string) error
- func (s *Store) DomainGitHook(ctx context.Context, domainID string, tokenHash []byte) (websiteID string, d WebsiteDomain, err error)
- func (s *Store) DomainTaken(ctx context.Context, name string) (bool, error)
- func (s *Store) EnableTOTP(ctx context.Context, id string, step int64, recoveryHashes [][]byte) error
- func (s *Store) FindFreeAllocation(ctx context.Context, nodeIDs []string, skip []string) (allocID, nodeID string, err error)
- func (s *Store) GetBlueprint(ctx context.Context, id string) (Blueprint, error)
- func (s *Store) GetCoupon(ctx context.Context, id string) (Coupon, error)
- func (s *Store) GetDNSZone(ctx context.Context, id string) (DNSZone, error)
- func (s *Store) GetExtension(ctx context.Context, id string) (Extension, error)
- func (s *Store) GetInvoice(ctx context.Context, id string) (Invoice, error)
- func (s *Store) GetMailDomain(ctx context.Context, id string) (MailDomain, error)
- func (s *Store) GetMailbox(ctx context.Context, domainID, id string) (Mailbox, error)
- func (s *Store) GetNode(ctx context.Context, id string) (Node, error)
- func (s *Store) GetProduct(ctx context.Context, id string) (Product, error)
- func (s *Store) GetResellerLimits(ctx context.Context, userID string) (ResellerLimits, error)
- func (s *Store) GetService(ctx context.Context, id string) (Service, error)
- func (s *Store) GetSetting(ctx context.Context, key string, out any) error
- func (s *Store) GetSubscription(ctx context.Context, id string) (Subscription, error)
- func (s *Store) GetWebsite(ctx context.Context, id string) (Website, error)
- func (s *Store) ImportBlueprint(ctx context.Context, raw []byte, e *egg.Egg, warnings []egg.Warning, ...) (b Blueprint, created bool, err error)
- func (s *Store) ListAllocations(ctx context.Context, nodeID string) ([]Allocation, error)
- func (s *Store) ListBlueprints(ctx context.Context) ([]Blueprint, error)
- func (s *Store) ListCoupons(ctx context.Context) ([]Coupon, error)
- func (s *Store) ListDNSZones(ctx context.Context, ownerID string) ([]DNSZone, error)
- func (s *Store) ListExtensions(ctx context.Context) ([]Extension, error)
- func (s *Store) ListInvoices(ctx context.Context, userID string) ([]Invoice, error)
- func (s *Store) ListMailDomains(ctx context.Context, ownerID string) ([]MailDomain, error)
- func (s *Store) ListMailboxes(ctx context.Context, domainID string) ([]Mailbox, error)
- func (s *Store) ListNodes(ctx context.Context) ([]Node, error)
- func (s *Store) ListPasskeys(ctx context.Context, userID string) ([]Passkey, error)
- func (s *Store) ListPayments(ctx context.Context, invoiceID string) ([]Payment, error)
- func (s *Store) ListProducts(ctx context.Context, activeOnly bool) ([]Product, error)
- func (s *Store) ListResellerCustomers(ctx context.Context, resellerID string) ([]User, error)
- func (s *Store) ListServices(ctx context.Context, ownerID, nodeID string) ([]Service, error)
- func (s *Store) ListSubscriptions(ctx context.Context, userID string) ([]Subscription, error)
- func (s *Store) ListThemes(ctx context.Context) ([]Theme, error)
- func (s *Store) ListUsers(ctx context.Context) ([]UserSummary, error)
- func (s *Store) ListWebsites(ctx context.Context, ownerID, nodeID string) ([]Website, error)
- func (s *Store) ListWebsitesOfReseller(ctx context.Context, resellerID string) ([]Website, error)
- func (s *Store) LoadOrCreateCA(ctx context.Context, create func() (certPEM, keyPEM []byte, err error)) (certPEM, keyPEM []byte, err error)
- func (s *Store) MailDomainByName(ctx context.Context, name string) (MailDomain, error)
- func (s *Store) MailNameTaken(ctx context.Context, domainID, local, exceptMailbox string) (bool, error)
- func (s *Store) NodeByCert(ctx context.Context, fingerprint []byte) (Node, error)
- func (s *Store) OpenRenewal(ctx context.Context, subID string, periodStart time.Time) (string, error)
- func (s *Store) PasskeyByCredential(ctx context.Context, credID []byte) (Passkey, error)
- func (s *Store) PasskeyUsed(ctx context.Context, id string, oldCount, newCount uint32) error
- func (s *Store) PayWithCredit(ctx context.Context, invoiceID, userID string, onPaid PaymentHook) error
- func (s *Store) Ping(ctx context.Context) error
- func (s *Store) Pool() *pgxpool.Pool
- func (s *Store) PutSetting(ctx context.Context, key string, value any) error
- func (s *Store) RecordNodeHello(ctx context.Context, id, agentVersion string, info json.RawMessage) error
- func (s *Store) RecordPayment(ctx context.Context, invoiceID, gateway, ref string, amount int64, ...) (bool, error)
- func (s *Store) RecoveryCodesLeft(ctx context.Context, id string) (int, error)
- func (s *Store) RedeemJoinToken(ctx context.Context, tokenHash []byte, ...) (Node, error)
- func (s *Store) RemoveReseller(ctx context.Context, userID string) error
- func (s *Store) RenewNodeCert(ctx context.Context, nodeID string, fingerprint []byte, expires time.Time, ...) error
- func (s *Store) ResellerUsage(ctx context.Context, resellerID, exceptWebsite string) (ResellerUsage, error)
- func (s *Store) SaveCoupon(ctx context.Context, c Coupon) (Coupon, error)
- func (s *Store) SaveExtension(ctx context.Context, e Extension) (Extension, error)
- func (s *Store) SaveProduct(ctx context.Context, p Product) (Product, error)
- func (s *Store) SaveTheme(ctx context.Context, t Theme) (Theme, error)
- func (s *Store) ServiceOnNodeBySuffix(ctx context.Context, nodeID, suffix string) (Service, error)
- func (s *Store) SessionUser(ctx context.Context, tokenHash []byte) (User, error)
- func (s *Store) SetCancelAtPeriodEnd(ctx context.Context, subID string, cancel bool) error
- func (s *Store) SetEmailVerified(ctx context.Context, userID string) error
- func (s *Store) SetExtensionEnabled(ctx context.Context, id string, enabled bool) error
- func (s *Store) SetExtensionError(ctx context.Context, id, msg string) error
- func (s *Store) SetExtensionSettings(ctx context.Context, id string, settings map[string]string) error
- func (s *Store) SetJoinToken(ctx context.Context, id string, tokenHash []byte, expires time.Time) (Node, error)
- func (s *Store) SetLocale(ctx context.Context, userID, locale string) error
- func (s *Store) SetPassword(ctx context.Context, userID, passwordHash string) error
- func (s *Store) SetPendingTOTP(ctx context.Context, id string, secret []byte) error
- func (s *Store) SetReseller(ctx context.Context, userID string, l ResellerLimits) error
- func (s *Store) SetServiceState(ctx context.Context, id, state, detail string) error
- func (s *Store) SetServiceStateOnNode(ctx context.Context, nodeID, id, state, detail string) error
- func (s *Store) SetServiceSuspended(ctx context.Context, id string, suspended bool) error
- func (s *Store) SetSubscriptionExternal(ctx context.Context, id, externalID string, info json.RawMessage) error
- func (s *Store) SetSubscriptionStatus(ctx context.Context, id, status, note string, serviceID *string, ...) error
- func (s *Store) SetSubscriptionWebsite(ctx context.Context, id, websiteID string, nextDue time.Time) error
- func (s *Store) SetWebsiteDomainGit(ctx context.Context, websiteID, domainID, repo, branch string, ...) error
- func (s *Store) SetWebsiteState(ctx context.Context, id, state, detail string, diskBytes int64) error
- func (s *Store) SetWebsiteSuspended(ctx context.Context, id string, suspended bool) error
- func (s *Store) SubscriptionForService(ctx context.Context, serviceID string) (Subscription, error)
- func (s *Store) SubscriptionsDue(ctx context.Context, before time.Time) ([]Subscription, error)
- func (s *Store) TouchNode(ctx context.Context, id string) error
- func (s *Store) UpdateBlueprint(ctx context.Context, id string, raw []byte, e *egg.Egg, warnings []egg.Warning) (Blueprint, error)
- func (s *Store) UpdateMailDomainLimits(ctx context.Context, id string, maxMailboxes, maxQuotaMB int) error
- func (s *Store) UpdateMailbox(ctx context.Context, m Mailbox) error
- func (s *Store) UpdateNode(ctx context.Context, id, name, address string) (Node, error)
- func (s *Store) UpdatePasswordHash(ctx context.Context, userID, oldHash, newHash string) error
- func (s *Store) UpdateServiceSettings(ctx context.Context, id, name string, memoryMB, cpuPercent, diskMB int) error
- func (s *Store) UpdateServiceStartup(ctx context.Context, id, image string, vars map[string]string) error
- func (s *Store) UpdateWebsiteDomain(ctx context.Context, websiteID string, d WebsiteDomain) error
- func (s *Store) UpdateWebsiteLimits(ctx context.Context, id string, l WebsiteLimits) error
- func (s *Store) UpdateWebsitePHP(ctx context.Context, id, version string, php map[string]string) error
- func (s *Store) UseRecoveryCode(ctx context.Context, id string, hash []byte) (bool, error)
- func (s *Store) UseTOTPStep(ctx context.Context, id string, step int64) (bool, error)
- func (s *Store) UserByEmail(ctx context.Context, email string) (User, error)
- func (s *Store) UserByID(ctx context.Context, id string) (User, error)
- func (s *Store) UserByWebAuthnID(ctx context.Context, handle []byte) (User, error)
- func (s *Store) WebAuthnID(ctx context.Context, userID string) ([]byte, error)
- func (s *Store) WebsiteOnNodeBySuffix(ctx context.Context, nodeID, suffix string) (Website, error)
- type Subscription
- type SubscriptionChange
- type Theme
- type User
- type UserSummary
- type Website
- type WebsiteCron
- type WebsiteDatabase
- type WebsiteDomain
- type WebsiteLimits
Constants ¶
This section is empty.
Variables ¶
var ( ErrDomainTaken = errors.New("domain already in use") ErrLimit = errors.New("plan limit reached") )
Website errors.
var ErrCodeTaken = errors.New("coupon code taken")
ErrCodeTaken means another coupon has the code.
var ErrConflict = errors.New("already exists")
ErrConflict is returned when a unique value is already taken (e.g. an allocation port).
var ErrCouponUsedUp = errors.New("coupon used up")
ErrCouponUsedUp means the coupon reached its use limit meanwhile.
var ErrEmailTaken = errors.New("email already in use")
ErrEmailTaken is returned when another user already has the email address.
var ErrInUse = errors.New("in use")
ErrInUse is returned when a row cannot be removed because something still uses it.
var ErrInsufficientCredit = errors.New("insufficient credit")
ErrInsufficientCredit means the balance would go below zero.
var ErrInvalidEmail = errors.New("invalid email address")
ErrInvalidEmail is returned for malformed email addresses.
var ErrInvalidToken = errors.New("invalid or expired join token")
ErrInvalidToken is returned for unknown, used or expired join tokens.
var ErrKVFull = errors.New("extension storage is full")
ErrKVFull means an extension reached its key limit.
var ErrNotFound = errors.New("not found")
ErrNotFound is returned when a row does not exist.
var ErrPasskeyExists = errors.New("passkey already registered")
ErrPasskeyExists means the credential is registered already.
var ErrSameAsOther = errors.New("this egg file is already imported as another blueprint")
ErrSameAsOther means an update's file is already stored as another blueprint.
var ErrTokenInvalid = errors.New("invalid or expired link")
ErrTokenInvalid means the link is unknown, used or expired.
Functions ¶
func NormalizeEmail ¶
NormalizeEmail trims and validates an address. Case is preserved for display; uniqueness and lookup are case-insensitive.
func NormalizeLocale ¶
NormalizeLocale maps a language tag to a supported email locale.
Types ¶
type Allocation ¶
type Allocation struct {
ID string `json:"id"`
NodeID string `json:"node_id"`
IP string `json:"ip"`
Port int `json:"port"`
ServiceID *string `json:"service_id"`
}
Allocation is an IP:port on a node.
type Blueprint ¶
type Blueprint struct {
ID string `json:"id"`
Name string `json:"name"`
Author string `json:"author"`
Description string `json:"description"`
Format egg.Format `json:"format"`
UpdateURL string `json:"update_url"`
SourceURL string `json:"source_url"`
Warnings []egg.Warning `json:"warnings"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
// Egg is the normalised egg; only filled by GetBlueprint.
Egg *egg.Egg `json:"egg,omitempty"`
}
Blueprint is an imported egg.
type Coupon ¶
type Coupon struct {
ID string `json:"id"`
Code string `json:"code"`
Kind string `json:"kind"` // percent | fixed
Value int64 `json:"value"`
Recurring bool `json:"recurring"`
ProductIDs []string `json:"product_ids"`
MaxUses int `json:"max_uses"`
Uses int `json:"uses"`
ExpiresAt *time.Time `json:"expires_at"`
Active bool `json:"active"`
CreatedAt time.Time `json:"created_at"`
}
Coupon is a discount code.
type CreditTransaction ¶
type CreditTransaction struct {
ID string `json:"id"`
Amount int64 `json:"amount"`
Currency string `json:"currency"`
Reason string `json:"reason"` // admin, invoice, downgrade
Note string `json:"note"`
InvoiceID *string `json:"invoice_id"`
CreatedAt time.Time `json:"created_at"`
}
CreditTransaction is one movement of account credit.
type DNSZone ¶
type DNSZone struct {
ID string `json:"id"`
Name string `json:"name"`
OwnerID string `json:"owner_id"`
OwnerEmail string `json:"owner_email"`
Provider string `json:"provider"`
RemoteID string `json:"-"`
Nameservers []string `json:"nameservers"`
CreatedAt time.Time `json:"created_at"`
}
DNSZone is a zone hosted at the DNS provider.
type Extension ¶
type Extension struct {
ID string `json:"id"`
Name string `json:"name"`
Version string `json:"version"`
Manifest json.RawMessage `json:"manifest"`
Package []byte `json:"-"`
Signer string `json:"signer"`
Enabled bool `json:"enabled"`
Settings map[string]string `json:"-"`
LastError string `json:"last_error"`
LastErrorAt *time.Time `json:"last_error_at"`
InstalledAt time.Time `json:"installed_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Extension is an installed extension.
type ExtensionKV ¶
type ExtensionKV struct{ S *Store }
ExtensionKV implements extensions.KV on the database.
type Invoice ¶
type Invoice struct {
ID string `json:"id"`
Number string `json:"number"`
UserID string `json:"user_id"`
UserEmail string `json:"user_email"`
Status string `json:"status"`
Currency string `json:"currency"`
Total int64 `json:"total"`
DueAt time.Time `json:"due_at"`
PaidAt *time.Time `json:"paid_at"`
CreatedAt time.Time `json:"created_at"`
Items []InvoiceItem `json:"items,omitempty"`
}
Invoice is a bill with its items.
type InvoiceItem ¶
type InvoiceItem struct {
ID string `json:"id"`
SubscriptionID *string `json:"subscription_id"`
Kind string `json:"kind"`
Description string `json:"description"`
Amount int64 `json:"amount"`
PeriodStart *time.Time `json:"period_start"`
PeriodEnd *time.Time `json:"period_end"`
// Change is the plan change a "change" line applies once paid.
Change json.RawMessage `json:"-"`
}
InvoiceItem is one line of an invoice.
type MailDomain ¶
type MailDomain struct {
ID string `json:"id"`
Name string `json:"name"`
OwnerID string `json:"owner_id"`
OwnerEmail string `json:"owner_email"`
RemoteID string `json:"-"`
MaxMailboxes int `json:"max_mailboxes"`
MaxQuotaMB int `json:"max_quota_mb"`
Mailboxes int `json:"mailbox_count"`
CreatedAt time.Time `json:"created_at"`
}
MailDomain is an email domain hosted on the mail server.
type Mailbox ¶
type Mailbox struct {
ID string `json:"id"`
DomainID string `json:"domain_id"`
LocalPart string `json:"local_part"`
RemoteID string `json:"-"`
QuotaMB int `json:"quota_mb"`
Aliases []string `json:"aliases"`
CreatedAt time.Time `json:"created_at"`
}
Mailbox is one address with a login.
type NewOrder ¶
type NewOrder struct {
UserID, ProductID, PlanID, Name, Cycle string
Options map[string]int
MemoryMB, CPUPercent, DiskMB int
Amount, FirstTotal int64
Currency, Description string
// Coupon (optional): its use is counted in the order's transaction.
CouponID *string
Discount int64
DiscountDescription string
}
NewOrder is a checkout: the subscription to create and its first invoice line.
type NewService ¶
type NewService struct {
Name, OwnerID, NodeID, BlueprintID, AllocationID string
Image, Startup string
Variables map[string]string
MemoryMB, CPUPercent, DiskMB int
}
NewService holds the validated input for CreateService.
type NewWebsite ¶
type NewWebsite struct {
OwnerID, NodeID, Name, PHPVersion, Domain, TLS string
DiskMB, MemoryMB, CPUPercent, Processes int
MaxDomains, MaxDatabases int
}
NewWebsite is what is needed to create a website.
type Node ¶
type Node struct {
ID string `json:"id"`
Name string `json:"name"`
Address string `json:"address"`
Joined bool `json:"joined"`
CertExpiresAt *time.Time `json:"cert_expires_at"`
JoinExpiresAt *time.Time `json:"join_expires_at"`
AgentVersion string `json:"agent_version"`
Info json.RawMessage `json:"info"`
LastSeenAt *time.Time `json:"last_seen_at"`
CreatedAt time.Time `json:"created_at"`
}
Node is a machine running ammonode-agent.
type Passkey ¶
type Passkey struct {
ID string `json:"id"`
UserID string `json:"-"`
CredentialID []byte `json:"-"`
PublicKey []byte `json:"-"`
Alg int64 `json:"-"`
SignCount uint32 `json:"-"`
BackupEligible bool `json:"synced"`
Name string `json:"name"`
CreatedAt time.Time `json:"created_at"`
LastUsedAt *time.Time `json:"last_used_at"`
}
Passkey is a registered WebAuthn credential.
type Payment ¶
type Payment struct {
Gateway string `json:"gateway"`
Amount int64 `json:"amount"`
Currency string `json:"currency"`
CreatedAt time.Time `json:"created_at"`
}
Payment is money received for an invoice.
type PaymentHook ¶
PaymentHook runs inside RecordPayment's transaction when an invoice becomes paid (used to enqueue processing in the same transaction).
type Product ¶
type Product struct {
ID string `json:"id"`
Kind string `json:"kind"` // service | website | external
Name string `json:"name"`
Description string `json:"description"`
BlueprintID string `json:"blueprint_id"`
BlueprintName string `json:"blueprint_name"`
NodeIDs []string `json:"node_ids"`
Active bool `json:"active"`
Sort int `json:"sort"`
Plans []ProductPlan `json:"plans"`
Options []ProductOption `json:"options"`
CreatedAt time.Time `json:"created_at"`
// Provisioner is the extension that delivers an external product, with its settings.
Provisioner string `json:"provisioner"`
ProvisionerSettings map[string]string `json:"provisioner_settings"`
}
Product is something customers can buy, with its plans and options.
type ProductOption ¶
type ProductOption struct {
ID string `json:"id"`
Name string `json:"name"`
Resource string `json:"resource"`
Step int `json:"step"`
MaxSteps int `json:"max_steps"`
PriceMonthly int64 `json:"price_monthly"`
Sort int `json:"sort"`
}
ProductOption is a configurable extra.
type ProductPlan ¶
type ProductPlan struct {
ID string `json:"id"`
Name string `json:"name"`
MemoryMB int `json:"memory_mb"`
CPUPercent int `json:"cpu_percent"`
DiskMB int `json:"disk_mb"`
PriceMonthly int64 `json:"price_monthly"`
SetupFee int64 `json:"setup_fee"`
Sort int `json:"sort"`
// Website plans only.
MaxDomains int `json:"max_domains"`
MaxDatabases int `json:"max_databases"`
}
ProductPlan is a size of a product.
type ResellerLimits ¶
type ResellerLimits struct {
MaxCustomers int `json:"max_customers"`
MaxWebsites int `json:"max_websites"`
MaxDiskMB int `json:"max_disk_mb"`
MaxMemoryMB int `json:"max_memory_mb"`
MaxMailDomains int `json:"max_mail_domains"`
}
ResellerLimits cap what a reseller may hand out to their customers.
type ResellerUsage ¶
type ResellerUsage struct {
Customers int `json:"customers"`
Websites int `json:"websites"`
DiskMB int `json:"disk_mb"`
MemoryMB int `json:"memory_mb"`
MailDomains int `json:"mail_domains"`
}
ResellerUsage is what a reseller's customers use now.
type Service ¶
type Service struct {
ID string `json:"id"`
Name string `json:"name"`
OwnerID string `json:"owner_id"`
OwnerEmail string `json:"owner_email"`
NodeID string `json:"node_id"`
NodeName string `json:"node_name"`
NodeAddress string `json:"node_address"`
BlueprintID string `json:"blueprint_id"`
BlueprintName string `json:"blueprint_name"`
Features []string `json:"features"` // egg features, e.g. "eula"
AllocationID string `json:"allocation_id"`
IP string `json:"ip"`
Port int `json:"port"`
Image string `json:"image"`
Startup string `json:"startup"`
Variables map[string]string `json:"variables"`
MemoryMB int `json:"memory_mb"`
CPUPercent int `json:"cpu_percent"`
DiskMB int `json:"disk_mb"`
State string `json:"state"`
StateDetail string `json:"state_detail"`
StateAt time.Time `json:"state_at"`
SFTPPort int `json:"sftp_port"`
Suspended bool `json:"suspended"`
CreatedAt time.Time `json:"created_at"`
// SkipInstall: imported from another panel; the node adopts the existing files.
SkipInstall bool `json:"skip_install"`
}
Service is a game server or bot.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store runs queries against the panel database.
func (*Store) ActivateTheme ¶
ActivateTheme makes one theme active; an empty id goes back to the default.
func (*Store) ActiveTheme ¶
ActiveTheme returns the active theme (ErrNotFound = the built-in default).
func (*Store) AddPasskey ¶
AddPasskey stores a verified credential.
func (*Store) AddWebsiteCron ¶
AddWebsiteCron adds a cron job (at most 20 per website).
func (*Store) AddWebsiteDatabase ¶
func (s *Store) AddWebsiteDatabase(ctx context.Context, websiteID, name string) (WebsiteDatabase, error)
AddWebsiteDatabase records a database within the website's limit.
func (*Store) AddWebsiteDomain ¶
AddWebsiteDomain adds a domain within the website's limit.
func (*Store) AdjustCredit ¶
func (s *Store) AdjustCredit(ctx context.Context, userID string, amount int64, currency, reason, note string, by *string) (int64, error)
AdjustCredit adds (or with a negative amount removes) account credit and logs it.
func (*Store) ApplySubscriptionChange ¶
func (s *Store) ApplySubscriptionChange(ctx context.Context, sub Subscription, c SubscriptionChange, credit int64, note string) error
ApplySubscriptionChange resizes a subscription and its service (limits apply on the next start), and cancels an unpaid renewal so the next one is billed at the new price. A credit (downgrade refund) is added in the same transaction.
func (*Store) BlueprintExport ¶
func (s *Store) BlueprintExport(ctx context.Context, id string) (name string, raw []byte, err error)
BlueprintExport returns the egg export exactly as it was imported.
func (*Store) BlueprintRaw ¶
BlueprintRaw returns the stored egg export of a blueprint.
func (*Store) CancelOpenInvoices ¶
CancelOpenInvoices cancels a subscription's unpaid invoices (on termination).
func (*Store) ConsumeEmailToken ¶
func (s *Store) ConsumeEmailToken(ctx context.Context, tokenHash []byte, purpose string) (User, error)
ConsumeEmailToken deletes a valid token and returns its user. The link is only valid while the account still has the address it was sent to.
func (*Store) CountAdmins ¶
CountAdmins returns the number of admin accounts.
func (*Store) CouponByCode ¶
CouponByCode finds a coupon case-insensitively (whether usable or not).
func (*Store) CreateAllocations ¶
CreateAllocations adds ports on a node, skipping ones that already exist. It returns how many were added.
func (*Store) CreateChangeInvoice ¶
func (s *Store) CreateChangeInvoice(ctx context.Context, sub Subscription, c SubscriptionChange, amount int64, description string) (string, error)
CreateChangeInvoice bills an upgrade; the change is applied when the invoice is paid. Earlier unpaid change invoices of the subscription are cancelled.
func (*Store) CreateCustomer ¶
func (s *Store) CreateCustomer(ctx context.Context, email, name, passwordHash, locale string) (User, error)
CreateCustomer inserts a self sign-up whose email still has to be verified.
func (*Store) CreateDNSZone ¶
CreateDNSZone records a zone; ErrConflict when the name is taken.
func (*Store) CreateEmailToken ¶
func (s *Store) CreateEmailToken(ctx context.Context, tokenHash []byte, userID, purpose, email string, ttl time.Duration) error
CreateEmailToken stores the hash of a one-time link. Older links of the same purpose stop working, so only the newest email counts.
func (*Store) CreateMailDomain ¶
func (s *Store) CreateMailDomain(ctx context.Context, d MailDomain) (MailDomain, error)
CreateMailDomain records a hosted mail domain; ErrConflict when taken.
func (*Store) CreateMailbox ¶
CreateMailbox records a mailbox; ErrLimit when the domain is full (checked in the same statement).
func (*Store) CreateNode ¶
func (s *Store) CreateNode(ctx context.Context, name, address string, tokenHash []byte, tokenExpires time.Time) (Node, error)
CreateNode adds a node together with its first join token (stored as a hash).
func (*Store) CreateOrder ¶
CreateOrder stores a pending subscription and its first (unpaid) invoice.
func (*Store) CreateRenewal ¶
func (s *Store) CreateRenewal(ctx context.Context, sub Subscription, description string, periodStart, periodEnd time.Time) (string, error)
CreateRenewal adds an unpaid renewal invoice for the next period of a subscription.
func (*Store) CreateResellerCustomer ¶
func (s *Store) CreateResellerCustomer(ctx context.Context, resellerID, email, name, passwordHash string) (User, error)
CreateResellerCustomer creates a verified customer that belongs to a reseller. The customer limit is checked in the same statement.
func (*Store) CreateService ¶
CreateService inserts a service and claims its allocation in one transaction. ErrConflict means the allocation is taken or belongs to another node.
func (*Store) CreateSession ¶
func (s *Store) CreateSession(ctx context.Context, tokenHash []byte, userID, userAgent, ip string, expires time.Time) error
CreateSession stores a session for the token hash.
func (*Store) CreateUser ¶
func (s *Store) CreateUser(ctx context.Context, email, name, passwordHash string, isAdmin bool) (User, error)
CreateUser inserts a user with an already hashed password. Accounts created by an admin (or the CLI) count as verified.
func (*Store) CreateWebsite ¶
CreateWebsite creates a website with its primary domain.
func (*Store) CreditHistory ¶
CreditHistory returns the latest credit movements of a user.
func (*Store) DNSZoneByName ¶
DNSZoneByName loads a zone by its fully qualified name.
func (*Store) DeleteAllocation ¶
DeleteAllocation removes an unused allocation of a node.
func (*Store) DeleteBlueprint ¶
DeleteBlueprint removes a blueprint.
func (*Store) DeleteCoupon ¶
DeleteCoupon removes a coupon; subscriptions that used it keep their price.
func (*Store) DeleteDNSZone ¶
DeleteDNSZone removes a zone record.
func (*Store) DeleteExtension ¶
DeleteExtension removes an extension and its stored data.
func (*Store) DeleteMailDomain ¶
DeleteMailDomain removes a domain and its mailboxes.
func (*Store) DeleteMailbox ¶
DeleteMailbox removes a mailbox record.
func (*Store) DeleteNode ¶
DeleteNode removes a node; its certificate stops being accepted immediately.
func (*Store) DeletePasskey ¶
DeletePasskey removes one of the user's passkeys.
func (*Store) DeleteProduct ¶
DeleteProduct removes a product (ErrInUse while subscriptions reference it).
func (*Store) DeleteService ¶
DeleteService removes a service and frees its allocation.
func (*Store) DeleteSession ¶
DeleteSession signs a session out.
func (*Store) DeleteTheme ¶
DeleteTheme removes a theme (the default takes over if it was active).
func (*Store) DeleteWebsite ¶
DeleteWebsite removes a website record.
func (*Store) DeleteWebsiteCron ¶
DeleteWebsiteCron removes a cron job.
func (*Store) DeleteWebsiteDatabase ¶
DeleteWebsiteDatabase forgets a database and returns its name.
func (*Store) DeleteWebsiteDomain ¶
DeleteWebsiteDomain removes a domain (never the last one).
func (*Store) DisableTOTP ¶
DisableTOTP turns 2FA off and forgets the recovery codes.
func (*Store) DomainGitHook ¶
func (s *Store) DomainGitHook(ctx context.Context, domainID string, tokenHash []byte) (websiteID string, d WebsiteDomain, err error)
DomainGitHook finds the website of a domain whose push-to-deploy secret matches.
func (*Store) DomainTaken ¶
DomainTaken reports whether a host name is used by a website (as domain or alias).
func (*Store) EnableTOTP ¶
func (s *Store) EnableTOTP(ctx context.Context, id string, step int64, recoveryHashes [][]byte) error
EnableTOTP activates the pending secret and replaces the recovery codes.
func (*Store) FindFreeAllocation ¶
func (s *Store) FindFreeAllocation(ctx context.Context, nodeIDs []string, skip []string) (allocID, nodeID string, err error)
FindFreeAllocation picks a free allocation on one of nodeIDs (any node when empty), preferring nodes that run the fewest services.
func (*Store) GetBlueprint ¶
GetBlueprint returns one blueprint including the normalised egg.
func (*Store) GetDNSZone ¶
GetDNSZone loads one zone.
func (*Store) GetExtension ¶
GetExtension returns one extension with its package.
func (*Store) GetInvoice ¶
GetInvoice returns an invoice with its items.
func (*Store) GetMailDomain ¶
GetMailDomain loads one domain.
func (*Store) GetMailbox ¶
GetMailbox loads a mailbox of a domain.
func (*Store) GetProduct ¶
GetProduct returns one product.
func (*Store) GetResellerLimits ¶
GetResellerLimits loads a reseller's limits.
func (*Store) GetService ¶
GetService returns one service.
func (*Store) GetSetting ¶
GetSetting decodes a setting into out; ErrNotFound if it was never saved.
func (*Store) GetSubscription ¶
GetSubscription returns one subscription.
func (*Store) GetWebsite ¶
GetWebsite returns a website with its domains, databases and cron jobs.
func (*Store) ImportBlueprint ¶
func (s *Store) ImportBlueprint(ctx context.Context, raw []byte, e *egg.Egg, warnings []egg.Warning, sourceURL string) (b Blueprint, created bool, err error)
ImportBlueprint stores an egg export that egg.Parse accepted. Importing the exact same bytes again returns the existing blueprint with created == false, refreshing its normalised egg and warnings so improvements to pkg/egg reach eggs imported earlier. sourceURL records where the file came from (empty for uploads).
func (*Store) ListAllocations ¶
ListAllocations returns a node's allocations ordered by IP and port.
func (*Store) ListBlueprints ¶
ListBlueprints returns every blueprint ordered by name, without the egg body.
func (*Store) ListCoupons ¶
ListCoupons returns every coupon, newest first.
func (*Store) ListDNSZones ¶
ListDNSZones lists zones of an owner ("" = all).
func (*Store) ListExtensions ¶
ListExtensions returns installed extensions (without their packages).
func (*Store) ListInvoices ¶
ListInvoices returns a user's invoices, or all when userID is empty.
func (*Store) ListMailDomains ¶
ListMailDomains lists domains of an owner ("" = all).
func (*Store) ListMailboxes ¶
ListMailboxes lists a domain's mailboxes.
func (*Store) ListPasskeys ¶
ListPasskeys returns a user's passkeys.
func (*Store) ListPayments ¶
ListPayments returns an invoice's payments, oldest first.
func (*Store) ListProducts ¶
ListProducts returns products (only active ones when activeOnly) with plans and options.
func (*Store) ListResellerCustomers ¶
ListResellerCustomers lists a reseller's customers.
func (*Store) ListServices ¶
ListServices returns services, optionally only those owned by ownerID or placed on nodeID.
func (*Store) ListSubscriptions ¶
ListSubscriptions returns a user's subscriptions, or all when userID is empty.
func (*Store) ListThemes ¶
ListThemes returns every theme.
func (*Store) ListUsers ¶
func (s *Store) ListUsers(ctx context.Context) ([]UserSummary, error)
ListUsers returns all users ordered by email.
func (*Store) ListWebsites ¶
ListWebsites returns websites of an owner ("" = all), optionally on one node.
func (*Store) ListWebsitesOfReseller ¶
ListWebsitesOfReseller lists the websites of a reseller's customers.
func (*Store) LoadOrCreateCA ¶
func (s *Store) LoadOrCreateCA(ctx context.Context, create func() (certPEM, keyPEM []byte, err error)) (certPEM, keyPEM []byte, err error)
LoadOrCreateCA returns the stored CA PEMs, creating them with create on first use. Concurrent first starts are safe: only one row can win, and everyone reads it back.
func (*Store) MailDomainByName ¶
MailDomainByName loads a domain by name.
func (*Store) MailNameTaken ¶
func (s *Store) MailNameTaken(ctx context.Context, domainID, local, exceptMailbox string) (bool, error)
MailNameTaken reports whether a local part is used as a mailbox or alias in a domain.
func (*Store) NodeByCert ¶
NodeByCert finds the node a client certificate belongs to.
func (*Store) OpenRenewal ¶
func (s *Store) OpenRenewal(ctx context.Context, subID string, periodStart time.Time) (string, error)
OpenRenewal returns the unpaid renewal invoice for a subscription period, if any.
func (*Store) PasskeyByCredential ¶
PasskeyByCredential finds a passkey by its credential ID.
func (*Store) PasskeyUsed ¶
PasskeyUsed records a sign-in. The counter only moves forward (conditional update), so two parallel uses of the same assertion cannot both succeed.
func (*Store) PayWithCredit ¶
func (s *Store) PayWithCredit(ctx context.Context, invoiceID, userID string, onPaid PaymentHook) error
PayWithCredit pays a whole unpaid invoice from the owner's credit, atomically.
func (*Store) PutSetting ¶
PutSetting stores a setting.
func (*Store) RecordNodeHello ¶
func (s *Store) RecordNodeHello(ctx context.Context, id, agentVersion string, info json.RawMessage) error
RecordNodeHello stores what the agent reported when it connected.
func (*Store) RecordPayment ¶
func (s *Store) RecordPayment(ctx context.Context, invoiceID, gateway, ref string, amount int64, currency, note string, onPaid PaymentHook) (bool, error)
RecordPayment stores a payment idempotently: the same (gateway, ref) is recorded once. It marks the invoice paid when the amount covers it and reports whether this call did so.
func (*Store) RecoveryCodesLeft ¶
RecoveryCodesLeft counts unused recovery codes.
func (*Store) RedeemJoinToken ¶
func (s *Store) RedeemJoinToken(ctx context.Context, tokenHash []byte, sign func(nodeID string) (fingerprint []byte, expires time.Time, err error)) (Node, error)
RedeemJoinToken consumes a join token. sign is called inside the transaction with the node ID and must return the issued certificate's fingerprint and expiry; the token is cleared and the fingerprint replaces any previous certificate (revoking it).
func (*Store) RemoveReseller ¶
RemoveReseller ends reseller status; their customers become normal customers.
func (*Store) RenewNodeCert ¶
func (s *Store) RenewNodeCert(ctx context.Context, nodeID string, fingerprint []byte, expires time.Time, grace time.Duration) error
RenewNodeCert installs a renewed certificate. The previous one keeps working for grace, in case the agent fails to store the new one.
func (*Store) ResellerUsage ¶
func (s *Store) ResellerUsage(ctx context.Context, resellerID, exceptWebsite string) (ResellerUsage, error)
ResellerUsage sums the resources of a reseller's customers (websites except one, when a website is being resized).
func (*Store) SaveCoupon ¶
SaveCoupon creates (empty ID) or updates a coupon. Uses are never changed here.
func (*Store) SaveExtension ¶
SaveExtension installs or updates an extension. An update keeps enabled and settings.
func (*Store) SaveProduct ¶
SaveProduct creates (empty ID) or replaces a product with its plans and options in one transaction. Plans and options keep their IDs; ones missing from p are deleted, which fails with ErrInUse while subscriptions use them.
func (*Store) ServiceOnNodeBySuffix ¶
ServiceOnNodeBySuffix finds a service on a node by the last 8 characters of its ID (the suffix in SFTP usernames).
func (*Store) SessionUser ¶
SessionUser returns the user of a live session and refreshes its last-seen time (at most once a minute, to avoid a write on every request).
func (*Store) SetCancelAtPeriodEnd ¶
SetCancelAtPeriodEnd asks for (or withdraws) cancellation at the next due date. Asking cancels an unpaid renewal invoice.
func (*Store) SetEmailVerified ¶
SetEmailVerified marks the user's current address as verified.
func (*Store) SetExtensionEnabled ¶
SetExtensionEnabled turns an extension on or off.
func (*Store) SetExtensionError ¶
SetExtensionError records the latest failure ("" clears it).
func (*Store) SetExtensionSettings ¶
func (s *Store) SetExtensionSettings(ctx context.Context, id string, settings map[string]string) error
SetExtensionSettings stores the admin's settings.
func (*Store) SetJoinToken ¶
func (s *Store) SetJoinToken(ctx context.Context, id string, tokenHash []byte, expires time.Time) (Node, error)
SetJoinToken issues a new join token for a node (e.g. to re-install the agent). The current certificate keeps working until the new token is used.
func (*Store) SetPassword ¶
SetPassword replaces a user's password hash and signs out all their sessions.
func (*Store) SetPendingTOTP ¶
SetPendingTOTP stores a secret being set up (2FA is not active until EnableTOTP).
func (*Store) SetReseller ¶
SetReseller makes a user a reseller with limits (or updates them).
func (*Store) SetServiceState ¶
SetServiceState records a state reported by the agent (or set by the panel).
func (*Store) SetServiceStateOnNode ¶
SetServiceStateOnNode records a state reported by a node's agent; services on other nodes are ignored (ErrNotFound), so an agent can only update its own services.
func (*Store) SetServiceSuspended ¶
SetServiceSuspended flags a service as suspended for billing (or lifts it).
func (*Store) SetSubscriptionExternal ¶
func (s *Store) SetSubscriptionExternal(ctx context.Context, id, externalID string, info json.RawMessage) error
SetSubscriptionExternal stores what a provisioner created.
func (*Store) SetSubscriptionStatus ¶
func (s *Store) SetSubscriptionStatus(ctx context.Context, id, status, note string, serviceID *string, nextDue *time.Time) error
SetSubscriptionStatus updates status and note (and the service / due date when given).
func (*Store) SetSubscriptionWebsite ¶
func (s *Store) SetSubscriptionWebsite(ctx context.Context, id, websiteID string, nextDue time.Time) error
SetSubscriptionWebsite links a provisioned website and activates the subscription.
func (*Store) SetWebsiteDomainGit ¶
func (s *Store) SetWebsiteDomainGit(ctx context.Context, websiteID, domainID, repo, branch string, tokenHash []byte) error
SetWebsiteDomainGit stores a domain's Git source; tokenHash nil keeps the webhook secret.
func (*Store) SetWebsiteState ¶
func (s *Store) SetWebsiteState(ctx context.Context, id, state, detail string, diskBytes int64) error
SetWebsiteState records the node's answer.
func (*Store) SetWebsiteSuspended ¶
SetWebsiteSuspended suspends or resumes a website.
func (*Store) SubscriptionForService ¶
SubscriptionForService finds the subscription that owns a service, if any.
func (*Store) SubscriptionsDue ¶
SubscriptionsDue lists active or suspended subscriptions whose due date is before t, plus pending ones whose first invoice is paid (waiting for capacity).
func (*Store) UpdateBlueprint ¶
func (s *Store) UpdateBlueprint(ctx context.Context, id string, raw []byte, e *egg.Egg, warnings []egg.Warning) (Blueprint, error)
UpdateBlueprint replaces a blueprint's egg in place (services use it from their next start or reinstall). The previous file is not kept.
func (*Store) UpdateMailDomainLimits ¶
func (s *Store) UpdateMailDomainLimits(ctx context.Context, id string, maxMailboxes, maxQuotaMB int) error
UpdateMailDomainLimits changes a domain's limits (admins).
func (*Store) UpdateMailbox ¶
UpdateMailbox stores quota and aliases.
func (*Store) UpdateNode ¶
UpdateNode changes the editable fields.
func (*Store) UpdatePasswordHash ¶
UpdatePasswordHash replaces a hash with an equivalent one (same password, newer algorithm) without signing anyone out. It only applies while the old hash is current.
func (*Store) UpdateServiceSettings ¶
func (s *Store) UpdateServiceSettings(ctx context.Context, id, name string, memoryMB, cpuPercent, diskMB int) error
UpdateServiceSettings changes the name and resource limits (admin).
func (*Store) UpdateServiceStartup ¶
func (s *Store) UpdateServiceStartup(ctx context.Context, id, image string, vars map[string]string) error
UpdateServiceStartup stores a new image and variable values.
func (*Store) UpdateWebsiteDomain ¶
UpdateWebsiteDomain changes a domain's aliases, document root and TLS mode.
func (*Store) UpdateWebsiteLimits ¶
UpdateWebsiteLimits sets the resources and plan limits.
func (*Store) UpdateWebsitePHP ¶
func (s *Store) UpdateWebsitePHP(ctx context.Context, id, version string, php map[string]string) error
UpdateWebsitePHP sets the PHP version and php.ini overrides.
func (*Store) UseRecoveryCode ¶
UseRecoveryCode consumes a recovery code; false if it does not exist (or was used).
func (*Store) UseTOTPStep ¶
UseTOTPStep records an accepted time step; false if it (or a later one) was used already, which stops two concurrent logins from using the same code.
func (*Store) UserByEmail ¶
UserByEmail looks a user up case-insensitively.
func (*Store) UserByWebAuthnID ¶
UserByWebAuthnID finds the user of a WebAuthn handle.
func (*Store) WebAuthnID ¶
WebAuthnID returns the user's opaque WebAuthn handle, creating it on first use.
type Subscription ¶
type Subscription struct {
ID string `json:"id"`
UserID string `json:"user_id"`
UserEmail string `json:"user_email"`
ProductID string `json:"product_id"`
ProductName string `json:"product_name"`
PlanID string `json:"plan_id"`
PlanName string `json:"plan_name"`
Name string `json:"name"`
Cycle string `json:"cycle"`
Options map[string]int `json:"options"`
MemoryMB int `json:"memory_mb"`
CPUPercent int `json:"cpu_percent"`
DiskMB int `json:"disk_mb"`
Amount int64 `json:"amount"`
Currency string `json:"currency"`
Status string `json:"status"`
StatusNote string `json:"status_note"`
ServiceID *string `json:"service_id"`
NextDueAt *time.Time `json:"next_due_at"`
CreatedAt time.Time `json:"created_at"`
CouponID *string `json:"coupon_id"`
WebsiteID *string `json:"website_id"`
ProductKind string `json:"product_kind"`
// CancelAtPeriodEnd: no renewal; the service is removed at the next due date.
CancelAtPeriodEnd bool `json:"cancel_at_period_end"`
// ExternalID / ExternalInfo: what a provisioner extension created for an external product.
ExternalID string `json:"-"`
ExternalInfo json.RawMessage `json:"external_info"`
}
Subscription is a customer's purchase.
type SubscriptionChange ¶
type SubscriptionChange struct {
PlanID string `json:"plan_id"`
Options map[string]int `json:"options"`
MemoryMB int `json:"memory_mb"`
CPUPercent int `json:"cpu_percent"`
DiskMB int `json:"disk_mb"`
Amount int64 `json:"amount"`
}
SubscriptionChange is a new size for a subscription (plan + options) and its new price.
type Theme ¶
type Theme struct {
ID string `json:"id"`
Name string `json:"name"`
Tokens json.RawMessage `json:"tokens"`
CSS string `json:"css"`
Active bool `json:"active"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Theme is a set of design tokens and custom CSS.
type User ¶
type User struct {
ID string `json:"id"`
Email string `json:"email"`
Name string `json:"name"`
IsAdmin bool `json:"is_admin"`
CreatedAt time.Time `json:"created_at"`
PasswordHash string `json:"-"`
// TwoFactor is true once TOTP is enabled.
TwoFactor bool `json:"two_factor"`
TOTPSecret []byte `json:"-"`
TOTPPending []byte `json:"-"`
TOTPLastStep int64 `json:"-"`
// EmailVerified is false for self sign-ups until they follow the emailed link.
EmailVerified bool `json:"email_verified"`
Locale string `json:"locale"`
// Credit is the account balance in the panel currency.
Credit int64 `json:"credit"`
// IsReseller: the user creates and manages their own customers.
IsReseller bool `json:"is_reseller"`
// ResellerID is the reseller this customer belongs to.
ResellerID *string `json:"reseller_id"`
}
User is an account. PasswordHash never leaves the server.
type UserSummary ¶
UserSummary is a user with the number of services they own.
type Website ¶
type Website struct {
ID string `json:"id"`
OwnerID string `json:"owner_id"`
OwnerEmail string `json:"owner_email"`
NodeID string `json:"node_id"`
NodeName string `json:"node_name"`
NodeAddress string `json:"node_address"`
Name string `json:"name"`
Username string `json:"username"`
PHPVersion string `json:"php_version"`
PHP map[string]string `json:"php"`
DiskMB int `json:"disk_mb"`
MemoryMB int `json:"memory_mb"`
CPUPercent int `json:"cpu_percent"`
Processes int `json:"processes"`
MaxDomains int `json:"max_domains"`
MaxDatabases int `json:"max_databases"`
BackupsKeep int `json:"backups_keep"`
State string `json:"state"`
StateDetail string `json:"state_detail"`
Suspended bool `json:"suspended"`
DiskBytes int64 `json:"disk_bytes"`
CreatedAt time.Time `json:"created_at"`
Domains []WebsiteDomain `json:"domains"`
Databases []WebsiteDatabase `json:"databases"`
Cron []WebsiteCron `json:"cron"`
}
Website is a hosting account on a node.
type WebsiteCron ¶
type WebsiteCron struct {
ID string `json:"id"`
Schedule string `json:"schedule"`
Command string `json:"command"`
CreatedAt time.Time `json:"created_at"`
}
WebsiteCron is a cron job.
type WebsiteDatabase ¶
type WebsiteDatabase struct {
ID string `json:"id"`
Name string `json:"name"`
CreatedAt time.Time `json:"created_at"`
}
WebsiteDatabase is a MariaDB database of a website.
type WebsiteDomain ¶
type WebsiteDomain struct {
ID string `json:"id"`
Name string `json:"name"`
Aliases []string `json:"aliases"`
Root string `json:"root"`
TLS string `json:"tls"`
GitRepo string `json:"git_repo"`
GitBranch string `json:"git_branch"`
GitHook bool `json:"git_hook"` // a push-to-deploy secret exists
CreatedAt time.Time `json:"created_at"`
}
WebsiteDomain is a site of a website.
type WebsiteLimits ¶
type WebsiteLimits struct {
Name string
DiskMB, MemoryMB, CPUPercent, Processes int
MaxDomains, MaxDatabases, BackupsKeep int
}
WebsiteLimits are the resources of a website.