Documentation ¶
Overview ¶
Package database connects to external services for stateful storage.
Query functions are generated using sqlc.
To modify the database schema: 1. Add a new migration using "create_migration.sh" in database/migrations/ 2. Run "make coderd/database/generate" in the root to generate models. 3. Add/Edit queries in "query.sql" and run "make coderd/database/generate" to create Go code.
Index ¶
- func CheckLatestVersion(sourceDriver source.Driver, currentVersion uint) error
- func EnsureClean(db *sql.DB) error
- func MigrateDown(db *sql.DB) error
- func MigrateUp(db *sql.DB) error
- func Now() time.Time
- type APIKey
- type AcquireProvisionerJobParams
- type AuditAction
- type AuditLog
- type DBTX
- type File
- type GetAuditLogsBeforeParams
- type GetAuthorizationUserRolesRow
- type GetOrganizationIDsByMemberIDsRow
- type GetOrganizationMemberByUserIDParams
- type GetParameterValueByScopeAndNameParams
- type GetParameterValuesByScopeParams
- type GetProvisionerLogsByIDBetweenParams
- type GetTemplateByOrganizationAndNameParams
- type GetTemplateVersionByTemplateIDAndNameParams
- type GetTemplateVersionsByTemplateIDParams
- type GetTemplatesByOrganizationParams
- type GetUserByEmailOrUsernameParams
- type GetUsersParams
- type GetWorkspaceAppByAgentIDAndNameParams
- type GetWorkspaceBuildByWorkspaceIDAndNameParams
- type GetWorkspaceBuildByWorkspaceIDParams
- type GetWorkspaceByOwnerIDAndNameParams
- type GetWorkspaceOwnerCountsByTemplateIDsRow
- type GetWorkspacesByOrganizationIDsParams
- type GetWorkspacesByTemplateIDParams
- type GetWorkspacesWithFilterParams
- type GitSSHKey
- type InsertAPIKeyParams
- type InsertAuditLogParams
- type InsertFileParams
- type InsertGitSSHKeyParams
- type InsertOrganizationMemberParams
- type InsertOrganizationParams
- type InsertParameterSchemaParams
- type InsertParameterValueParams
- type InsertProvisionerDaemonParams
- type InsertProvisionerJobLogsParams
- type InsertProvisionerJobParams
- type InsertTemplateParams
- type InsertTemplateVersionParams
- type InsertUserParams
- type InsertWorkspaceAgentParams
- type InsertWorkspaceAppParams
- type InsertWorkspaceBuildParams
- type InsertWorkspaceParams
- type InsertWorkspaceResourceParams
- type License
- type Listener
- type LogLevel
- type LogSource
- type LoginType
- type Organization
- type OrganizationMember
- type ParameterDestinationScheme
- type ParameterSchema
- type ParameterScope
- type ParameterSourceScheme
- type ParameterTypeSystem
- type ParameterValue
- type ProvisionerDaemon
- type ProvisionerJob
- type ProvisionerJobLog
- type ProvisionerJobType
- type ProvisionerStorageMethod
- type ProvisionerType
- type Pubsub
- type ResourceType
- type Store
- type Template
- type TemplateVersion
- type UpdateAPIKeyByIDParams
- type UpdateGitSSHKeyParams
- type UpdateMemberRolesParams
- type UpdateProvisionerDaemonByIDParams
- type UpdateProvisionerJobByIDParams
- type UpdateProvisionerJobWithCancelByIDParams
- type UpdateProvisionerJobWithCompleteByIDParams
- type UpdateTemplateActiveVersionByIDParams
- type UpdateTemplateDeletedByIDParams
- type UpdateTemplateMetaByIDParams
- type UpdateTemplateVersionByIDParams
- type UpdateTemplateVersionDescriptionByJobIDParams
- type UpdateUserHashedPasswordParams
- type UpdateUserProfileParams
- type UpdateUserRolesParams
- type UpdateUserStatusParams
- type UpdateWorkspaceAgentConnectionByIDParams
- type UpdateWorkspaceAutostartParams
- type UpdateWorkspaceBuildByIDParams
- type UpdateWorkspaceDeletedByIDParams
- type UpdateWorkspaceTTLParams
- type User
- type UserStatus
- type Workspace
- type WorkspaceAgent
- type WorkspaceApp
- type WorkspaceBuild
- type WorkspaceResource
- type WorkspaceTransition
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckLatestVersion ¶ added in v0.5.6
Returns nil if currentVersion corresponds to the latest available migration, otherwise an error explaining why not.
func EnsureClean ¶ added in v0.5.6
EnsureClean checks whether all migrations for the current version have been applied, without making any changes to the database. If not, returns a non-nil error.
Types ¶
type APIKey ¶
type APIKey struct { ID string `db:"id" json:"id"` HashedSecret []byte `db:"hashed_secret" json:"hashed_secret"` UserID uuid.UUID `db:"user_id" json:"user_id"` LastUsed time.Time `db:"last_used" json:"last_used"` ExpiresAt time.Time `db:"expires_at" json:"expires_at"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` LoginType LoginType `db:"login_type" json:"login_type"` OAuthAccessToken string `db:"oauth_access_token" json:"oauth_access_token"` OAuthRefreshToken string `db:"oauth_refresh_token" json:"oauth_refresh_token"` OAuthIDToken string `db:"oauth_id_token" json:"oauth_id_token"` OAuthExpiry time.Time `db:"oauth_expiry" json:"oauth_expiry"` LifetimeSeconds int64 `db:"lifetime_seconds" json:"lifetime_seconds"` }
type AcquireProvisionerJobParams ¶
type AcquireProvisionerJobParams struct { StartedAt sql.NullTime `db:"started_at" json:"started_at"` WorkerID uuid.NullUUID `db:"worker_id" json:"worker_id"` Types []ProvisionerType `db:"types" json:"types"` }
type AuditAction ¶ added in v0.5.3
type AuditAction string
const ( AuditActionCreate AuditAction = "create" AuditActionWrite AuditAction = "write" AuditActionDelete AuditAction = "delete" )
func (*AuditAction) Scan ¶ added in v0.5.3
func (e *AuditAction) Scan(src interface{}) error
type AuditLog ¶ added in v0.5.3
type AuditLog struct { ID uuid.UUID `db:"id" json:"id"` Time time.Time `db:"time" json:"time"` UserID uuid.UUID `db:"user_id" json:"user_id"` OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"` Ip pqtype.Inet `db:"ip" json:"ip"` UserAgent string `db:"user_agent" json:"user_agent"` ResourceType ResourceType `db:"resource_type" json:"resource_type"` ResourceID uuid.UUID `db:"resource_id" json:"resource_id"` ResourceTarget string `db:"resource_target" json:"resource_target"` Action AuditAction `db:"action" json:"action"` Diff json.RawMessage `db:"diff" json:"diff"` StatusCode int32 `db:"status_code" json:"status_code"` }
type DBTX ¶
type DBTX interface { ExecContext(context.Context, string, ...interface{}) (sql.Result, error) PrepareContext(context.Context, string) (*sql.Stmt, error) QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) QueryRowContext(context.Context, string, ...interface{}) *sql.Row }
DBTX represents a database connection or transaction.
type File ¶
type File struct { Hash string `db:"hash" json:"hash"` CreatedAt time.Time `db:"created_at" json:"created_at"` CreatedBy uuid.UUID `db:"created_by" json:"created_by"` Mimetype string `db:"mimetype" json:"mimetype"` Data []byte `db:"data" json:"data"` }
func (File) RBACObject ¶ added in v0.6.1
type GetAuditLogsBeforeParams ¶ added in v0.5.3
type GetAuthorizationUserRolesRow ¶ added in v0.6.1
type GetAuthorizationUserRolesRow struct { ID uuid.UUID `db:"id" json:"id"` Username string `db:"username" json:"username"` Status UserStatus `db:"status" json:"status"` Roles []string `db:"roles" json:"roles"` }
type GetOrganizationIDsByMemberIDsRow ¶ added in v0.5.1
type GetParameterValueByScopeAndNameParams ¶
type GetParameterValueByScopeAndNameParams struct { Scope ParameterScope `db:"scope" json:"scope"` ScopeID uuid.UUID `db:"scope_id" json:"scope_id"` Name string `db:"name" json:"name"` }
type GetParameterValuesByScopeParams ¶
type GetParameterValuesByScopeParams struct { Scope ParameterScope `db:"scope" json:"scope"` ScopeID uuid.UUID `db:"scope_id" json:"scope_id"` }
type GetTemplateByOrganizationAndNameParams ¶ added in v0.4.0
type GetTemplateVersionByTemplateIDAndNameParams ¶ added in v0.4.0
type GetTemplateVersionsByTemplateIDParams ¶ added in v0.5.6
type GetTemplatesByOrganizationParams ¶ added in v0.4.0
type GetUsersParams ¶ added in v0.4.4
type GetWorkspaceAppByAgentIDAndNameParams ¶ added in v0.6.2
type GetWorkspaceBuildByWorkspaceIDParams ¶ added in v0.6.0
type GetWorkspaceByOwnerIDAndNameParams ¶ added in v0.5.0
type GetWorkspaceOwnerCountsByTemplateIDsRow ¶ added in v0.4.0
type GetWorkspacesByOrganizationIDsParams ¶ added in v0.5.6
type GetWorkspacesByTemplateIDParams ¶ added in v0.4.0
type GetWorkspacesWithFilterParams ¶ added in v0.6.0
type InsertAPIKeyParams ¶
type InsertAPIKeyParams struct { ID string `db:"id" json:"id"` LifetimeSeconds int64 `db:"lifetime_seconds" json:"lifetime_seconds"` HashedSecret []byte `db:"hashed_secret" json:"hashed_secret"` UserID uuid.UUID `db:"user_id" json:"user_id"` LastUsed time.Time `db:"last_used" json:"last_used"` ExpiresAt time.Time `db:"expires_at" json:"expires_at"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` LoginType LoginType `db:"login_type" json:"login_type"` OAuthAccessToken string `db:"oauth_access_token" json:"oauth_access_token"` OAuthRefreshToken string `db:"oauth_refresh_token" json:"oauth_refresh_token"` OAuthIDToken string `db:"oauth_id_token" json:"oauth_id_token"` OAuthExpiry time.Time `db:"oauth_expiry" json:"oauth_expiry"` }
type InsertAuditLogParams ¶ added in v0.5.3
type InsertAuditLogParams struct { ID uuid.UUID `db:"id" json:"id"` Time time.Time `db:"time" json:"time"` UserID uuid.UUID `db:"user_id" json:"user_id"` OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"` Ip pqtype.Inet `db:"ip" json:"ip"` UserAgent string `db:"user_agent" json:"user_agent"` ResourceType ResourceType `db:"resource_type" json:"resource_type"` ResourceID uuid.UUID `db:"resource_id" json:"resource_id"` ResourceTarget string `db:"resource_target" json:"resource_target"` Action AuditAction `db:"action" json:"action"` Diff json.RawMessage `db:"diff" json:"diff"` StatusCode int32 `db:"status_code" json:"status_code"` }
type InsertFileParams ¶
type InsertGitSSHKeyParams ¶ added in v0.4.0
type InsertGitSSHKeyParams struct { UserID uuid.UUID `db:"user_id" json:"user_id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` PrivateKey string `db:"private_key" json:"private_key"` PublicKey string `db:"public_key" json:"public_key"` }
type InsertOrganizationMemberParams ¶
type InsertOrganizationMemberParams struct { OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"` UserID uuid.UUID `db:"user_id" json:"user_id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` Roles []string `db:"roles" json:"roles"` }
type InsertParameterSchemaParams ¶
type InsertParameterSchemaParams struct { ID uuid.UUID `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` JobID uuid.UUID `db:"job_id" json:"job_id"` Name string `db:"name" json:"name"` Description string `db:"description" json:"description"` DefaultSourceScheme ParameterSourceScheme `db:"default_source_scheme" json:"default_source_scheme"` DefaultSourceValue string `db:"default_source_value" json:"default_source_value"` AllowOverrideSource bool `db:"allow_override_source" json:"allow_override_source"` DefaultDestinationScheme ParameterDestinationScheme `db:"default_destination_scheme" json:"default_destination_scheme"` AllowOverrideDestination bool `db:"allow_override_destination" json:"allow_override_destination"` DefaultRefresh string `db:"default_refresh" json:"default_refresh"` RedisplayValue bool `db:"redisplay_value" json:"redisplay_value"` ValidationError string `db:"validation_error" json:"validation_error"` ValidationCondition string `db:"validation_condition" json:"validation_condition"` ValidationTypeSystem ParameterTypeSystem `db:"validation_type_system" json:"validation_type_system"` ValidationValueType string `db:"validation_value_type" json:"validation_value_type"` }
type InsertParameterValueParams ¶
type InsertParameterValueParams struct { ID uuid.UUID `db:"id" json:"id"` Name string `db:"name" json:"name"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` Scope ParameterScope `db:"scope" json:"scope"` ScopeID uuid.UUID `db:"scope_id" json:"scope_id"` SourceScheme ParameterSourceScheme `db:"source_scheme" json:"source_scheme"` SourceValue string `db:"source_value" json:"source_value"` DestinationScheme ParameterDestinationScheme `db:"destination_scheme" json:"destination_scheme"` }
type InsertProvisionerJobLogsParams ¶
type InsertProvisionerJobLogsParams struct { ID []uuid.UUID `db:"id" json:"id"` JobID uuid.UUID `db:"job_id" json:"job_id"` CreatedAt []time.Time `db:"created_at" json:"created_at"` Source []LogSource `db:"source" json:"source"` Level []LogLevel `db:"level" json:"level"` Stage []string `db:"stage" json:"stage"` Output []string `db:"output" json:"output"` }
type InsertProvisionerJobParams ¶
type InsertProvisionerJobParams struct { ID uuid.UUID `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"` InitiatorID uuid.UUID `db:"initiator_id" json:"initiator_id"` Provisioner ProvisionerType `db:"provisioner" json:"provisioner"` StorageMethod ProvisionerStorageMethod `db:"storage_method" json:"storage_method"` StorageSource string `db:"storage_source" json:"storage_source"` Type ProvisionerJobType `db:"type" json:"type"` Input json.RawMessage `db:"input" json:"input"` }
type InsertTemplateParams ¶ added in v0.4.0
type InsertTemplateParams struct { ID uuid.UUID `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"` Name string `db:"name" json:"name"` Provisioner ProvisionerType `db:"provisioner" json:"provisioner"` ActiveVersionID uuid.UUID `db:"active_version_id" json:"active_version_id"` Description string `db:"description" json:"description"` MaxTtl int64 `db:"max_ttl" json:"max_ttl"` MinAutostartInterval int64 `db:"min_autostart_interval" json:"min_autostart_interval"` }
type InsertTemplateVersionParams ¶ added in v0.4.0
type InsertTemplateVersionParams struct { ID uuid.UUID `db:"id" json:"id"` TemplateID uuid.NullUUID `db:"template_id" json:"template_id"` OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` Name string `db:"name" json:"name"` Readme string `db:"readme" json:"readme"` JobID uuid.UUID `db:"job_id" json:"job_id"` }
type InsertUserParams ¶
type InsertUserParams struct { ID uuid.UUID `db:"id" json:"id"` Email string `db:"email" json:"email"` Username string `db:"username" json:"username"` HashedPassword []byte `db:"hashed_password" json:"hashed_password"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` RBACRoles []string `db:"rbac_roles" json:"rbac_roles"` }
type InsertWorkspaceAgentParams ¶
type InsertWorkspaceAgentParams struct { ID uuid.UUID `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` Name string `db:"name" json:"name"` ResourceID uuid.UUID `db:"resource_id" json:"resource_id"` AuthToken uuid.UUID `db:"auth_token" json:"auth_token"` AuthInstanceID sql.NullString `db:"auth_instance_id" json:"auth_instance_id"` Architecture string `db:"architecture" json:"architecture"` EnvironmentVariables pqtype.NullRawMessage `db:"environment_variables" json:"environment_variables"` OperatingSystem string `db:"operating_system" json:"operating_system"` StartupScript sql.NullString `db:"startup_script" json:"startup_script"` Directory string `db:"directory" json:"directory"` InstanceMetadata pqtype.NullRawMessage `db:"instance_metadata" json:"instance_metadata"` ResourceMetadata pqtype.NullRawMessage `db:"resource_metadata" json:"resource_metadata"` }
type InsertWorkspaceAppParams ¶ added in v0.6.2
type InsertWorkspaceAppParams struct { ID uuid.UUID `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` AgentID uuid.UUID `db:"agent_id" json:"agent_id"` Name string `db:"name" json:"name"` Icon string `db:"icon" json:"icon"` Command sql.NullString `db:"command" json:"command"` Url sql.NullString `db:"url" json:"url"` RelativePath bool `db:"relative_path" json:"relative_path"` }
type InsertWorkspaceBuildParams ¶
type InsertWorkspaceBuildParams struct { ID uuid.UUID `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` WorkspaceID uuid.UUID `db:"workspace_id" json:"workspace_id"` TemplateVersionID uuid.UUID `db:"template_version_id" json:"template_version_id"` BuildNumber int32 `db:"build_number" json:"build_number"` Name string `db:"name" json:"name"` Transition WorkspaceTransition `db:"transition" json:"transition"` InitiatorID uuid.UUID `db:"initiator_id" json:"initiator_id"` JobID uuid.UUID `db:"job_id" json:"job_id"` ProvisionerState []byte `db:"provisioner_state" json:"provisioner_state"` Deadline time.Time `db:"deadline" json:"deadline"` }
type InsertWorkspaceParams ¶
type InsertWorkspaceParams struct { ID uuid.UUID `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` OwnerID uuid.UUID `db:"owner_id" json:"owner_id"` OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"` TemplateID uuid.UUID `db:"template_id" json:"template_id"` Name string `db:"name" json:"name"` AutostartSchedule sql.NullString `db:"autostart_schedule" json:"autostart_schedule"` Ttl sql.NullInt64 `db:"ttl" json:"ttl"` }
type InsertWorkspaceResourceParams ¶
type InsertWorkspaceResourceParams struct { ID uuid.UUID `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` JobID uuid.UUID `db:"job_id" json:"job_id"` Transition WorkspaceTransition `db:"transition" json:"transition"` Type string `db:"type" json:"type"` Name string `db:"name" json:"name"` }
type License ¶
type License struct { ID int32 `db:"id" json:"id"` License json.RawMessage `db:"license" json:"license"` CreatedAt time.Time `db:"created_at" json:"created_at"` }
type Organization ¶
type Organization struct { ID uuid.UUID `db:"id" json:"id"` Name string `db:"name" json:"name"` Description string `db:"description" json:"description"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` }
func (Organization) RBACObject ¶ added in v0.6.0
func (o Organization) RBACObject() rbac.Object
type OrganizationMember ¶
type OrganizationMember struct { UserID uuid.UUID `db:"user_id" json:"user_id"` OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` Roles []string `db:"roles" json:"roles"` }
func (OrganizationMember) RBACObject ¶ added in v0.6.0
func (m OrganizationMember) RBACObject() rbac.Object
type ParameterDestinationScheme ¶
type ParameterDestinationScheme string
const ( ParameterDestinationSchemeNone ParameterDestinationScheme = "none" ParameterDestinationSchemeEnvironmentVariable ParameterDestinationScheme = "environment_variable" ParameterDestinationSchemeProvisionerVariable ParameterDestinationScheme = "provisioner_variable" )
func (*ParameterDestinationScheme) Scan ¶
func (e *ParameterDestinationScheme) Scan(src interface{}) error
type ParameterSchema ¶
type ParameterSchema struct { ID uuid.UUID `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` JobID uuid.UUID `db:"job_id" json:"job_id"` Name string `db:"name" json:"name"` Description string `db:"description" json:"description"` DefaultSourceScheme ParameterSourceScheme `db:"default_source_scheme" json:"default_source_scheme"` DefaultSourceValue string `db:"default_source_value" json:"default_source_value"` AllowOverrideSource bool `db:"allow_override_source" json:"allow_override_source"` DefaultDestinationScheme ParameterDestinationScheme `db:"default_destination_scheme" json:"default_destination_scheme"` AllowOverrideDestination bool `db:"allow_override_destination" json:"allow_override_destination"` DefaultRefresh string `db:"default_refresh" json:"default_refresh"` RedisplayValue bool `db:"redisplay_value" json:"redisplay_value"` ValidationError string `db:"validation_error" json:"validation_error"` ValidationCondition string `db:"validation_condition" json:"validation_condition"` ValidationTypeSystem ParameterTypeSystem `db:"validation_type_system" json:"validation_type_system"` ValidationValueType string `db:"validation_value_type" json:"validation_value_type"` }
type ParameterScope ¶
type ParameterScope string
const ( ParameterScopeTemplate ParameterScope = "template" ParameterScopeImportJob ParameterScope = "import_job" ParameterScopeWorkspace ParameterScope = "workspace" )
func (*ParameterScope) Scan ¶
func (e *ParameterScope) Scan(src interface{}) error
type ParameterSourceScheme ¶
type ParameterSourceScheme string
const ( ParameterSourceSchemeNone ParameterSourceScheme = "none" ParameterSourceSchemeData ParameterSourceScheme = "data" )
func (*ParameterSourceScheme) Scan ¶
func (e *ParameterSourceScheme) Scan(src interface{}) error
type ParameterTypeSystem ¶
type ParameterTypeSystem string
const ( ParameterTypeSystemNone ParameterTypeSystem = "none" ParameterTypeSystemHCL ParameterTypeSystem = "hcl" )
func (*ParameterTypeSystem) Scan ¶
func (e *ParameterTypeSystem) Scan(src interface{}) error
type ParameterValue ¶
type ParameterValue struct { ID uuid.UUID `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` Scope ParameterScope `db:"scope" json:"scope"` ScopeID uuid.UUID `db:"scope_id" json:"scope_id"` Name string `db:"name" json:"name"` SourceScheme ParameterSourceScheme `db:"source_scheme" json:"source_scheme"` SourceValue string `db:"source_value" json:"source_value"` DestinationScheme ParameterDestinationScheme `db:"destination_scheme" json:"destination_scheme"` }
type ProvisionerDaemon ¶
type ProvisionerDaemon struct { ID uuid.UUID `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt sql.NullTime `db:"updated_at" json:"updated_at"` Name string `db:"name" json:"name"` Provisioners []ProvisionerType `db:"provisioners" json:"provisioners"` }
func (ProvisionerDaemon) RBACObject ¶ added in v0.6.1
func (d ProvisionerDaemon) RBACObject() rbac.Object
type ProvisionerJob ¶
type ProvisionerJob struct { ID uuid.UUID `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` StartedAt sql.NullTime `db:"started_at" json:"started_at"` CanceledAt sql.NullTime `db:"canceled_at" json:"canceled_at"` CompletedAt sql.NullTime `db:"completed_at" json:"completed_at"` Error sql.NullString `db:"error" json:"error"` OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"` InitiatorID uuid.UUID `db:"initiator_id" json:"initiator_id"` Provisioner ProvisionerType `db:"provisioner" json:"provisioner"` StorageMethod ProvisionerStorageMethod `db:"storage_method" json:"storage_method"` StorageSource string `db:"storage_source" json:"storage_source"` Type ProvisionerJobType `db:"type" json:"type"` Input json.RawMessage `db:"input" json:"input"` WorkerID uuid.NullUUID `db:"worker_id" json:"worker_id"` }
type ProvisionerJobLog ¶
type ProvisionerJobLog struct { ID uuid.UUID `db:"id" json:"id"` JobID uuid.UUID `db:"job_id" json:"job_id"` CreatedAt time.Time `db:"created_at" json:"created_at"` Source LogSource `db:"source" json:"source"` Level LogLevel `db:"level" json:"level"` Stage string `db:"stage" json:"stage"` Output string `db:"output" json:"output"` }
type ProvisionerJobType ¶
type ProvisionerJobType string
const ( ProvisionerJobTypeTemplateVersionImport ProvisionerJobType = "template_version_import" ProvisionerJobTypeWorkspaceBuild ProvisionerJobType = "workspace_build" ProvisionerJobTypeTemplateVersionDryRun ProvisionerJobType = "template_version_dry_run" )
func (*ProvisionerJobType) Scan ¶
func (e *ProvisionerJobType) Scan(src interface{}) error
type ProvisionerStorageMethod ¶
type ProvisionerStorageMethod string
const (
ProvisionerStorageMethodFile ProvisionerStorageMethod = "file"
)
func (*ProvisionerStorageMethod) Scan ¶
func (e *ProvisionerStorageMethod) Scan(src interface{}) error
type ProvisionerType ¶
type ProvisionerType string
const ( ProvisionerTypeEcho ProvisionerType = "echo" ProvisionerTypeTerraform ProvisionerType = "terraform" )
func (*ProvisionerType) Scan ¶
func (e *ProvisionerType) Scan(src interface{}) error
type Pubsub ¶
type Pubsub interface { Subscribe(event string, listener Listener) (cancel func(), err error) Publish(event string, message []byte) error Close() error }
Pubsub is a generic interface for broadcasting and receiving messages. Implementors should assume high-availability with the backing implementation.
func NewPubsubInMemory ¶
func NewPubsubInMemory() Pubsub
type ResourceType ¶ added in v0.5.3
type ResourceType string
const ( ResourceTypeOrganization ResourceType = "organization" ResourceTypeTemplate ResourceType = "template" ResourceTypeTemplateVersion ResourceType = "template_version" ResourceTypeUser ResourceType = "user" ResourceTypeWorkspace ResourceType = "workspace" )
func (*ResourceType) Scan ¶ added in v0.5.3
func (e *ResourceType) Scan(src interface{}) error
type Store ¶
Store contains all queryable database functions. It extends the generated interface to add transaction support.
type Template ¶ added in v0.4.0
type Template struct { ID uuid.UUID `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"` Deleted bool `db:"deleted" json:"deleted"` Name string `db:"name" json:"name"` Provisioner ProvisionerType `db:"provisioner" json:"provisioner"` ActiveVersionID uuid.UUID `db:"active_version_id" json:"active_version_id"` Description string `db:"description" json:"description"` MaxTtl int64 `db:"max_ttl" json:"max_ttl"` MinAutostartInterval int64 `db:"min_autostart_interval" json:"min_autostart_interval"` }
func (Template) RBACObject ¶ added in v0.6.0
type TemplateVersion ¶ added in v0.4.0
type TemplateVersion struct { ID uuid.UUID `db:"id" json:"id"` TemplateID uuid.NullUUID `db:"template_id" json:"template_id"` OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` Name string `db:"name" json:"name"` Readme string `db:"readme" json:"readme"` JobID uuid.UUID `db:"job_id" json:"job_id"` }
func (TemplateVersion) RBACObject ¶ added in v0.6.0
func (t TemplateVersion) RBACObject() rbac.Object
type UpdateAPIKeyByIDParams ¶
type UpdateAPIKeyByIDParams struct { ID string `db:"id" json:"id"` LastUsed time.Time `db:"last_used" json:"last_used"` ExpiresAt time.Time `db:"expires_at" json:"expires_at"` OAuthAccessToken string `db:"oauth_access_token" json:"oauth_access_token"` OAuthRefreshToken string `db:"oauth_refresh_token" json:"oauth_refresh_token"` OAuthExpiry time.Time `db:"oauth_expiry" json:"oauth_expiry"` }
type UpdateGitSSHKeyParams ¶ added in v0.4.0
type UpdateMemberRolesParams ¶ added in v0.5.2
type UpdateProvisionerDaemonByIDParams ¶
type UpdateProvisionerDaemonByIDParams struct { ID uuid.UUID `db:"id" json:"id"` UpdatedAt sql.NullTime `db:"updated_at" json:"updated_at"` Provisioners []ProvisionerType `db:"provisioners" json:"provisioners"` }
type UpdateTemplateActiveVersionByIDParams ¶ added in v0.4.0
type UpdateTemplateDeletedByIDParams ¶ added in v0.4.0
type UpdateTemplateMetaByIDParams ¶ added in v0.6.3
type UpdateTemplateMetaByIDParams struct { ID uuid.UUID `db:"id" json:"id"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` Description string `db:"description" json:"description"` MaxTtl int64 `db:"max_ttl" json:"max_ttl"` MinAutostartInterval int64 `db:"min_autostart_interval" json:"min_autostart_interval"` }
type UpdateTemplateVersionByIDParams ¶ added in v0.4.0
type UpdateTemplateVersionDescriptionByJobIDParams ¶ added in v0.5.10
type UpdateUserHashedPasswordParams ¶ added in v0.5.5
type UpdateUserProfileParams ¶ added in v0.4.2
type UpdateUserRolesParams ¶ added in v0.5.2
type UpdateUserStatusParams ¶ added in v0.5.1
type UpdateUserStatusParams struct { ID uuid.UUID `db:"id" json:"id"` Status UserStatus `db:"status" json:"status"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` }
type UpdateWorkspaceAgentConnectionByIDParams ¶
type UpdateWorkspaceAgentConnectionByIDParams struct { ID uuid.UUID `db:"id" json:"id"` FirstConnectedAt sql.NullTime `db:"first_connected_at" json:"first_connected_at"` LastConnectedAt sql.NullTime `db:"last_connected_at" json:"last_connected_at"` DisconnectedAt sql.NullTime `db:"disconnected_at" json:"disconnected_at"` }
type UpdateWorkspaceAutostartParams ¶ added in v0.4.1
type UpdateWorkspaceAutostartParams struct { ID uuid.UUID `db:"id" json:"id"` AutostartSchedule sql.NullString `db:"autostart_schedule" json:"autostart_schedule"` }
type UpdateWorkspaceTTLParams ¶ added in v0.6.0
type User ¶
type User struct { ID uuid.UUID `db:"id" json:"id"` Email string `db:"email" json:"email"` Username string `db:"username" json:"username"` HashedPassword []byte `db:"hashed_password" json:"hashed_password"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` Status UserStatus `db:"status" json:"status"` RBACRoles []string `db:"rbac_roles" json:"rbac_roles"` }
type UserStatus ¶ added in v0.5.1
type UserStatus string
const ( UserStatusActive UserStatus = "active" UserStatusSuspended UserStatus = "suspended" )
func (*UserStatus) Scan ¶ added in v0.5.1
func (e *UserStatus) Scan(src interface{}) error
type Workspace ¶
type Workspace struct { ID uuid.UUID `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` OwnerID uuid.UUID `db:"owner_id" json:"owner_id"` OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"` TemplateID uuid.UUID `db:"template_id" json:"template_id"` Deleted bool `db:"deleted" json:"deleted"` Name string `db:"name" json:"name"` AutostartSchedule sql.NullString `db:"autostart_schedule" json:"autostart_schedule"` Ttl sql.NullInt64 `db:"ttl" json:"ttl"` }
func (Workspace) RBACObject ¶ added in v0.6.0
type WorkspaceAgent ¶
type WorkspaceAgent struct { ID uuid.UUID `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` Name string `db:"name" json:"name"` FirstConnectedAt sql.NullTime `db:"first_connected_at" json:"first_connected_at"` LastConnectedAt sql.NullTime `db:"last_connected_at" json:"last_connected_at"` DisconnectedAt sql.NullTime `db:"disconnected_at" json:"disconnected_at"` ResourceID uuid.UUID `db:"resource_id" json:"resource_id"` AuthToken uuid.UUID `db:"auth_token" json:"auth_token"` AuthInstanceID sql.NullString `db:"auth_instance_id" json:"auth_instance_id"` Architecture string `db:"architecture" json:"architecture"` EnvironmentVariables pqtype.NullRawMessage `db:"environment_variables" json:"environment_variables"` OperatingSystem string `db:"operating_system" json:"operating_system"` StartupScript sql.NullString `db:"startup_script" json:"startup_script"` InstanceMetadata pqtype.NullRawMessage `db:"instance_metadata" json:"instance_metadata"` ResourceMetadata pqtype.NullRawMessage `db:"resource_metadata" json:"resource_metadata"` Directory string `db:"directory" json:"directory"` }
type WorkspaceApp ¶ added in v0.6.2
type WorkspaceApp struct { ID uuid.UUID `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` AgentID uuid.UUID `db:"agent_id" json:"agent_id"` Name string `db:"name" json:"name"` Icon string `db:"icon" json:"icon"` Command sql.NullString `db:"command" json:"command"` Url sql.NullString `db:"url" json:"url"` RelativePath bool `db:"relative_path" json:"relative_path"` }
type WorkspaceBuild ¶
type WorkspaceBuild struct { ID uuid.UUID `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` WorkspaceID uuid.UUID `db:"workspace_id" json:"workspace_id"` TemplateVersionID uuid.UUID `db:"template_version_id" json:"template_version_id"` Name string `db:"name" json:"name"` BuildNumber int32 `db:"build_number" json:"build_number"` Transition WorkspaceTransition `db:"transition" json:"transition"` InitiatorID uuid.UUID `db:"initiator_id" json:"initiator_id"` ProvisionerState []byte `db:"provisioner_state" json:"provisioner_state"` JobID uuid.UUID `db:"job_id" json:"job_id"` Deadline time.Time `db:"deadline" json:"deadline"` }
type WorkspaceResource ¶
type WorkspaceResource struct { ID uuid.UUID `db:"id" json:"id"` CreatedAt time.Time `db:"created_at" json:"created_at"` JobID uuid.UUID `db:"job_id" json:"job_id"` Transition WorkspaceTransition `db:"transition" json:"transition"` Type string `db:"type" json:"type"` Name string `db:"name" json:"name"` }
type WorkspaceTransition ¶
type WorkspaceTransition string
const ( WorkspaceTransitionStart WorkspaceTransition = "start" WorkspaceTransitionStop WorkspaceTransition = "stop" WorkspaceTransitionDelete WorkspaceTransition = "delete" )
func (*WorkspaceTransition) Scan ¶
func (e *WorkspaceTransition) Scan(src interface{}) error