Documentation
¶
Overview ¶
Copyright 2024 Daytona Platforms Inc. SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- type ApiKey
- type ApiKeyType
- type Build
- type BuildConfig
- type CachedBuild
- type ContainerConfig
- type ContainerRegistry
- type DevcontainerConfig
- type EnvironmentVariable
- type FileStatus
- type GitProviderConfig
- type GitStatus
- type Job
- type JobAction
- type JobState
- type MatchParams
- type PrebuildConfig
- type ProviderInfo
- type ResourceState
- type ResourceStateName
- type ResourceType
- type Runner
- type RunnerMetadata
- type SigningMethod
- type Status
- type Target
- type TargetConfig
- type TargetConfigManifest
- type TargetConfigProperty
- type TargetConfigPropertyType
- type TargetMetadata
- type Workspace
- type WorkspaceMetadata
- type WorkspaceTemplate
- func (wt *WorkspaceTemplate) DeletePrebuild(id string) error
- func (wt *WorkspaceTemplate) FindPrebuild(filter *MatchParams) (*PrebuildConfig, error)
- func (wt *WorkspaceTemplate) ListPrebuilds(filter *MatchParams) ([]*PrebuildConfig, error)
- func (wt *WorkspaceTemplate) SetPrebuild(p *PrebuildConfig) error
Constants ¶
View Source
const RESOURCE_UNRESPONSIVE_THRESHOLD = 30 * time.Second
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiKey ¶
type ApiKey struct { KeyHash string `json:"keyHash" validate:"required" gorm:"primaryKey"` Type ApiKeyType `json:"type" validate:"required" gorm:"not null" ` // Workspace or client name Name string `json:"name" validate:"required" gorm:"uniqueIndex;not null"` } // @name ApiKey
type ApiKeyType ¶
type ApiKeyType string
const ( ApiKeyTypeClient ApiKeyType = "client" ApiKeyTypeWorkspace ApiKeyType = "workspace" ApiKeyTypeTarget ApiKeyType = "target" ApiKeyTypeRunner ApiKeyType = "runner" )
type Build ¶
type Build struct { Id string `json:"id" validate:"required" gorm:"primaryKey"` Image *string `json:"image" validate:"optional"` User *string `json:"user" validate:"optional"` ContainerConfig ContainerConfig `json:"containerConfig" validate:"required" gorm:"serializer:json;not null"` BuildConfig *BuildConfig `json:"buildConfig" validate:"optional" gorm:"serializer:json"` Repository *gitprovider.GitRepository `json:"repository" validate:"required" gorm:"serializer:json;not null"` EnvVars map[string]string `json:"envVars" validate:"required" gorm:"serializer:json;not null"` LastJobId *string `json:"lastJobId" validate:"optional"` LastJob *Job `json:"lastJob" validate:"optional" gorm:"foreignKey:LastJobId;references:Id"` PrebuildId *string `json:"prebuildId" validate:"optional"` CreatedAt time.Time `json:"createdAt" validate:"required" gorm:"not null"` UpdatedAt time.Time `json:"updatedAt" validate:"required" gorm:"not null"` } // @name Build
func (*Build) GetBuildHash ¶
GetBuildHash returns a SHA-256 hash of the build's configuration, repository branch and environment variables.
func (*Build) GetState ¶
func (w *Build) GetState() ResourceState
type BuildConfig ¶
type BuildConfig struct { Devcontainer *DevcontainerConfig `json:"devcontainer,omitempty" validate:"optional"` CachedBuild *CachedBuild `json:"cachedBuild,omitempty" validate:"optional"` } // @name BuildConfig
type CachedBuild ¶
type CachedBuild struct { User string `json:"user" validate:"required"` Image string `json:"image" validate:"required"` } // @name CachedBuild
func GetCachedBuild ¶
func GetCachedBuild(build *Build, builds []*Build) *CachedBuild
type ContainerConfig ¶
type ContainerRegistry ¶
type ContainerRegistry struct { Server string `json:"server" validate:"required" gorm:"primaryKey"` Username string `json:"username" validate:"required"` Password string `json:"password" validate:"required"` } // @name ContainerRegistry
ContainerRegistry represents a container registry credentials
type DevcontainerConfig ¶
type DevcontainerConfig struct { FilePath string `json:"filePath" validate:"required"` } // @name DevcontainerConfig
type EnvironmentVariable ¶
type FileStatus ¶
type GitProviderConfig ¶
type GitProviderConfig struct { Id string `json:"id" validate:"required" gorm:"primaryKey"` ProviderId string `json:"providerId" validate:"required" gorm:"not null"` Username string `json:"username" validate:"required" gorm:"not null"` BaseApiUrl *string `json:"baseApiUrl,omitempty" validate:"optional"` Token string `json:"token" validate:"required" gorm:"not null"` Alias string `json:"alias" validate:"required" gorm:"uniqueIndex;not null"` SigningKey *string `json:"signingKey,omitempty" validate:"optional"` SigningMethod *SigningMethod `json:"signingMethod,omitempty" validate:"optional"` } // @name GitProvider
type GitStatus ¶
type GitStatus struct { CurrentBranch string `json:"currentBranch" validate:"required"` Files []*FileStatus `json:"fileStatus" validate:"required"` BranchPublished bool `json:"branchPublished" validate:"optional"` Ahead int `json:"ahead" validate:"optional"` Behind int `json:"behind" validate:"optional"` } // @name GitStatus
type Job ¶
type Job struct { Id string `json:"id" validate:"required" gorm:"primaryKey"` ResourceId string `json:"resourceId" validate:"required" gorm:"not null"` RunnerId *string `json:"runnerId" validate:"optional"` ResourceType ResourceType `json:"resourceType" validate:"required" gorm:"not null"` State JobState `json:"state" validate:"required" gorm:"not null"` Action JobAction `json:"action" validate:"required" gorm:"not null"` // JSON encoded metadata Metadata *string `json:"metadata" validate:"optional"` Error *string `json:"error" validate:"optional"` CreatedAt time.Time `json:"createdAt" validate:"required" gorm:"not null"` UpdatedAt time.Time `json:"updatedAt" validate:"required" gorm:"not null"` } // @name Job
type JobAction ¶
type JobAction string
const ( JobActionCreate JobAction = "create" JobActionStart JobAction = "start" JobActionStop JobAction = "stop" JobActionRestart JobAction = "restart" JobActionDelete JobAction = "delete" JobActionForceDelete JobAction = "force-delete" JobActionRun JobAction = "run" JobActionInstallProvider JobAction = "install-provider" JobActionUninstallProvider JobAction = "uninstall-provider" JobActionUpdateProvider JobAction = "update-provider" )
type MatchParams ¶
type PrebuildConfig ¶
type PrebuildConfig struct { Id string `json:"id" validate:"required" gorm:"not null"` Branch string `json:"branch" validate:"required" gorm:"not null"` CommitInterval *int `json:"commitInterval" validate:"optional"` TriggerFiles []string `json:"triggerFiles" validate:"required" gorm:"not null"` Retention int `json:"retention" validate:"required" gorm:"not null"` } // @name PrebuildConfig
PrebuildConfig holds configuration for the prebuild process
func (*PrebuildConfig) GenerateId ¶
func (p *PrebuildConfig) GenerateId() error
func (*PrebuildConfig) Match ¶
func (p *PrebuildConfig) Match(params *MatchParams) bool
type ProviderInfo ¶
type ProviderInfo struct { RunnerId string `json:"runnerId" validate:"required"` RunnerName string `json:"runnerName" validate:"required"` Name string `json:"name" validate:"required"` Version string `json:"version" validate:"required"` AgentlessTarget bool `json:"agentlessTarget" validate:"optional"` Label *string `json:"label" validate:"optional"` TargetConfigManifest TargetConfigManifest `json:"targetConfigManifest" validate:"required"` } // @name ProviderInfo
type ResourceState ¶
type ResourceState struct { Name ResourceStateName `json:"name" validate:"required"` Error *string `json:"error" validate:"optional"` UpdatedAt time.Time `json:"updatedAt" validate:"required"` } // @name ResourceState
type ResourceStateName ¶
type ResourceStateName string
const ( ResourceStateNameUndefined ResourceStateName = "undefined" ResourceStateNamePendingRun ResourceStateName = "pending-run" ResourceStateNameRunning ResourceStateName = "running" ResourceStateNameRunSuccessful ResourceStateName = "run-successful" ResourceStateNamePendingCreate ResourceStateName = "pending-create" ResourceStateNameCreating ResourceStateName = "creating" ResourceStateNamePendingStart ResourceStateName = "pending-start" ResourceStateNameStarting ResourceStateName = "starting" ResourceStateNameStarted ResourceStateName = "started" ResourceStateNamePendingStop ResourceStateName = "pending-stop" ResourceStateNameStopping ResourceStateName = "stopping" ResourceStateNameStopped ResourceStateName = "stopped" ResourceStateNamePendingRestart ResourceStateName = "pending-restart" ResourceStateNameError ResourceStateName = "error" ResourceStateNameUnresponsive ResourceStateName = "unresponsive" ResourceStateNamePendingDelete ResourceStateName = "pending-delete" ResourceStateNamePendingForcedDelete ResourceStateName = "pending-forced-delete" ResourceStateNameDeleting ResourceStateName = "deleting" ResourceStateNameDeleted ResourceStateName = "deleted" )
type ResourceType ¶
type ResourceType string // @name ResourceType
const ( ResourceTypeWorkspace ResourceType = "workspace" ResourceTypeTarget ResourceType = "target" ResourceTypeBuild ResourceType = "build" ResourceTypeRunner ResourceType = "runner" )
type Runner ¶
type Runner struct { Id string `json:"id" validate:"required" gorm:"primaryKey"` Name string `json:"name" validate:"required" gorm:"uniqueIndex;not null"` ApiKey string `json:"-" validate:"required" gorm:"not null"` Metadata *RunnerMetadata `json:"metadata" validate:"optional" gorm:"foreignKey:Id;references:RunnerId"` } // @name Runner
func (*Runner) GetState ¶
func (r *Runner) GetState() ResourceState
type RunnerMetadata ¶
type RunnerMetadata struct { RunnerId string `json:"runnerId" validate:"required" gorm:"primaryKey"` UpdatedAt time.Time `json:"updatedAt" validate:"required" gorm:"not null"` Uptime uint64 `json:"uptime" validate:"required" gorm:"not null"` RunningJobs *uint64 `json:"runningJobs,omitempty" validate:"optional" gorm:"default:0"` Providers []ProviderInfo `json:"providers" validate:"required" gorm:"serializer:json;not null"` } // @name RunnerMetadata
type SigningMethod ¶
type SigningMethod string // @name SigningMethod
const ( SigningMethodSSH SigningMethod = "ssh" SigningMethodGPG SigningMethod = "gpg" )
type Target ¶
type Target struct { Id string `json:"id" validate:"required" gorm:"primaryKey"` Name string `json:"name" validate:"required" gorm:"not null"` TargetConfigId string `json:"targetConfigId" validate:"required" gorm:"not null"` TargetConfig TargetConfig `json:"targetConfig" validate:"required" gorm:"foreignKey:TargetConfigId"` ApiKey string `json:"-" validate:"required" gorm:"not null"` EnvVars map[string]string `json:"envVars" validate:"required" gorm:"serializer:json;not null"` IsDefault bool `json:"default" validate:"required" gorm:"not null"` Workspaces []Workspace `json:"workspaces" validate:"required"` Metadata *TargetMetadata `json:"metadata" validate:"optional" gorm:"foreignKey:Id;references:TargetId"` LastJobId *string `json:"lastJobId" validate:"optional"` LastJob *Job `json:"lastJob" validate:"optional" gorm:"foreignKey:LastJobId;references:Id"` ProviderMetadata *string `json:"providerMetadata,omitempty" validate:"optional"` } // @name Target
func (*Target) GetState ¶
func (t *Target) GetState() ResourceState
type TargetConfig ¶
type TargetConfig struct { Id string `json:"id" validate:"required" gorm:"primaryKey"` Name string `json:"name" validate:"required" gorm:"not null"` ProviderInfo ProviderInfo `json:"providerInfo" validate:"required" gorm:"serializer:json;not null"` // JSON encoded map of options Options string `json:"options" validate:"required" gorm:"not null"` Deleted bool `json:"deleted" validate:"required" gorm:"not null"` } // @name TargetConfig
type TargetConfigManifest ¶
type TargetConfigManifest map[string]TargetConfigProperty // @name TargetConfigManifest
type TargetConfigProperty ¶
type TargetConfigProperty struct { Type TargetConfigPropertyType InputMasked bool // A regex string matched with the name of the target config to determine if the property should be disabled // If the regex matches the target config name, the property will be disabled // E.g. "^local$" will disable the property for the local target DisabledPredicate string // DefaultValue is converted into the appropriate type based on the Type // If the property is a FilePath, the DefaultValue is a path to a directory DefaultValue string // Brief description of the property Description string // Options is only used if the Type is TargetConfigPropertyTypeOption Options []string // Suggestions is an optional list of auto-complete values to assist the user while filling the field Suggestions []string } // @name TargetConfigProperty
type TargetConfigPropertyType ¶
type TargetConfigPropertyType string
const ( TargetConfigPropertyTypeString TargetConfigPropertyType = "string" TargetConfigPropertyTypeOption TargetConfigPropertyType = "option" TargetConfigPropertyTypeBoolean TargetConfigPropertyType = "boolean" TargetConfigPropertyTypeInt TargetConfigPropertyType = "int" TargetConfigPropertyTypeFloat TargetConfigPropertyType = "float" TargetConfigPropertyTypeFilePath TargetConfigPropertyType = "file-path" )
type TargetMetadata ¶
type Workspace ¶
type Workspace struct { Id string `json:"id" validate:"required" gorm:"primaryKey"` Name string `json:"name" validate:"required" gorm:"not null"` Image string `json:"image" validate:"required" gorm:"not null"` User string `json:"user" validate:"required" gorm:"not null"` BuildConfig *BuildConfig `json:"buildConfig,omitempty" validate:"optional" gorm:"serializer:json"` Repository *gitprovider.GitRepository `json:"repository" validate:"required" gorm:"serializer:json;not null"` EnvVars map[string]string `json:"envVars" validate:"required" gorm:"serializer:json;not null"` Labels map[string]string `json:"labels" validate:"required" gorm:"serializer:json;not null"` TargetId string `json:"targetId" validate:"required" gorm:"not null"` Target Target `json:"target" validate:"required" gorm:"foreignKey:TargetId"` ApiKey string `json:"apiKey" validate:"required" gorm:"not null"` Metadata *WorkspaceMetadata `json:"metadata" validate:"optional" gorm:"foreignKey:Id;references:WorkspaceId"` GitProviderConfigId *string `json:"gitProviderConfigId,omitempty" validate:"optional"` LastJobId *string `json:"lastJobId" validate:"optional"` LastJob *Job `json:"lastJob" validate:"optional" gorm:"foreignKey:LastJobId;references:Id"` ProviderMetadata *string `json:"providerMetadata,omitempty" validate:"optional"` } // @name Workspace
func (*Workspace) GetState ¶
func (w *Workspace) GetState() ResourceState
func (*Workspace) WorkspaceFolderName ¶
type WorkspaceMetadata ¶
type WorkspaceMetadata struct { WorkspaceId string `json:"workspaceId" validate:"required" gorm:"primaryKey"` UpdatedAt time.Time `json:"updatedAt" validate:"required" gorm:"not null"` Uptime uint64 `json:"uptime" validate:"required" gorm:"not null"` GitStatus *GitStatus `json:"gitStatus" validate:"optional" gorm:"serializer:json"` } // @name WorkspaceMetadata
type WorkspaceTemplate ¶
type WorkspaceTemplate struct { Name string `json:"name" validate:"required" gorm:"primaryKey"` Image string `json:"image" validate:"required" gorm:"not null"` User string `json:"user" validate:"required" gorm:"not null"` BuildConfig *BuildConfig `json:"buildConfig,omitempty" validate:"optional" gorm:"serializer:json"` RepositoryUrl string `json:"repositoryUrl" validate:"required" gorm:"not null"` EnvVars map[string]string `json:"envVars" validate:"required" gorm:"serializer:json;not null"` Labels map[string]string `json:"labels" validate:"required" gorm:"serializer:json;not null"` IsDefault bool `json:"default" validate:"required" gorm:"not null"` Prebuilds []*PrebuildConfig `json:"prebuilds" validate:"optional" gorm:"serializer:json"` GitProviderConfigId *string `json:"gitProviderConfigId" validate:"optional"` } // @name WorkspaceTemplate
func (*WorkspaceTemplate) DeletePrebuild ¶
func (wt *WorkspaceTemplate) DeletePrebuild(id string) error
func (*WorkspaceTemplate) FindPrebuild ¶
func (wt *WorkspaceTemplate) FindPrebuild(filter *MatchParams) (*PrebuildConfig, error)
func (*WorkspaceTemplate) ListPrebuilds ¶
func (wt *WorkspaceTemplate) ListPrebuilds(filter *MatchParams) ([]*PrebuildConfig, error)
func (*WorkspaceTemplate) SetPrebuild ¶
func (wt *WorkspaceTemplate) SetPrebuild(p *PrebuildConfig) error
Click to show internal directories.
Click to hide internal directories.