Documentation
¶
Index ¶
- Constants
- func NewContextWithUser(ctx context.Context, user *User) context.Context
- type Cluster
- type Database
- type Deployment
- type DeploymentInstance
- type DeploymentInstanceParameter
- type DeploymentInstanceParameters
- type ExternalDownload
- type Group
- type KubernetesResource
- type Lock
- type ParameterProvider
- type ParameterProviderFunc
- type ParameterProviders
- type RequireCompanionFunc
- type Stack
- type StackParameter
- type StackParameters
- type User
Constants ¶
View Source
const ( DeploymentResource = KubernetesResource("deployment") StatefulSetResource = KubernetesResource("statefulSet") )
View Source
const AdministratorGroupName = "administrators"
View Source
const DefaultGroupName = "whoami"
Variables ¶
This section is empty.
Functions ¶
func NewContextWithUser ¶
NewContextWithUser returns a new context.Context that carries value user.
Types ¶
type Cluster ¶
type Cluster struct {
// required: true
ID uint `json:"id" gorm:"primaryKey"`
// required: true
CreatedAt time.Time `json:"createdAt"`
// required: true
UpdatedAt time.Time `json:"updatedAt"`
// required: true
Name string `json:"name" gorm:"uniqueIndex"`
// required: true
Description string `json:"description"`
// required: true
Autoscaled bool `json:"autoscaled"`
Configuration []byte `json:"-"`
Groups []Group `json:"groups,omitempty" gorm:"constraint:OnUpdate:CASCADE"`
}
Cluster domain object defining a cluster swagger:model
type Database ¶
type Database struct {
ID uint `json:"id" gorm:"primaryKey"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Name string `json:"name" gorm:"index:database_name_group_idx,unique"`
GroupName string `json:"groupName" gorm:"index:database_name_group_idx,unique"`
Description string `json:"description" gorm:"type:text"`
Url string `json:"url"` // s3... Path?
ExternalDownloads []ExternalDownload `json:"externalDownloads" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
Lock *Lock `json:"lock" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
Slug string `json:"slug" gorm:"uniqueIndex"`
Type string `json:"type"` // TODO: Strictly sql or fs?
FilestoreID uint `json:"filestoreId"`
Filestore *Database `json:"filestore" gorm:"foreignKey:ID"`
UserID uint `json:"userId"`
User User `json:"user"`
Size int64 `json:"size"`
}
swagger:model
type Deployment ¶
type Deployment struct {
ID uint `json:"id" gorm:"primaryKey"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
UserID uint `json:"userId"`
User *User `json:"user,omitempty"`
Name string `json:"name" gorm:"index:deployment_name_group_idx,unique"`
Description string `json:"description"`
GroupName string `json:"groupName" gorm:"index:deployment_name_group_idx,unique; references:Name"`
Group *Group `json:"group,omitempty"`
TTL uint `json:"ttl"`
Instances []*DeploymentInstance `json:"instances" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}
type DeploymentInstance ¶
type DeploymentInstance struct {
ID uint `json:"id" gorm:"primaryKey"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
// TODO: FK to name of Deployment?
Name string `json:"name" gorm:"index:deployment_instance_name_group_stack_idx,unique"`
Group *Group `json:"group,omitempty"`
GroupName string `json:"groupName" gorm:"index:deployment_instance_name_group_stack_idx,unique; references:Name"`
// Stack *Stack `json:"stack,omitempty"`
StackName string `json:"stackName" gorm:"index:deployment_instance_name_group_stack_idx,unique"`
Lock *Lock `gorm:"foreignKey:InstanceID"`
DeploymentID uint `json:"deploymentId"`
Deployment *Deployment `json:"deployment,omitempty"`
GormParameters []DeploymentInstanceParameter `json:"-" gorm:"foreignKey:DeploymentInstanceID; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
Parameters DeploymentInstanceParameters `json:"parameters" gorm:"-:all"`
Public bool `json:"public"`
DeployLog string `json:"deployLog" gorm:"type:text"`
}
func (*DeploymentInstance) BeforeSave ¶
func (i *DeploymentInstance) BeforeSave(_ *gorm.DB) error
type DeploymentInstanceParameters ¶
type DeploymentInstanceParameters map[string]DeploymentInstanceParameter
type ExternalDownload ¶
type ExternalDownload struct {
UUID uuid.UUID `json:"uuid" gorm:"primaryKey;type:uuid"`
Expiration uint `json:"expiration"`
DatabaseID uint `json:"databaseId"`
}
swagger:model
type Group ¶
type Group struct {
Name string `json:"name" gorm:"primaryKey; unique;"`
Namespace string `json:"namespace"`
Description string `json:"description" gorm:"type:text"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Hostname string `json:"hostname" gorm:"unique;"`
Deployable bool `json:"deployable"`
Users []User `json:"users" gorm:"many2many:user_groups;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
AdminUsers []User `json:"adminUsers" gorm:"many2many:user_groups_admin;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
ClusterID *uint `json:"clusterId"`
Cluster Cluster `json:"cluster" gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL"`
}
Group domain object defining a group swagger:model
type KubernetesResource ¶
type KubernetesResource string
type Lock ¶
type Lock struct {
DatabaseID uint `json:"databaseId" gorm:"primaryKey"`
InstanceID uint `json:"instanceId"`
Instance DeploymentInstance `json:"instance,omitempty"`
UserID uint `json:"userId"`
User User `json:"user,omitempty"`
}
swagger:model
type ParameterProvider ¶
type ParameterProvider interface {
Provide(instance DeploymentInstance) (value string, err error)
}
ParameterProvider provides a value that can be consumed by a stack as a stack parameter.
type ParameterProviderFunc ¶
type ParameterProviderFunc func(instance DeploymentInstance) (string, error)
func (ParameterProviderFunc) Provide ¶
func (p ParameterProviderFunc) Provide(instance DeploymentInstance) (string, error)
type ParameterProviders ¶
type ParameterProviders map[string]ParameterProvider
type RequireCompanionFunc ¶ added in v0.64.0
type RequireCompanionFunc func(instance DeploymentInstanceParameter) (*Stack, error)
func (RequireCompanionFunc) Require ¶ added in v0.64.0
func (r RequireCompanionFunc) Require(parameter DeploymentInstanceParameter) (*Stack, error)
type Stack ¶
type Stack struct {
Name string `json:"name"`
Parameters StackParameters `json:"parameters"`
HostnamePattern string `json:"hostnamePattern"`
HostnameVariable string `json:"hostnameVariable"`
// ParameterProviders provide parameters to other stacks.
ParameterProviders ParameterProviders `json:"-"`
// Requires these stacks to deploy an instance of this stack.
Requires []Stack `json:"requires"`
// Companions are optional stacks that can be deployed alongside this stack. Certain parameters can require a companion stack.
Companions []Stack `json:"companions"`
KubernetesResource KubernetesResource
}
swagger:model StackDetail
type StackParameter ¶
type StackParameter struct {
// DisplayName is the user-friendly name of the parameter.
DisplayName string `json:"displayName"`
DefaultValue *string `json:"defaultValue,omitempty"`
// Consumed signals that this parameter is provided by another stack i.e. one of the stacks required stacks.
Consumed bool `json:"consumed"`
// Validator ensures that the actual stack parameters are valid according to its rules.
Validator func(value string) error `json:"-"`
// Priority determines the order in which the parameter is shown.
Priority uint `json:"priority"`
Sensitive bool `json:"sensitive"`
RequireCompanion RequireCompanionFunc `json:"-"`
}
swagger:model StackDetailParameter
type StackParameters ¶
type StackParameters map[string]StackParameter
swagger:model StackDetailParameters
type User ¶
type User struct {
ID uint `json:"id" gorm:"primarykey"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Email string `json:"email" gorm:"index;unique"`
EmailToken uuid.UUID `json:"-" gorm:"unique;type:uuid"`
Validated bool `json:"validated"`
Password string `json:"-"`
PasswordToken sql.NullString `json:"-"`
PasswordTokenTTL uint `json:"-"`
Groups []Group `json:"groups" gorm:"many2many:user_groups;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
Databases []Database `json:"databases" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
AdminGroups []Group `json:"adminGroups" gorm:"many2many:user_groups_admin;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}
User domain object defining a user swagger:model
func GetUserFromContext ¶
GetUserFromContext returns the User value stored in ctx, if any.
func (*User) IsAdministrator ¶
func (*User) IsMemberOf ¶
Click to show internal directories.
Click to hide internal directories.