types

package
v0.0.2-alpha.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const AnonymousPrincipalUID = "anonymous"

AnonymousPrincipalUID is an internal UID for anonymous principals.

View Source
const (
	PathSeparator = "/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppMetrics

type AppMetrics struct {
	Timestamp      time.Time `db:"matric_timestamp"              json:"timestamp"`
	ApplicationUID int64     `db:"matric_application_uid"        json:"application_uid"`
	InstanceName   string    `db:"matric_instance_name"          json:"instance_name"`
	CPU            int64     `db:"matric_cpu_mcores"             json:"cpu"`
	Memory         int64     `db:"matric_memory_bytes"           json:"memory"`
}

type AppMetricsAggregate

type AppMetricsAggregate struct {
	BucketTimestamp int64   `db:"bucket_ts"             json:"bucket_ts"`
	InstanceName    string  `db:"metric_instance_name"  json:"instance_name"`
	CPU             float64 `db:"cpu_vcores"            json:"cpu"`
	Memory          float64 `db:"memory_bytes"          json:"memory"`
}

type AppMetricsViewModel

type AppMetricsViewModel struct {
	CPU    []*MetricsSeriesViewModel
	Memory []*MetricsSeriesViewModel
}

type AppStatus

type AppStatus struct {
	Timestamp      time.Time              `json:"timestamp"`
	ApplicationUID int64                  `json:"application_uid"`
	ProjectID      int64                  `json:"project_id"`
	InstanceName   string                 `json:"instance_name"`
	Status         enum.ApplicationStatus `json:"status"`
	Reason         string                 `json:"reason"`
}

func (*AppStatus) ToEvent

func (s *AppStatus) ToEvent() *AppStatusEvent

type AppStatusEvent

type AppStatusEvent struct {
	ApplicationUID int64                  `json:"application_uid"`
	ProjectID      int64                  `json:"project_id"`
	Status         enum.ApplicationStatus `json:"status"`
	Reason         string                 `json:"reason"`
}

type Application

type Application struct {
	ID                    int64                            `db:"application_id"                           json:"-"`
	UID                   int64                            `db:"application_uid"                          json:"uid"`
	TenantID              int64                            `db:"application_tenant_id"                    json:"-"`
	ProjectID             int64                            `db:"application_project_id"                   json:"-"`
	EnvironmentID         int64                            `db:"application_environment_id"               json:"-"`
	EnvironmentUID        int64                            `db:"application_environment_uid"              json:"environment_uid"`
	ServerID              int64                            `db:"application_server_id"                    json:"-"`
	Name                  string                           `db:"application_name"                         json:"name"`
	Slug                  string                           `db:"application_slug"                         json:"slug"`
	ParentSlug            string                           `db:"application_parent_slug"                  json:"parent_slug"`
	Description           string                           `db:"application_description"                  json:"description"`
	Type                  enum.ApplicationType             `db:"application_type"                         json:"type"`
	Status                enum.ApplicationStatus           `db:"application_status"                       json:"status"`
	SpecJSON              string                           `db:"application_spec"                         json:"-"`
	Spec                  *ApplicationSpec                 `db:"-"                                        json:"spec"`
	GithubAppID           *int64                           `db:"application_githubapp_id"                 json:"-"`
	Domain                string                           `db:"application_domain"                       json:"domain"`
	CustomDomain          string                           `db:"application_custom_domain"                json:"custom_domain"`
	PrivateDomain         string                           `db:"application_private_domain"               json:"private_domain"`
	DeploymentID          *int64                           `db:"application_deployment_id"                json:"-"`
	DeploymentStatus      enum.ApplicationDeploymentStatus `db:"application_deployment_status"            json:"deployment_status"`
	DeploymentTriggeredAt int64                            `db:"application_deployment_triggered_at"      json:"deployment_triggered_at"`

	Created int64  `db:"application_created"                json:"created"`
	Updated int64  `db:"application_updated"                json:"updated"`
	Deleted *int64 `db:"application_deleted"                json:"deleted"`
}

func (*Application) GetGithubAppID

func (a *Application) GetGithubAppID() int64

GetGithubAppID returns the github app id if it exists

func (*Application) GetIdentifierStr

func (a *Application) GetIdentifierStr() string

helpers

func (*Application) IsStateful

func (a *Application) IsStateful() bool

func (*Application) IsStateless

func (a *Application) IsStateless() bool

func (*Application) UpdateSpecJSON

func (a *Application) UpdateSpecJSON() error

type ApplicationFilter

type ApplicationFilter struct {
	ListQueryFilter
	TenantID          *int64               `json:"tenant_id,omitempty"`
	ProjectID         *int64               `json:"project_id,omitempty"`
	EnvironmentID     *int64               `json:"environment_id,omitempty"`
	Sort              enum.ApplicationAttr `json:"sort"`
	Order             enum.Order           `json:"order"`
	DeletedAt         *int64               `json:"deleted_at,omitempty"`
	DeletedBeforeOrAt *int64               `json:"deleted_before_or_at,omitempty"`
}

type ApplicationRestrction

type ApplicationRestrction struct {
	MaxInstance int64
	MaxCPU      int64
	MaxMemory   float64
}

type ApplicationSpec

type ApplicationSpec struct {
	Icon        string `json:"icon,omitempty" yaml:"icon,omitempty"`
	Name        string `json:"name" yaml:"name"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`

	Build      *BuildConfiguration   `json:"build,omitempty" yaml:"build,omitempty" mapstructure:"build"`
	Deploy     *DeployConfiguration  `json:"deploy,omitempty" yaml:"deploy,omitempty" mapstructure:"deploy"`
	Networking *NetworkConfiguration `json:"networking,omitempty" yaml:"networking,omitempty" mapstructure:"networking"`

	Volumes []*VolumeMounts `json:"volumes,omitempty" yaml:"volumes,omitempty" mapstructure:"volumes"`
}

func (*ApplicationSpec) HasBuildCommand

func (s *ApplicationSpec) HasBuildCommand() bool

func (*ApplicationSpec) HasStartCommand

func (s *ApplicationSpec) HasStartCommand() bool

func (*ApplicationSpec) IsGit

func (s *ApplicationSpec) IsGit() bool

Helper utilities

func (*ApplicationSpec) IsRegistry

func (s *ApplicationSpec) IsRegistry() bool

func (*ApplicationSpec) IsServiceDomainEnabled

func (s *ApplicationSpec) IsServiceDomainEnabled() bool

func (*ApplicationSpec) IsTCPProxiesEnabled

func (s *ApplicationSpec) IsTCPProxiesEnabled() bool

func (*ApplicationSpec) ShouldAddStartCommand

func (s *ApplicationSpec) ShouldAddStartCommand() bool

func (*ApplicationSpec) ToDeployInput

func (s *ApplicationSpec) ToDeployInput() *DeployInput

func (*ApplicationSpec) ToGeneralInput

func (s *ApplicationSpec) ToGeneralInput() *GeneralInput

func (*ApplicationSpec) ToGitInput

func (s *ApplicationSpec) ToGitInput() *GitInput

func (*ApplicationSpec) ToInput

func (s *ApplicationSpec) ToInput() *ApplicationInput

func (*ApplicationSpec) ToNetorkInput

func (s *ApplicationSpec) ToNetorkInput() *NetworkInput

func (*ApplicationSpec) ToRegistryInput

func (s *ApplicationSpec) ToRegistryInput() *RegistryInput

func (*ApplicationSpec) ToServiceDomainInput

func (s *ApplicationSpec) ToServiceDomainInput() *ServiceDomainInput

func (*ApplicationSpec) ToTCPPorxiesInput

func (s *ApplicationSpec) ToTCPPorxiesInput() *TCPProxiesInput

func (*ApplicationSpec) ToVolumeInput

func (s *ApplicationSpec) ToVolumeInput() *VolumeInput

type Artifact

type Artifact struct {
	UID  string `json:"uid"`
	Name string `json:"name"`
}

type ArtifactLogLine

type ArtifactLogLine struct {
	ArtifactUID string `json:"artifact_uid"`
	Log         string `json:"log"`
}

type AuthSetting

type AuthSetting struct {
	ID           int64             `db:"auth_id"              json:"-"`
	Provider     enum.AuthProvider `db:"auth_provider"        json:"provider"`
	Enabled      bool              `db:"auth_enabled"         json:"enabled,string"`
	ClientID     string            `db:"auth_client_id"       json:"client_id"`
	ClientSecret string            `db:"auth_client_secret"   json:"client_secret"`
	BaseURL      string            `db:"auth_base_url"        json:"base_url"`
	Created      int64             `db:"auth_created"         json:"created"`
	Updated      int64             `db:"auth_updated"         json:"updated"`
}

type BuildConfiguration

type BuildConfiguration struct {
	Source *Source `json:"source,omitempty" yaml:"source,omitempty" mapstructure:"source"`
}

func (*BuildConfiguration) GetSource

func (b *BuildConfiguration) GetSource() string

type Certificate

type Certificate struct {
	Name        string
	Namespace   string
	DNSNames    []string
	IssuerRef   string
	SecretName  string
	NotBefore   time.Time
	NotAfter    time.Time
	RenewalTime time.Time
	Ready       string
}

type Config

type Config struct {
	// InstanceID specifis the ID of the cloudness instance.
	// NOTE: If the value is not provided the hostname of the machine is used.
	InstanceID  string `envconfig:"CLOUDNESS_INSTANCE_ID"`
	Environment string `envconfig:"CLOUDNESS_ENVIRONMENT"`

	Debug bool `envconfig:"CLOUDNESS_DEBUG"`
	Trace bool `envconfig:"CLOUDNESS_TRACE"`

	// GracefulShutdownTime defines the max time we wait when shutting down a server.
	// 5min should be enough for most git clones to complete.
	GracefulShutdownTime time.Duration `envconfig:"CLOUDNESS_GRACEFUL_SHUTDOWN_TIME" default:"300s"`

	Profiler struct {
		Type        string `envconfig:"CLOUDNESS_PROFILER_TYPE"`
		ServiceName string `envconfig:"CLOUDNESS_PROFILER_SERVICE_NAME" default:"cloudness"`
	}

	Instance struct {
		AllowNewTenantCreation bool `envconfig:"CLOUDNESS_INSTANCE_ALLOW_NEW_TENANT" default:"true"`
	}

	TenantConfig     TenantConfig
	KubeServerConfig KubeServerConfig

	ACME struct {
		ACMEUrl    string `envconfig:"CLOUDNESS_ACME_URL" default:"https://acme-v02.api.letsencrypt.org/directory"`
		Email      string `envconfig:"CLOUDNESS_ACME_EMAIL" default:"cloudness@localhost.com"`
		UseStaging bool   `envconfig:"CLOUDNESS_ACME_USE_STAGING" default:"false"`
	}

	// Token defines token configuration parameters.
	Token struct {
		CookieName string        `envconfig:"CLOUDNESS_TOKEN_COOKIE_NAME" default:"token"`
		Expire     time.Duration `envconfig:"CLOUDNESS_TOKEN_EXPIRE" default:"720h"`
	}

	// Database defines the database configuration parameters.
	Database struct {
		Driver     string `envconfig:"CLOUDNESS_DATABASE_DRIVER"     default:"sqlite3"`
		Datasource string `envconfig:"CLOUDNESS_DATABASE_DATASOURCE" default:"database.sqlite3"`
		Host       string `envconfig:"CLOUDNESS_DATABASE_HOST"`
		Port       string `envconfig:"CLOUDNESS_DATABASE_PORT"`
		Name       string `envconfig:"CLOUDNESS_DATABASE_NAME"`
		User       string `envconfig:"CLOUDNESS_DATABASE_USER"`
		Password   string `envconfig:"CLOUDNESS_DATABASE_PASSWORD"`
		SSLMode    string `envconfig:"CLOUDNESS_DATABASE_SSL_MODE"`
	}

	PubSub struct {
		Provider         pubsub.Provider `envconfig:"CLOUDNESS_PUBSUB_PROVIDER"          default:"inmemory"`
		AppNamespace     string          `envconfig:"CLOUDNESS_PUBSUB_APP_NAMESPACE"     default:"cloudness"`
		DefaultNamespace string          `envconfig:"CLOUDNESS_PUBSUB_DEFAULT_NAMESPACE" default:"default"`
		HealthInterval   time.Duration   `envconfig:"CLOUDNESS_PUBSUB_HEALTH_INTERVAL"   default:"3s"`
		SendTimeout      time.Duration   `envconfig:"CLOUDNESS_PUBSUB_SEND_TIMEOUT"      default:"60s"`
		ChannelSize      int             `envconfig:"CLOUDNESS_PUBSUB_CHANNEL_SIZE"      default:"100"`
	}

	// Server defines the server configuration parameters.
	Server struct {
		// HTTP defines the http configuration parameters
		HTTP struct {
			Port  int    `envconfig:"CLOUDNESS_HTTP_PORT" default:"8000"`
			Proto string `envconfig:"CLOUDNESS_HTTP_PROTO" default:"http"`
		}

		// Acme defines Acme configuration parameters.
		Acme struct {
			Enabled bool   `envconfig:"CLOUDNESS_ACME_ENABLED"`
			Endpont string `envconfig:"CLOUDNESS_ACME_ENDPOINT"`
			Email   bool   `envconfig:"CLOUDNESS_ACME_EMAIL"`
			Host    string `envconfig:"CLOUDNESS_ACME_HOST"`
		}
	}

	// Cors defines http cors parameters
	Cors struct {
		AllowedOrigins []string `envconfig:"CLOUDNESS_CORS_ALLOWED_ORIGINS"   default:"*"`
		AllowedMethods []string `envconfig:"CLOUDNESS_CORS_ALLOWED_METHODS"   default:"GET,POST,PATCH,PUT,DELETE,OPTIONS"`
		AllowedHeaders []string `` //nolint:lll // struct tags can't be multiline
		/* 158-byte string literal not displayed */
		ExposedHeaders   []string `envconfig:"CLOUDNESS_CORS_EXPOSED_HEADERS"   default:"Link"`
		AllowCredentials bool     `envconfig:"CLOUDNESS_CORS_ALLOW_CREDENTIALS" default:"true"`
		MaxAge           int      `envconfig:"CLOUDNESS_CORS_MAX_AGE"           default:"300"`
	}

	Redis struct {
		Endpoint           string `envconfig:"CLOUDNESS_REDIS_ENDPOINT"              default:"localhost:6379"`
		MaxRetries         int    `envconfig:"CLOUDNESS_REDIS_MAX_RETRIES"           default:"3"`
		MinIdleConnections int    `envconfig:"CLOUDNESS_REDIS_MIN_IDLE_CONNECTIONS"  default:"0"`
		Username           string `envconfig:"CLOUDNESS_REDIS_USERNAME"`
		Password           string `envconfig:"CLOUDNESS_REDIS_PASSWORD"`
	}

	// Secure defines http security parameters.
	Secure struct {
		AllowedHosts          []string          `envconfig:"CLOUDNESS_HTTP_ALLOWED_HOSTS"`
		HostsProxyHeaders     []string          `envconfig:"CLOUDNESS_HTTP_PROXY_HEADERS"`
		SSLRedirect           bool              `envconfig:"CLOUDNESS_HTTP_SSL_REDIRECT"`
		SSLTemporaryRedirect  bool              `envconfig:"CLOUDNESS_HTTP_SSL_TEMPORARY_REDIRECT"`
		SSLHost               string            `envconfig:"CLOUDNESS_HTTP_SSL_HOST"`
		SSLProxyHeaders       map[string]string `envconfig:"CLOUDNESS_HTTP_SSL_PROXY_HEADERS"`
		STSSeconds            int64             `envconfig:"CLOUDNESS_HTTP_STS_SECONDS"`
		STSIncludeSubdomains  bool              `envconfig:"CLOUDNESS_HTTP_STS_INCLUDE_SUBDOMAINS"`
		STSPreload            bool              `envconfig:"CLOUDNESS_HTTP_STS_PRELOAD"`
		ForceSTSHeader        bool              `envconfig:"CLOUDNESS_HTTP_STS_FORCE_HEADER"`
		BrowserXSSFilter      bool              `envconfig:"CLOUDNESS_HTTP_BROWSER_XSS_FILTER"    default:"true"`
		FrameDeny             bool              `envconfig:"CLOUDNESS_HTTP_FRAME_DENY"            default:"true"`
		ContentTypeNosniff    bool              `envconfig:"CLOUDNESS_HTTP_CONTENT_TYPE_NO_SNIFF"`
		ContentSecurityPolicy string            `envconfig:"CLOUDNESS_HTTP_CONTENT_SECURITY_POLICY"`
		ReferrerPolicy        string            `envconfig:"CLOUDNESS_HTTP_REFERRER_POLICY"`
	}

	// Github provides the github client configuration.
	Github struct {
		ClientId     string   `envconfig:"CLOUDNESS_SCM_GITHUB_CLIENT_ID"`
		ClientSecret string   `envconfig:"CLOUDNESS_SCM_GITHUB_CLIENT_SECRET"`
		Scope        []string `envconfig:"CLOUDNESS_SCM_GITHUB_SCOPE" default:"repo,repo:status,user:email,read:org"`
		Debug        bool     `envconfig:"CLOUDNESS_SCM_GITHUB_DEBUG"`
	}

	Lock struct {
		// Provider is a name of distributed lock service like redis, memory, file etc...
		Provider      lock.Provider `envconfig:"CLOUDNESS_LOCK_PROVIDER"          default:"inmemory"`
		Expiry        time.Duration `envconfig:"CLOUDNESS_LOCK_EXPIRE"            default:"8s"`
		Tries         int           `envconfig:"CLOUDNESS_LOCK_TRIES"             default:"8"`
		RetryDelay    time.Duration `envconfig:"CLOUDNESS_LOCK_RETRY_DELAY"       default:"250ms"`
		DriftFactor   float64       `envconfig:"CLOUDNESS_LOCK_DRIFT_FACTOR"      default:"0.01"`
		TimeoutFactor float64       `envconfig:"CLOUDNESS_LOCK_TIMEOUT_FACTOR"    default:"0.25"`
		// AppNamespace is just service app prefix to avoid conflicts on key definition
		AppNamespace string `envconfig:"CLOUDNESS_LOCK_APP_NAMESPACE"     default:"cloudness"`
		// DefaultNamespace is when mutex doesn't specify custom namespace for their keys
		DefaultNamespace string `envconfig:"CLOUDNESS_LOCK_DEFAULT_NAMESPACE" default:"default"`
	}
}

Config stores the system configuration.

func (*Config) Process

func (c *Config) Process()

Process performs post-processing on the configuration after it has been loaded.

type CreatedFilter

type CreatedFilter struct {
	CreatedGt int64 `json:"created_gt"`
	CreatedLt int64 `json:"created_lt"`
}

type DemoUser

type DemoUser struct {
	Email    string `json:"demo_user_email"`
	Password string `json:"-"`
}

type DeployConfiguration

type DeployConfiguration struct {
	StartCommand            string                 `json:"startCommand,omitempty" yaml:"startCommand,omitempty" mapstructure:"startCommand"`
	SleepApplication        bool                   `json:"sleepApplication" yaml:"sleepApplication" mapstructure:"sleepApplication"`
	MaxReplicas             int64                  `json:"maxReplicas" yaml:"maxReplicas" mapstructure:"maxReplicas"`
	CPU                     int64                  `json:"cpu" yaml:"cpu" mapstructure:"cpu"`
	Memory                  float64                `json:"memory" yaml:"memory" mapstructure:"memory"`
	HealthcheckPath         string                 `json:"healthcheckPath,omitempty" yaml:"healthcheckPath" mapstructure:"healthcheckPath"`
	HealthcheckTimeout      int                    `json:"healthcheckTimeout" yaml:"healthcheckTimeout" mapstructure:"healthcheckTimeout"`
	RestartPolicyType       enum.RestartPolicyType `json:"restartPolicyType" yaml:"restartPolicyType" mapstructure:"restartPolicyType"`
	RestartPolicyMaxRetries int                    `json:"restartPolicyMaxRetries" yaml:"restartPolicyMaxRetries" mapstructure:"restartPolicyMaxRetries"`
}

Deploy

type DeployInput

type DeployInput struct {
	StartCommand            string                 `json:"startCommand,omitempty"`
	SleepApplication        bool                   `json:"sleepApplication,string"`
	MaxReplicas             int64                  `json:"maxReplicas,string"`
	CPU                     int64                  `json:"cpu,string"`
	Memory                  float64                `json:"memory,string"`
	HealthcheckPath         string                 `json:"healthcheckPath,omitempty"`
	HealthcheckTimeout      int                    `json:"healthcheckTimeout,string,omitempty"`
	RestartPolicyType       enum.RestartPolicyType `json:"restartPolicyType"`
	RestartPolicyMaxRetries int                    `json:"restartPolicyMaxRetries"`
}

type Deployment

type Deployment struct {
	ID            int64                 `db:"deployment_id"              json:"-"`
	UID           int64                 `db:"deployment_uid"             json:"uid"`
	ApplicationID int64                 `db:"deployment_application_id"  json:"application_id"`
	SpecJson      string                `db:"deployment_spec"            json:"spec"`
	Spec          *ApplicationSpec      `db:"-"                          json:"-"`
	NeedsBuild    bool                  `db:"deployment_needs_build"     json:"needs_build"`
	Triggerer     string                `db:"deployment_triggerer"       json:"triggerer"`
	Title         string                `db:"deployment_title"           json:"title"`
	Action        enum.TriggerAction    `db:"deployment_action"          json:"action"`
	Status        enum.DeploymentStatus `db:"deployment_status"          json:"status"`
	Error         string                `db:"deployment_error"           json:"error"`
	Version       int64                 `db:"deployment_version"         json:"version"`
	Machine       string                `db:"deployment_machine"         json:"machine,omitempty"`
	Started       int64                 `db:"deployment_started"         json:"started"`
	Stopped       int64                 `db:"deployment_stopped"         json:"stopped"`
	Created       int64                 `db:"deployment_created"         json:"created"`
	Updated       int64                 `db:"deployment_updated"         json:"updated"`
}

func (*Deployment) Fail

func (d *Deployment) Fail(err error)

func (*Deployment) Finish

func (d *Deployment) Finish()

func (*Deployment) GetInfo

func (d *Deployment) GetInfo() *DeploymentInfo

helpers

func (*Deployment) IsDone

func (d *Deployment) IsDone() bool

func (*Deployment) Start

func (d *Deployment) Start()

type DeploymentInfo

type DeploymentInfo struct {
	Title       string
	Description string
}

type Environment

type Environment struct {
	ID        int64  `db:"environment_id"           json:"-"`
	TenantID  int64  `db:"environment_tenant_id"    json:"-"`
	ProjectID int64  `db:"environment_project_id"   json:"-"`
	UID       int64  `db:"environment_uid"          json:"uid"`
	Seq       int64  `db:"environment_sequence"     json:"seq"`
	Name      string `db:"environment_name"         json:"name"`
	Slug      string `db:"environment_slug"         json:"slug"`
	CreateBy  int64  `db:"environment_created_by"   json:"-"`

	Created int64  `db:"environment_created"                json:"created"`
	Updated int64  `db:"environment_updated"                json:"updated"`
	Deleted *int64 `db:"environment_deleted"                json:"deleted"`
}

type EnvironmentFilter

type EnvironmentFilter struct {
	ListQueryFilter
	TenantID          *int64               `json:"tenant_id,omitempty"`
	ProjectID         *int64               `json:"project_id,omitempty"`
	Sort              enum.EnvironmentAttr `json:"sort"`
	Order             enum.Order           `json:"order"`
	DeletedAt         *int64               `json:"deleted_at,omitempty"`
	DeletedBeforeOrAt *int64               `json:"deleted_before_or_at,omitempty"`
}

EnvironmentFilter stores projects query parameters.

type Favorite

type Favorite struct {
	UserID        int64 `json:"-" db:"favorite_user_id"`
	ApplicationID int64 `json:"-" db:"favorite_application_id"`

	Created int64 `json:"created" db:"favorite_created"`
}

type FavoriteDTO

type FavoriteDTO struct {
	ProjectUID      int64  `json:"project_uid"`
	ProjectName     string `json:"project_name"`
	EnvironmentUID  int64  `json:"environment_uid"`
	EnvironmentName string `json:"environment_name"`
	ApplicationUID  int64  `json:"application_uid"`
	AppName         string `json:"app_name"`
	AppDomain       string `json:"app_domain"`
}

type GeneralInput

type GeneralInput struct {
	Icon        string               `json:"icon"`
	Name        string               `json:"name"`
	Description string               `json:"description"`
	Type        enum.ApplicationType `json:"type"`
}

type GitBranch

type GitBranch struct {
	Name string
}

type GitCommit

type GitCommit struct {
	Sha     string
	Message string
}

type GitInput

type GitInput struct {
	RepoURL      string           `json:"repoURL"`
	Repo         string           `json:"repo"`
	Branch       string           `json:"branch"`
	Commit       string           `json:"commit"`
	CommitMsg    string           `json:"commitMsg"`
	Builder      enum.BuilderType `json:"builder"`
	BasePath     string           `json:"basePath"`
	IsStaticSite bool             `json:"isStaticSite,string"`
	PublishPath  string           `json:"publishPath"`
	Dockerfile   string           `json:"dockerfile"`
	BuildCommand string           `json:"buildCommand,omitempty"`
}

type GitRepo

type GitRepo struct {
	Name     string
	FullName string
}

type GitSource

type GitSource struct {
	RepoURL      string           `json:"repoURL" yaml:"repoURL" mapstructure:"repoURL"`
	Branch       string           `json:"branch" yaml:"branch" mapstructure:"branch"`
	Commit       string           `json:"commit" yaml:"commit" mapstructure:"commit"`
	Builder      enum.BuilderType `json:"builder" yaml:"builder" mapstructure:"builder"`
	BasePath     string           `json:"basePath" yaml:"basePath" mapstructure:"basePath"`
	IsStaticSite bool             `json:"isStaticSite,string" yaml:"isStaticSite" mapstructure:"isStaticSite"`
	PublishPath  string           `json:"publishPath" yaml:"publishPath" mapstructure:"publishPath"`
	Dockerfile   string           `json:"dockerfile,omitempty" yaml:"dockerfile,omitempty" mapstructure:"dockerfile"`
	BuildCommand string           `json:"buildCommand,omitempty" yaml:"buildCommand,omitempty" mapstructure:"buildCommand"`
}

type GithubApp

type GithubApp struct {
	ID             int64  `db:"github_app_id"                json:"-"`
	UID            int64  `db:"github_app_uid"               json:"uid"`
	TenantID       int64  `db:"github_app_tenant_id"         json:"-"`
	ProjectID      int64  `db:"github_app_project_id"        json:"-"`
	PrivateKeyID   int64  `db:"github_app_private_key_id"    json:"private_key_id"`
	IsTenantWide   bool   `db:"github_app_is_tenant_wide"    json:"is_tenant_wide"`
	Name           string `db:"github_app_name"              json:"name"`
	Organization   string `db:"github_app_organization"      json:"organization"`
	ApiUrl         string `db:"github_app_api_url"           json:"api_url"`
	HtmlUrl        string `db:"github_app_html_url"          json:"html_url"`
	CustomUser     string `db:"github_app_custom_user"       json:"custom_user"`
	CustomPort     int64  `db:"github_app_custom_port"       json:"custom_port"`
	AppID          int64  `db:"github_app_app_id"            json:"app_id"`
	InstallationID int64  `db:"github_app_installation_id"   json:"installation_id"`
	ClientID       string `db:"github_app_client_id"         json:"client_id"`
	ClientSecret   string `db:"github_app_client_secret"     json:"client_secret"`
	WebhookSecret  string `db:"github_app_webhook_secret"    json:"webhook_secret"`
	CreateBy       int64  `db:"github_app_created_by"        json:"-"`

	Created int64 `db:"github_app_created"                json:"created"`
	Updated int64 `db:"github_app_updated"                json:"updated"`
}

func (*GithubApp) GetHttpUrl

func (g *GithubApp) GetHttpUrl(repo string) string

Helpers

type Instance

type Instance struct {
	ID                    int64            `db:"instance_id"                        json:"-"`
	SuperAdmin            *int64           `db:"instance_super_admin"               json:"-"`
	PublicIPV4            string           `db:"instance_public_ipv4"               json:"public_ipv4"`
	PublicIPV6            string           `db:"instance_public_ipv6"               json:"public_ipv6"`
	UpdateEnabled         bool             `db:"instance_update_enabled"            json:"update_enabled,string"`
	UpdateCheckFrequency  string           `db:"instance_update_check_frequency"    json:"update_check_frequency"`
	FQDN                  string           `db:"instance_fqdn"                      json:"fqdn"`
	DNSValidationEnabled  bool             `db:"instance_dns_validation_enabled"    json:"dns_validation_enabled,string"`
	DNSServers            string           `db:"instance_dns_servers"               json:"dns_servers"`
	DNSProvider           enum.DNSProvider `db:"instance_dns_provider"              json:"dns_provider"`
	DNSProviderAuth       string           `db:"instance_dns_provider_auth"         json:"-"`
	UserSignupEnabled     bool             `db:"instance_user_signup_enabled"       json:"user_signup_enabled,string"`
	DemoUserEnabled       bool             `db:"instance_demo_user_enabled"         json:"demo_user_enabled,string"`
	RegistryEnabled       bool             `db:"instance_registry_enabled"          json:"registry_enabled,string"`
	RegistrySize          int64            `db:"instance_registry_size"             json:"registry_size,string"`
	RegistryMirrorEnabled bool             `db:"instance_registry_mirror_enabled"   json:"registry_mirror_enabled,string"`
	RegistryMirrorSize    int64            `db:"instance_registry_mirror_size"      json:"registry_mirror_size"`
	ExternalScripts       string           `db:"instance_external_scripts"          json:"external_scripts"`
	AdditionalScripts     string           `db:"instance_additional_scripts"        json:"additional_scripts"`
	Created               int64            `db:"instance_created"                   json:"-"`
	Updated               int64            `db:"instance_updated"                   json:"-"`
}

func (*Instance) GetHttpDomain

func (i *Instance) GetHttpDomain() string

GetHttpDomain returns the http domain for this instance

type InstanceRestrictions

type InstanceRestrictions struct {
	AllowNewTenant bool
}

type KubeServerConfig

type KubeServerConfig struct {
	DefaultVolumeSupportsOnlineExpansion bool `envconfig:"CLOUDNESS_KUBE_UNMOUNT_BEFORE_RESIZE"  default:"true"`
}

type ListQueryFilter

type ListQueryFilter struct {
	Pagination
	Query string `json:"query"`
}

ListQueryFilter has pagination related info and a query param.

type LogLine

type LogLine struct {
	Number    int    `json:"pos"`
	Message   string `json:"out"`
	Timestamp int64  `json:"time"`
}

LogLine represents a line in the logs.

type Logs

type Logs struct {
	ID           int64  `db:"log_id"            json:"id"`
	DeploymentID int64  `db:"log_deployment_id" json:"deployment_id"`
	Data         []byte `db:"log_data"          json:"data"`
}

Logs represets the full logs of a deployment.

type MetricsSeriesViewModel

type MetricsSeriesViewModel struct {
	Label      string    `json:"label"`
	Timestamps []int64   `json:"timestamps"`
	Values     []float64 `json:"values"`
}

type Netrc

type Netrc struct {
	Machine  string `json:"machine"`
	Login    string `json:"login"`
	Password string `json:"password"`
	HttpUrl  string `json:"http_url"`
}

func (*Netrc) SetMachine

func (n *Netrc) SetMachine(address string) error

SetMachine sets the netrc machine from a URL value.

type NetworkConfiguration

type NetworkConfiguration struct {
	ContainerPorts []int                       `json:"containerPorts" yaml:"containerPorts" mapstructure:"containerPorts"`
	ServiceDomain  *ServiceDomainConfiguraiton `json:"serviceDomain" yaml:"serviceDomain" mapstructure:"serviceDomain"`
	TCPProxies     *TCPProxiesConfiguration    `json:"tcpProxies" yaml:"tcpProxies" mapstructure:"tcpProxies"`
}

type NetworkInput

type NetworkInput struct {
	ContainerPorts []string `json:"containerPorts"`
	*ServiceDomainInput
	*TCPProxiesInput
}

type OauthLoginResponse

type OauthLoginResponse struct {
	LoginUrl string `json:"login_url"`
}

TokenResponse is returned as part of token creation for PAT / SAT / User Session.

type Pagination

type Pagination struct {
	Page int `json:"page"`
	Size int `json:"size"`
}

Pagination stores pagination related params.

type PermissionCheck

type PermissionCheck struct {
	Scope      Scope
	Resource   Resource
	Permission enum.Permission
}

PermissionCheck represents a permission check.

type Principal

type Principal struct {
	ID          int64              `db:"principal_id"           json:"-"`
	UID         string             `db:"principal_uid"          json:"uid"`
	Email       string             `db:"principal_email"        json:"email"`
	Type        enum.PrincipalType `db:"principal_type"         json:"type"`
	DisplayName string             `db:"principal_display_name" json:"display_name"`

	// Should be part of principal or not?
	Blocked  bool   `db:"principal_blocked"            json:"blocked"`
	Password string `db:"principal_user_password"      json:"-"`
	Salt     string `db:"principal_salt"               json:"-"`

	// Other info
	Created int64 `db:"principal_created"                json:"created"`
	Updated int64 `db:"principal_updated"                json:"updated"`
}

Principal represents the identity of an acting entity (User, ServiceAccount, Service).

func (*Principal) ToPrincipalInfo

func (p *Principal) ToPrincipalInfo() *PrincipalInfo

type PrincipalFilter

type PrincipalFilter struct {
	Page  int                  `json:"page"`
	Size  int                  `json:"size"`
	Query string               `json:"query"`
	Types []enum.PrincipalType `json:"types"`
}

type PrincipalInfo

type PrincipalInfo struct {
	ID          int64              `json:"id"`
	UID         string             `json:"uid"`
	DisplayName string             `json:"display_name"`
	Email       string             `json:"email"`
	Type        enum.PrincipalType `json:"type"`
	Created     int64              `json:"created"`
	Updated     int64              `json:"updated"`
}

PrincipalInfo is a compressed representation of a principal we return as part of non-principal APIs.

func (*PrincipalInfo) Identifier

func (p *PrincipalInfo) Identifier() int64

type PrivateKey

type PrivateKey struct {
	ID          int64  `db:"private_key_id"           json:"-"`
	UID         int64  `db:"private_key_uid"          json:"uid"`
	TenantID    int64  `db:"private_key_tenant_id"    json:"-"`
	Name        string `db:"private_key_name"         json:"name"`
	Description string `db:"private_key_description"  json:"description"`
	Key         string `db:"private_key_pem"          json:"-"`
	IsGit       bool   `db:"private_key_is_git"       json:"is_git"`

	Created int64 `db:"private_key_created"                json:"created"`
	Updated int64 `db:"private_key_updated"                json:"updated"`
}

type Project

type Project struct {
	ID          int64  `db:"project_id"           json:"-"`
	TenantID    int64  `db:"project_tenant_id"    json:"-"`
	UID         int64  `db:"project_uid"          json:"uid"`
	Name        string `db:"project_name"         json:"name"`
	Slug        string `db:"project_slug"         json:"slug"`
	Description string `db:"project_description"  json:"description"`
	CreateBy    int64  `db:"project_created_by"   json:"-"`

	Created int64  `db:"project_created"     json:"created"`
	Updated int64  `db:"project_updated"     json:"updated"`
	Deleted *int64 `db:"project_deleted"     json:"deleted"`
}

type ProjectFilter

type ProjectFilter struct {
	ListQueryFilter
	TenantID          *int64           `json:"tenant_id,omitempty"`
	PrincipalID       *int64           `json:"principal_id,omitempty"`
	Sort              enum.ProjectAttr `json:"sort"`
	Order             enum.Order       `json:"order"`
	DeletedAt         *int64           `json:"deleted_at,omitempty"`
	DeletedBeforeOrAt *int64           `json:"deleted_before_or_at,omitempty"`
}

ProjectFilter stores projects query parameters.

type ProjectMembership

type ProjectMembership struct {
	*ProjectMembershipKey
	CreatedBy int64 `json:"-"`

	Created int64 `json:"created"`
	Updated int64 `json:"updated"`
}

type ProjectMembershipKey

type ProjectMembershipKey struct {
	TenantID           int64            `json:"-"`
	TenantMembershipID int64            `json:"-"`
	ProjectID          int64            `json:"-"`
	PrincipalID        int64            `json:"-"`
	Role               enum.ProjectRole `json:"role"`
}

type ProjectMembershipUser

type ProjectMembershipUser struct {
	*ProjectMembership
	DisplayName string `json:"display_name"`
	Email       string `json:"email"`
}

type RegistryInput

type RegistryInput struct {
	Image string `json:"image"`
	*NetworkInput
}

type RegistrySource

type RegistrySource struct {
	Image     string `json:"image" yaml:"image" mapstructure:"image"`
	IsPrivate bool   `json:"isPrivate,string" yaml:"isPrivate" mapstructure:"isPrivate"`
}

type Resource

type Resource struct {
	Type       enum.ResourceType
	Identifier string
}

Resource represents the resource of a permission check. Note: Keep the name empty in case access is requested for all resources of that type.

type RunnerConfig

type RunnerConfig struct {
	EnableRunner    bool
	Engine          string
	Hostname        string
	ParallelWorkers int64
	PollingInterval int64
	MaxCPU          float64
	MaxMemory       float64
	UpdatedAt       int64

	//kubernetes
	KubeNameSpace string
}

type Scope

type Scope struct {
	Tenant string
	App    string
}

Scope represents the scope of a permission check Notes:

  • In case the permission check is for resource App, keep app empty (app is resource, not scope)
  • In case the permission check is for resource Tenant, Tenant is an ancestor of the tenant (tenant is resource, not scope)
  • App isn't use as of now (will be useful once we add access control for app child resources, e.g. branches).

type Server

type Server struct {
	ID                            int64            `db:"server_id"                                   json:"-"`
	UID                           int64            `db:"server_uid"                                  json:"uid"`
	Type                          enum.ServerType  `db:"server_type"                                 json:"type"`
	Name                          string           `db:"server_name"                                 json:"name"`
	Description                   string           `db:"server_description"                          json:"description"`
	IPV4                          string           `db:"server_ipv4"                                 json:"ipv4"`
	IPV6                          string           `db:"server_ipv6"                                 json:"ipv6"`
	WildCardDomain                string           `db:"server_wildcard_domain"                      json:"wildcard_domain"`
	DNSProvider                   enum.DNSProvider `db:"server_dns_provider"                         json:"dns_provider"`
	DNSProviderAuth               string           `db:"server_dns_provider_auth"                    json:"-"`
	User                          string           `db:"server_user"                                 json:"user"`
	Port                          int64            `db:"server_port"                                 json:"port"`
	VolumeSupportsOnlineExpansion bool             `db:"server_volume_supports_online_expansion"     json:"volume_supports_online_expansion"`
	VolumeMinSize                 int64            `db:"server_volume_min_size"                      json:"volume_min_size"`
	BuildEnabled                  bool             `db:"server_builder_is_enabled"                   json:"build_enabled"`
	IsBuildServer                 bool             `db:"server_builder_is_build_server"              json:"is_build_server"`
	PollingInterval               int64            `db:"server_builder_polling_interval"             json:"polling_interval"`
	MaxConcurrentBuilds           int64            `db:"server_builder_max_concurrent_builds"        json:"max_concurrent_builds"`
	MaxCPUPerBuild                float64          `db:"server_builder_max_cpu"                      json:"max_cpu_per_build"`
	MaxMemoryPerBuild             float64          `db:"server_builder_max_memory"                   json:"max_memory_per_build"`

	Created int64 `db:"server_created"          json:"created"`
	Updated int64 `db:"server_updated"          json:"updated"`
}

func (*Server) GetDomain

func (s *Server) GetDomain() (*ServerDomain, error)

type ServerDomain

type ServerDomain struct {
	Hostname string
	Scheme   string
}

type ServerRestrictions

type ServerRestrictions struct {
	UnmountBeforeResize bool `json:"unmount_before_resize,string"`
}

type ServerState

type ServerState struct {
	VolumeAllowsOnlineExpansion bool
}

type ServiceDomainConfiguraiton

type ServiceDomainConfiguraiton struct {
	Port   int    `json:"port" yaml:"port" mapstructure:"port"`
	Domain string `json:"domain" yaml:"domain" mapstructure:"domain"`
	Path   string `json:"path" yaml:"path" mapstructure:"path"`
}

type ServiceDomainInput

type ServiceDomainInput struct {
	Enabled   bool   `json:"serviceDomainEnabled"`
	FQDN      string `json:"serviceDomainFQDN"`
	Scheme    string `json:"serviceDomainScheme"`
	Subdomain string `json:"serviceDomainSubdomain"`
	Domain    string `json:"serviceDomainDomain"`
	Port      int    `json:"serviceDomainPort,string"`
	Path      string `json:"serviceDomainPath"`
}

type Source

type Source struct {
	Git      *GitSource      `json:"git,omitempty" yaml:"git,omitempty" mapstructure:"git"`
	Registry *RegistrySource `json:"registry,omitempty" yaml:"registry,omitempty" mapstructure:"registry"`
}

type Stream

type Stream[T any] interface {
	Next() (T, error)
}

type SystemVariable

type SystemVariable struct {
	Key       string `json:"key"`
	Type      string `json:"type"`
	TextValue string `json:"text_value"`
}

type TCPProxiesConfiguration

type TCPProxiesConfiguration struct {
	TCPPort int `json:"tcpPort" yaml:"tcpPort" mapstructure:"tcpPort"`
}

type TCPProxiesInput

type TCPProxiesInput struct {
	Enabled bool `json:"tcpProxiesEnabled"`
	Port    int  `json:"tcpProxiesPort,string"`
}

type Tag

type Tag struct {
	ID      int64  `db:"tag_id"        json:"-"`
	Slug    string `db:"tag_slug"      json:"slug"`
	Name    string `db:"tag_name"      json:"name"`
	Created int64  `db:"tag_created"   json:"created"`
}

type Template

type Template struct {
	ID       int64         `db:"template_id"         json:"-"`
	Slug     string        `db:"template_slug"       json:"slug"`
	Name     string        `db:"template_name"       json:"name"`
	Icon     string        `db:"template_icon"       json:"icon"`
	ReadMe   string        `db:"template_readme"     json:"readme"`
	Tags     []string      `db:"-"                   json:"tags"`
	Spec     *TemplateSpec `db:"-"                   json:"spec"`
	SpecJson string        `db:"template_spec"       json:"-"`
	Created  int64         `db:"template_created"    json:"created"`
}

type TemplateService

type TemplateService struct {
	Icon       string                  `json:"icon,omitempty" yaml:"icon,omitempty"`
	Name       string                  `json:"name" yaml:"name"`
	Build      *BuildConfiguration     `json:"build,omitempty" yaml:"build,omitempty" mapstructure:"build"`
	Deploy     *DeployConfiguration    `json:"deploy,omitempty" yaml:"deploy,omitempty" mapstructure:"deploy"`
	Networking *NetworkConfiguration   `json:"networking,omitempty" yaml:"networking,omitempty" mapstructure:"networking"`
	Volumes    []*TemplateVolumeMounts `json:"volumes,omitempty" yaml:"volumes,omitempty" mapstructure:"volumes"`
	Variables  []*TemplateVariable     `json:"variables,omitempty" yaml:"variables,omitempty" mapstructure:"variables"`
}

func (*TemplateService) ToVolumeMounts

func (s *TemplateService) ToVolumeMounts() []*VolumeMounts

type TemplateSpec

type TemplateSpec struct {
	Icon     string             `json:"icon,omitempty" yaml:"icon,omitempty"`
	Name     string             `json:"name" yaml:"name"`
	Readme   string             `json:"readme,omitempty" yaml:"readme,omitempty"`
	Tags     []string           `json:"tags,omitempty" yaml:"tags,omitempty"`
	Services []*TemplateService `json:"services" yaml:"services"`
}

func (*TemplateSpec) ToTemplate

func (t *TemplateSpec) ToTemplate() (*Template, error)

type TemplateTag

type TemplateTag struct {
	TemplateID int64 `db:"template_id" json:"-"`
	TagID      int64 `db:"tag_id"      json:"-"`
}

type TemplateVariable

type TemplateVariable struct {
	Key   string            `json:"key" yaml:"key"`
	Value string            `json:"value" yaml:"value"`
	Type  enum.VariableType `json:"type" yaml:"type"`
}

type TemplateVolumeMounts

type TemplateVolumeMounts struct {
	Name      string `json:"name" yaml:"name" mapstructure:"name"`
	MountPath string `json:"mountPath" yaml:"mountPath" mapstructure:"mountPath"`
}

type Tenant

type Tenant struct {
	ID                 int64   `db:"tenant_id"                     json:"-"`
	UID                int64   `db:"tenant_uid"                    json:"uid"`
	Name               string  `db:"tenant_name"                   json:"name"`
	Slug               string  `db:"tenant_slug"                   json:"slug"`
	Description        string  `db:"tenant_description"            json:"description"`
	AllowAdminToModify bool    `db:"tenant_allow_admin_to_modify"  json:"allow_admin_to_modify"`
	MaxProjects        int64   `db:"tenant_max_projects"           json:"max_projects"`
	MaxApps            int64   `db:"tenant_max_apps"               json:"max_apps"`
	MaxInstances       int64   `db:"tenant_max_instances"          json:"max_instances"`
	MaxCPUPerApp       int64   `db:"tenant_max_cpu_per_app"        json:"max_cpu_per_app"`
	MaxMemoryPerApp    float64 `db:"tenant_max_memory_per_app"     json:"max_memory_per_app"`
	MaxVolumes         int64   `db:"tenant_max_volumes"            json:"max_volumes"`
	MinVolumeSize      int64   `db:"tenant_min_volume_size"        json:"min_volume_size"`
	MaxVolumeSize      int64   `db:"tenant_max_volume_size"        json:"max_volume_size"`
	CreateBy           int64   `db:"tenant_created_by"             json:"-"`

	Created int64  `db:"tenant_created"                json:"created"`
	Updated int64  `db:"tenant_updated"                json:"updated"`
	Deleted *int64 `db:"tenant_deleted"                json:"deleted"`
}

type TenantConfig

type TenantConfig struct {
	DefaultTenantName                 string  `envconfig:"CLOUDNESS_TENANT_DEFAULT_NAME"           default:"root"`
	DefaultAllowAdminToModify         bool    `envconfig:"CLOUDNESS_TENANT_ALLOW_ADMIN_TO_MODIFY"  default:"false"`
	DefaultMaxProjectsPerTenant       int64   `envconfig:"CLOUDNESS_TENANT_MAX_PROJECTS"           default:"10"`
	DefaultMaxApplicationsPerTenant   int64   `envconfig:"CLOUDNESS_TENANT_MAX_APPLICATIONS"       default:"10"`
	DefaultMaxInstancesPerApplication int64   `envconfig:"CLOUDNESS_TENANT_MAX_INSTANCES"          default:"2"`
	DefaultMaxCPUPerApplication       int64   `envconfig:"CLOUDNESS_TENANT_MAX_CPU"                default:"2"`
	DefaultMaxMemoryPerApplication    float64 `envconfig:"CLOUDNESS_TENANT_MAX_MEMORY"             default:"2"`
	DefaultMaxVolumeCount             int64   `envconfig:"CLOUDNESS_TENANT_MAX_VOLUME_COUNT"       default:"10"`
	DefaultMinVolumeSize              int64   `envconfig:"CLOUDNESS_TENANT_MIN_VOLUME_SIZE"        default:"1024"`
	DefaultMaxVolumeSize              int64   `envconfig:"CLOUDNESS_TENANT_MAX_VOLUME_SIZE"        default:"10240"`
}

type TenantFilter

type TenantFilter struct {
	ListQueryFilter
	Sort              enum.TenantAttr `json:"sort"`
	Order             enum.Order      `json:"order"`
	DeletedAt         *int64          `json:"deleted_at,omitempty"`
	DeletedBeforeOrAt *int64          `json:"deleted_before_or_at,omitempty"`
}

TenantFilter stores projects query parameters.

type TenantMembership

type TenantMembership struct {
	*TenantMembershipKey
	CreatedBy int64 `json:"-"`

	Created int64 `json:"created"`
	Updated int64 `json:"updated"`
}

type TenantMembershipKey

type TenantMembershipKey struct {
	ID                int64           `json:"-"`
	TenantID          int64           `json:"-"`
	TenantUID         int64           `json:"tenant_uid"`
	PrincipalID       int64           `json:"-"`
	TenantName        string          `json:"tenant_name"`
	TenantDescription string          `json:"tenant_description"`
	Role              enum.TenantRole `json:"role"`
}

type TenantMembershipUser

type TenantMembershipUser struct {
	*TenantMembership
	DisplayName string `json:"display_name"`
	Email       string `json:"email"`
}

type TenantRestrictions

type TenantRestrictions struct {
	AllowAdminToModify bool    `json:"allow_admin,string"`
	MaxProjects        int64   `json:"max_projects,string"`
	MaxApps            int64   `json:"max_apps,string"`
	MaxInstances       int64   `json:"max_instances,string"`
	MaxCPU             int64   `json:"max_cpu,string"`
	MaxMemory          float64 `json:"max_memory,string"`
	MaxVolumes         int64   `json:"max_volumes,string"`
	MinVolumeSize      int64   `json:"min_volume_size,string"`
	MaxVolumeSize      int64   `json:"max_volume_size,string"`
}

type Token

type Token struct {
	// TODO: int64 ID doesn't match DB
	ID          int64          `db:"token_id"                 json:"-"`
	PrincipalID int64          `db:"token_principal_id"       json:"principal_id"`
	Type        enum.TokenType `db:"token_type"               json:"type"`
	Identifier  string         `db:"token_uid"                json:"identifier"`
	// ExpiresAt is an optional unix time that if specified restricts the validity of a token.
	ExpiresAt *int64 `db:"token_expires_at"         json:"expires_at,omitempty"`
	// IssuedAt is the unix time at which the token was issued.
	IssuedAt  int64 `db:"token_issued_at"          json:"issued_at"`
	CreatedBy int64 `db:"token_created_by"         json:"created_by"`
}

Represents server side infos stored for tokens we distribute.

type TokenResponse

type TokenResponse struct {
	AccessToken string `json:"access_token"`
	Token       Token  `json:"token"`
}

TokenResponse is returned as part of token creation for PAT / SAT / User Session.

type UpdatedFilter

type UpdatedFilter struct {
	UpdatedGt int64 `json:"updated_gt"`
	UpdatedLt int64 `json:"updated_lt"`
}

type User

type User struct {
	// Fields from user
	ID          int64  `db:"principal_id"             json:"-"`
	UID         string `db:"principal_uid"            json:"uid"`
	Email       string `db:"principal_email"          json:"email"`
	DisplayName string `db:"principal_display_name"   json:"display_name"`
	AvatarUrl   string `db:"principal_avatar_url"     json:"avatar_url"`
	Blocked     bool   `db:"principal_blocked"        json:"blocked"`
	Password    string `db:"principal_user_password"  json:"-"`
	Salt        string `db:"principal_salt"           json:"-"`
	Created     int64  `db:"principal_created"        json:"created"`
	Updated     int64  `db:"principal_updated"        json:"updated"`
}

User is a user representing an end user.

func (*User) ToPrincipal

func (u *User) ToPrincipal() *Principal

func (*User) ToPrincipalInfo

func (u *User) ToPrincipalInfo() *PrincipalInfo

type UserVariable

type UserVariable struct {
	UID            int64  `json:"uid"`
	Key            string `json:"key"`
	Type           string `json:"type"`
	TextValue      string `json:"text_value"`
	ReferenceValue string `json:"reference_value"`
	IsGenerated    bool   `json:"is_generated"`
}

type Variable

type Variable struct {
	UID             int64             `db:"variable_uid"              json:"uid"`
	EnvironmentID   int64             `db:"variable_environment_id"   json:"-"`
	ApplicationID   int64             `db:"variable_application_id"   json:"-"`
	ApplicationName string            `db:"application_name"          json:"application_name"`
	Key             string            `db:"variable_key"              json:"key"`
	Value           string            `db:"variable_value"            json:"value"`
	TextValue       string            `db:"variable_text_value"       json:"text_value"`
	Type            enum.VariableType `db:"variable_type"             json:"type"`
	Created         int64             `db:"variable_created"          json:"created"`
	Updated         int64             `db:"variable_updated"          json:"updated"`
}

type VariableDTO

type VariableDTO struct {
	SystemVariable []*SystemVariable
	UserVariable   []*UserVariable
}

DTO to render frontend

type Volume

type Volume struct {
	ID             int64  `db:"volume_id"              json:"-"`
	UID            int64  `db:"volume_uid"             json:"uid"`
	TenantID       int64  `db:"volume_tenant_id"       json:"-"`
	ProjectID      int64  `db:"volume_project_id"      json:"-"`
	EnvironmentID  int64  `db:"volume_environment_id"  json:"-"`
	EnvironmentUID int64  `db:"volume_environment_uid" json:"environment_uid"`
	ServerID       int64  `db:"volume_server_id"       json:"-"`
	ApplicaitonID  *int64 `db:"volume_application_id"  json:"application_id"`
	Name           string `db:"volume_name"            json:"name"`
	Slug           string `db:"volume_slug"            json:"slug"`
	ParentSlug     string `db:"volume_parent_slug"     json:"parent_slug"`
	MountPath      string `db:"volume_mount_path"      json:"mount_path"`
	HostPath       string `db:"volume_host_path"       json:"host_path"`
	Size           int64  `db:"volume_size"            json:"size"`

	Created int64  `db:"volume_created" json:"created"`
	Updated int64  `db:"volume_updated" json:"updated"`
	Deleted *int64 `db:"volume_deleted" json:"deleted"`
}

func (*Volume) FromInput

func (v *Volume) FromInput(in *VolumeCreateInput)

func (*Volume) GetIdentifierStr

func (v *Volume) GetIdentifierStr() string

helpers

func (*Volume) ToInput

func (v *Volume) ToInput() *VolumeCreateInput

type VolumeCreateInput

type VolumeCreateInput struct {
	Name      string  `json:"name"`
	Slug      string  `json:"slug"`
	MountPath string  `json:"mountPath"`
	Size      int64   `json:"size,string"`
	Server    *Server `json:"-"`
}

input

type VolumeFilter

type VolumeFilter struct {
	ListQueryFilter
	TenantID          *int64          `json:"tenant_id,omitempty"`
	ProjectID         *int64          `json:"project_id,omitempty"`
	EnvironmentID     *int64          `json:"environment_id,omitempty"`
	ApplicationID     *int64          `json:"application_id,omitempty"`
	ServerID          *int64          `json:"server_id,omitempty"`
	Sort              enum.VolumeAttr `json:"sort"`
	Order             enum.Order      `json:"order"`
	DeletedAt         *int64          `json:"deleted_at,omitempty"`
	DeletedBeforeOrAt *int64          `json:"deleted_before_or_at,omitempty"`
}

type VolumeInput

type VolumeInput struct {
	VolumesRaw string          `json:"volumesJson"`
	Volumes    []*VolumeMounts `json:"volumes"`
}

func (*VolumeInput) DecodeVolumes

func (v *VolumeInput) DecodeVolumes() error

type VolumeMounts

type VolumeMounts struct {
	VolumeName string `json:"volumeName" yaml:"volumeName" mapstructure:"volumeName"`
	VolumeSize int64  `json:"volumeSize" yaml:"volumeSize" mapstructure:"volumeSize"`
	MountPath  string `json:"mountPath" yaml:"mountPath" mapstructure:"mountPath"`
}

Volumemounts

type VolumeRestriction

type VolumeRestriction struct {
	MaxVolumes    int64
	MinVolumeSize int64
	MaxVolumeSize int64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL