Files
vHost/backend/internal/store/models.go
T

346 lines
13 KiB
Go

package store
import "time"
type User struct {
Impersonating bool `json:"impersonating,omitempty"`
ImpersonationExpiresAt *time.Time `json:"impersonationExpiresAt,omitempty"`
ID uint64 `json:"id"`
TenantID *uint64 `json:"tenantId,omitempty"`
ProjectID *uint64 `json:"projectId,omitempty"`
LoginName string `json:"loginName"`
Email string `json:"email,omitempty"`
DisplayName string `json:"displayName"`
PasswordHash string `json:"-"`
Role string `json:"role"`
TenantName string `json:"tenantName,omitempty"`
TenantSlug string `json:"tenantSlug,omitempty"`
MFAEnabled bool `json:"mfaEnabled"`
}
type UserSecurity struct {
PasswordHash string
TOTPSecretCiphertext []byte
TOTPEnabled bool
}
type Plan struct {
DeleteBlockedReason string `json:"deleteBlockedReason,omitempty"`
ID uint64 `json:"id"`
Name string `json:"name"`
StorageBytes uint64 `json:"storageBytes"`
DatabaseBytes uint64 `json:"databaseBytes"`
BandwidthBytes uint64 `json:"bandwidthBytes"`
BandwidthMbps uint32 `json:"bandwidthMbps"`
ProcessLimit uint32 `json:"processLimit"`
FTPLimit uint32 `json:"ftpLimit"`
DatabaseLimit uint32 `json:"databaseLimit"`
ProjectLimit uint32 `json:"projectLimit"`
CreatedAt time.Time `json:"createdAt"`
}
type NewPlan struct {
Name string
StorageBytes, DatabaseBytes, BandwidthBytes uint64
ProcessLimit, FTPLimit, DatabaseLimit, ProjectLimit uint32
BandwidthMbps uint32
}
type ResourceCounts struct {
FTP, Databases uint32
}
type Usage struct {
StorageBytes uint64 `json:"storageBytes"`
DatabaseBytes uint64 `json:"databaseBytes"`
BandwidthBytes uint64 `json:"bandwidthBytes"`
ProcessCount uint32 `json:"processCount"`
MeasuredAt time.Time `json:"measuredAt"`
}
type Project struct {
AllowRuntimeChange bool `json:"allowRuntimeChange"`
BandwidthBytes uint64 `json:"bandwidthBytes"`
NodeID uint64 `json:"nodeId"`
PlanID uint64 `json:"planId"`
ID uint64 `json:"id"`
TenantID uint64 `json:"-"`
HostName string `json:"hostName"`
Slug string `json:"name"`
Domain string `json:"domain"`
Path string `json:"path"`
RunPath string `json:"runPath"`
Runtime string `json:"runtime"`
Version string `json:"version"`
Status string `json:"status"`
SSLStatus string `json:"sslStatus"`
PanelSiteID int64 `json:"-"`
BackendPort int `json:"backendPort"`
ProcessLimit int `json:"processLimit"`
AutoSSL bool `json:"autoSSL"`
CreatedAt time.Time `json:"createdAt"`
}
type Site struct {
ID uint64 `json:"id"`
TenantID uint64 `json:"-"`
ProjectID uint64 `json:"projectId"`
Name string `json:"name"`
Domain string `json:"domain"`
RunPath string `json:"runPath"`
Runtime string `json:"runtime"`
Version string `json:"version"`
Status string `json:"status"`
SSLStatus string `json:"sslStatus"`
PanelSiteID int64 `json:"-"`
BackendPort int `json:"backendPort"`
ProcessLimit int `json:"processLimit"`
AutoSSL bool `json:"autoSSL"`
Primary bool `json:"primary"`
CreatedAt time.Time `json:"createdAt"`
}
// DNSCredential is safe to return through the API. CredentialCiphertext and
// SecretRef are deliberately excluded from JSON and only used by the issuance
// service after an ownership-scoped database lookup.
type DNSCredential struct {
ID uint64 `json:"id"`
TenantID *uint64 `json:"-"`
ScopeKey string `json:"scope"`
SecretRef string `json:"-"`
Label string `json:"label"`
Provider string `json:"provider"`
ZoneName string `json:"zoneName"`
CredentialCiphertext []byte `json:"-"`
LastTestedAt *time.Time `json:"lastTestedAt,omitempty"`
TestStatus string `json:"testStatus"`
TestError string `json:"testError,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
type NewDNSCredential struct {
TenantID *uint64
ScopeKey string
SecretRef string
Label string
Provider string
ZoneName string
CredentialCiphertext []byte
}
type CertificateAutomation struct {
SiteID uint64 `json:"siteId"`
Mode string `json:"mode"`
ExpiresAt *time.Time `json:"expiresAt,omitempty"`
LastAttemptAt *time.Time `json:"lastAttemptAt,omitempty"`
NextAttemptAt *time.Time `json:"nextAttemptAt,omitempty"`
LastError string `json:"lastError,omitempty"`
}
type CertificateRenewal struct {
Project Project
Site Site
}
type DomainResource struct {
ID uint64 `json:"id"`
TenantID uint64 `json:"-"`
ProjectID uint64 `json:"projectId"`
SiteID uint64 `json:"siteId"`
TenantName string `json:"tenantName,omitempty"`
HostName string `json:"hostName"`
ProjectName string `json:"projectName"`
SiteName string `json:"siteName"`
Domain string `json:"domain"`
Kind string `json:"kind"`
Status string `json:"status"`
ResolutionMode string `json:"resolutionMode"`
CNAME string `json:"cnameTarget,omitempty"`
DNSCredentialID *uint64 `json:"dnsCredentialId,omitempty"`
DNSRecordID string `json:"dnsRecordId,omitempty"`
DNSRecordType string `json:"dnsRecordType,omitempty"`
DNSLastError string `json:"dnsLastError,omitempty"`
FilingStatus string `json:"filingStatus"`
FilingNumber string `json:"filingNumber,omitempty"`
FilingNote string `json:"filingNote,omitempty"`
SSLStatus string `json:"sslStatus"`
PanelSiteID int64 `json:"-"`
SiteAssignedDomain string `json:"-"`
RootPath string `json:"-"`
AutoSSL bool `json:"-"`
CreatedAt time.Time `json:"createdAt"`
}
type FTPResource struct {
Enabled bool `json:"enabled"`
ID uint64 `json:"id"`
TenantID uint64 `json:"-"`
PanelID int64 `json:"-"`
ProjectID uint64 `json:"projectId"`
HostName string `json:"hostName"`
ProjectName string `json:"projectName"`
Username string `json:"username"`
RootPath string `json:"rootPath"`
CreatedAt time.Time `json:"createdAt"`
}
type DatabaseResource struct {
ID uint64 `json:"id"`
TenantID uint64 `json:"-"`
PanelID int64 `json:"-"`
ProjectID uint64 `json:"projectId"`
HostName string `json:"hostName"`
ProjectName string `json:"projectName"`
Name string `json:"name"`
Username string `json:"username"`
SizeBytes uint64 `json:"sizeBytes"`
Status string `json:"status"`
CreatedAt time.Time `json:"createdAt"`
}
type NewSite struct {
TenantID, ProjectID uint64
Name, Domain, RunPath, Runtime string
Version string
BackendPort, ProcessLimit int
AutoSSL, Primary bool
}
type StoredCredentials struct {
FTPUsername, DatabaseName, DatabaseUsername string
FTPPasswordCipher, DatabasePasswordCipher []byte
}
type NewProject struct {
OwnerTenantID *uint64
OwnershipSpecified bool
NodeID, PlanID uint64
TenantID uint64
HostName, Slug, Runtime, Version, Path, RunPath, Domain string
BackendPort, ProcessLimit int
AutoSSL bool
HostPasswordHash string
}
type Activity struct {
ID uint64 `json:"id"`
ProjectID *uint64 `json:"projectId,omitempty"`
HostName string `json:"hostName,omitempty"`
Actor string `json:"actor"`
IPAddress string `json:"ipAddress,omitempty"`
Action string `json:"action"`
ResourceType string `json:"resourceType"`
Detail string `json:"detail"`
Success bool `json:"success"`
CreatedAt time.Time `json:"createdAt"`
}
type TenantSummary struct {
ID uint64 `json:"id"`
Slug string `json:"slug"`
Name string `json:"name"`
Status string `json:"status"`
LifecycleState string `json:"lifecycleState"`
PlanName string `json:"planName"`
UserCount int `json:"userCount"`
ProjectCount int `json:"projectCount"`
ExpiresAt *time.Time `json:"expiresAt,omitempty"`
GraceUntil *time.Time `json:"graceUntil,omitempty"`
PurgeAfter *time.Time `json:"purgeAfter,omitempty"`
BackupPurgeAfter *time.Time `json:"backupPurgeAfter,omitempty"`
CreatedAt time.Time `json:"createdAt"`
}
type AdminProject struct {
ManualRecycledAt *time.Time `json:"manualRecycledAt,omitempty"`
PurgeAfter *time.Time `json:"purgeAfter,omitempty"`
RecycleError string `json:"recycleError,omitempty"`
PendingOwnership *OwnershipChange `json:"pendingOwnership,omitempty"`
OwnerTenantID *uint64 `json:"ownerTenantId"`
ManagementLocked bool `json:"managementLocked"`
OwnershipVersion uint64 `json:"ownershipVersion"`
ExpiresAt *time.Time `json:"expiresAt,omitempty"`
LifecycleState string `json:"lifecycleState"`
Project
TenantName string `json:"tenantName"`
SiteCount int `json:"siteCount"`
IPAddress string `json:"ipAddress,omitempty"`
DedicatedIP bool `json:"dedicatedIp"`
HTTPPort int `json:"httpPort"`
HTTPSPort int `json:"httpsPort"`
}
type IPAddress struct {
NodeID uint64 `json:"nodeId"`
ID uint64 `json:"id"`
Address string `json:"address"`
Family string `json:"family"`
AllocationMode string `json:"allocationMode"`
Label string `json:"label"`
Enabled bool `json:"enabled"`
AssignedSites int `json:"assignedSites"`
CreatedAt time.Time `json:"createdAt"`
}
type AdminActivity struct {
AdministratorID *uint64 `json:"administratorId,omitempty"`
ImpersonatedUserID *uint64 `json:"impersonatedUserId,omitempty"`
ImpersonatedUserName string `json:"impersonatedUserName,omitempty"`
ID uint64 `json:"id"`
TenantName string `json:"userName,omitempty"`
Action string `json:"action"`
ResourceType string `json:"resourceType"`
ResourceID string `json:"resourceId,omitempty"`
IPAddress string `json:"ipAddress,omitempty"`
Success bool `json:"success"`
Detail string `json:"detail"`
CreatedAt time.Time `json:"createdAt"`
}
type NewTenant struct {
Slug, Name, Email, DisplayName, Password string
PlanID uint64
ExpiresAt *time.Time
}
type TenantBackup struct {
NodeID uint64 `json:"nodeId"`
ID uint64 `json:"id"`
TenantID uint64 `json:"tenantId"`
ProjectID *uint64 `json:"projectId,omitempty"`
HostName string `json:"hostName"`
ArchivePath string `json:"-"`
SizeBytes uint64 `json:"sizeBytes"`
ExpiresAt time.Time `json:"expiresAt"`
DeletedAt *time.Time `json:"deletedAt,omitempty"`
CreatedAt time.Time `json:"createdAt"`
}
type AdminNotification struct {
ID uint64
Severity string
Category string
Title string
Detail string
Attempts uint32
NextAttemptAt *time.Time
}
type OIDCState struct {
SessionHash []byte
ProviderKey string
UserID *uint64
Mode string
Verifier string
Nonce string
Expires time.Time
}
type OIDCIdentity struct {
Provider string `json:"provider"`
Subject string `json:"-"`
Email string `json:"email"`
Created time.Time `json:"createdAt"`
}