database

package
v2.10.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: AGPL-3.0 Imports: 22 Imported by: 0

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.

Code generated by scripts/dbgen/main.go. DO NOT EDIT.

Code generated by scripts/dbgen/main.go. DO NOT EDIT.

Index

Constants

View Source
const (
	LockIDDeploymentSetup = iota + 1
	LockIDEnterpriseDeploymentSetup
	LockIDDBRollup
)

Well-known lock IDs for lock functions in the database. These should not change. If locks are deprecated, they should be kept in this list to avoid reusing the same ID.

View Source
const EveryoneGroup = "Everyone"

Variables

This section is empty.

Functions

func GenLockID

func GenLockID(name string) int64

GenLockID generates a unique and consistent lock ID from a given string.

func IsForeignKeyViolation added in v2.2.0

func IsForeignKeyViolation(err error, foreignKeyConstraints ...ForeignKeyConstraint) bool

IsForeignKeyViolation checks if the error is due to a foreign key violation. If one or more specific foreign key constraints are given as arguments, the error must be caused by one of them. If no constraints are given, this function returns true for any foreign key violation.

func IsQueryCanceledError

func IsQueryCanceledError(err error) bool

IsQueryCanceledError checks if the error is due to a query being canceled.

func IsSerializedError

func IsSerializedError(err error) bool

func IsUniqueViolation

func IsUniqueViolation(err error, uniqueConstraints ...UniqueConstraint) bool

IsUniqueViolation checks if the error is due to a unique violation. If one or more specific unique constraints are given as arguments, the error must be caused by one of them. If no constraints are given, this function returns true for any unique violation.

func IsWorkspaceAgentLogsLimitError

func IsWorkspaceAgentLogsLimitError(err error) bool

func ReadModifyUpdate

func ReadModifyUpdate(db Store, f func(tx Store) error,
) error

ReadModifyUpdate is a helper function to run a db transaction that reads some object(s), modifies some of the data, and writes the modified object(s) back to the database. It is run in a transaction at RepeatableRead isolation so that if another database client also modifies the data we are writing and commits, then the transaction is rolled back and restarted.

This is needed because we typically read all object columns, modify some subset, and then write all columns. Consider an object with columns A, B and initial values A=1, B=1. Two database clients work simultaneously, with one client attempting to set A=2, and another attempting to set B=2. They both initially read A=1, B=1, and then one writes A=2, B=1, and the other writes A=1, B=2. With default PostgreSQL isolation of ReadCommitted, both of these transactions would succeed and we end up with either A=2, B=1 or A=1, B=2. One or other client gets their transaction wiped out even though the data they wanted to change didn't conflict.

If we run at RepeatableRead isolation, then one or other transaction will fail. Let's say the transaction that sets A=2 succeeds. Then the first B=2 transaction fails, but here we retry. The second attempt we read A=2, B=1, then write A=2, B=2 as desired, and this succeeds.

Types

type APIKey

type APIKey struct {
	ID string `db:"id" json:"id"`
	// hashed_secret contains a SHA256 hash of the key secret. This is considered a secret and MUST NOT be returned from the API as it is used for API key encryption in app proxying code.
	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"`
	LifetimeSeconds int64       `db:"lifetime_seconds" json:"lifetime_seconds"`
	IPAddress       pqtype.Inet `db:"ip_address" json:"ip_address"`
	Scope           APIKeyScope `db:"scope" json:"scope"`
	TokenName       string      `db:"token_name" json:"token_name"`
}

func (APIKey) RBACObject

func (k APIKey) RBACObject() rbac.Object

type APIKeyScope

type APIKeyScope string
const (
	APIKeyScopeAll                APIKeyScope = "all"
	APIKeyScopeApplicationConnect APIKeyScope = "application_connect"
)

func AllAPIKeyScopeValues

func AllAPIKeyScopeValues() []APIKeyScope

func (*APIKeyScope) Scan

func (e *APIKeyScope) Scan(src interface{}) error

func (APIKeyScope) ToRBAC

func (s APIKeyScope) ToRBAC() rbac.ScopeName

func (APIKeyScope) Valid

func (e APIKeyScope) Valid() bool

type AcquireProvisionerJobParams

type AcquireProvisionerJobParams struct {
	StartedAt      sql.NullTime      `db:"started_at" json:"started_at"`
	WorkerID       uuid.NullUUID     `db:"worker_id" json:"worker_id"`
	OrganizationID uuid.UUID         `db:"organization_id" json:"organization_id"`
	Types          []ProvisionerType `db:"types" json:"types"`
	Tags           json.RawMessage   `db:"tags" json:"tags"`
}

type Actions

type Actions []rbac.Action

func (*Actions) Scan

func (a *Actions) Scan(src interface{}) error

func (*Actions) Value

func (a *Actions) Value() (driver.Value, error)

type ActivityBumpWorkspaceParams added in v2.4.0

type ActivityBumpWorkspaceParams struct {
	NextAutostart time.Time `db:"next_autostart" json:"next_autostart"`
	WorkspaceID   uuid.UUID `db:"workspace_id" json:"workspace_id"`
}

type AppSharingLevel

type AppSharingLevel string
const (
	AppSharingLevelOwner         AppSharingLevel = "owner"
	AppSharingLevelAuthenticated AppSharingLevel = "authenticated"
	AppSharingLevelPublic        AppSharingLevel = "public"
)

func AllAppSharingLevelValues

func AllAppSharingLevelValues() []AppSharingLevel

func (*AppSharingLevel) Scan

func (e *AppSharingLevel) Scan(src interface{}) error

func (AppSharingLevel) Valid

func (e AppSharingLevel) Valid() bool

type ArchiveUnusedTemplateVersionsParams added in v2.3.0

type ArchiveUnusedTemplateVersionsParams struct {
	UpdatedAt         time.Time                `db:"updated_at" json:"updated_at"`
	TemplateID        uuid.UUID                `db:"template_id" json:"template_id"`
	TemplateVersionID uuid.UUID                `db:"template_version_id" json:"template_version_id"`
	JobStatus         NullProvisionerJobStatus `db:"job_status" json:"job_status"`
}

type AuditAction

type AuditAction string
const (
	AuditActionCreate   AuditAction = "create"
	AuditActionWrite    AuditAction = "write"
	AuditActionDelete   AuditAction = "delete"
	AuditActionStart    AuditAction = "start"
	AuditActionStop     AuditAction = "stop"
	AuditActionLogin    AuditAction = "login"
	AuditActionLogout   AuditAction = "logout"
	AuditActionRegister AuditAction = "register"
)

func AllAuditActionValues

func AllAuditActionValues() []AuditAction

func (*AuditAction) Scan

func (e *AuditAction) Scan(src interface{}) error

func (AuditAction) Valid

func (e AuditAction) Valid() bool

type AuditLog

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        sql.NullString  `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"`
	AdditionalFields json.RawMessage `db:"additional_fields" json:"additional_fields"`
	RequestID        uuid.UUID       `db:"request_id" json:"request_id"`
	ResourceIcon     string          `db:"resource_icon" json:"resource_icon"`
}

type AuditOAuthConvertState

type AuditOAuthConvertState struct {
	CreatedAt time.Time `db:"created_at" json:"created_at"`
	// The time at which the state string expires, a merge request times out if the user does not perform it quick enough.
	ExpiresAt     time.Time `db:"expires_at" json:"expires_at"`
	FromLoginType LoginType `db:"from_login_type" json:"from_login_type"`
	// The login type the user is converting to. Should be github or oidc.
	ToLoginType LoginType `db:"to_login_type" json:"to_login_type"`
	UserID      uuid.UUID `db:"user_id" json:"user_id"`
}

AuditOAuthConvertState is never stored in the database. It is stored in a cookie clientside as a JWT. This type is provided for audit logging purposes.

type AuditableGroup

type AuditableGroup struct {
	Group
	Members []GroupMember `json:"members"`
}

type AutomaticUpdates added in v2.3.0

type AutomaticUpdates string
const (
	AutomaticUpdatesAlways AutomaticUpdates = "always"
	AutomaticUpdatesNever  AutomaticUpdates = "never"
)

func AllAutomaticUpdatesValues added in v2.3.0

func AllAutomaticUpdatesValues() []AutomaticUpdates

func (*AutomaticUpdates) Scan added in v2.3.0

func (e *AutomaticUpdates) Scan(src interface{}) error

func (AutomaticUpdates) Valid added in v2.3.0

func (e AutomaticUpdates) Valid() bool

type BatchUpdateWorkspaceLastUsedAtParams added in v2.7.0

type BatchUpdateWorkspaceLastUsedAtParams struct {
	LastUsedAt time.Time   `db:"last_used_at" json:"last_used_at"`
	IDs        []uuid.UUID `db:"ids" json:"ids"`
}

type BuildReason

type BuildReason string
const (
	BuildReasonInitiator  BuildReason = "initiator"
	BuildReasonAutostart  BuildReason = "autostart"
	BuildReasonAutostop   BuildReason = "autostop"
	BuildReasonDormancy   BuildReason = "dormancy"
	BuildReasonFailedstop BuildReason = "failedstop"
	BuildReasonAutodelete BuildReason = "autodelete"
)

func AllBuildReasonValues

func AllBuildReasonValues() []BuildReason

func (*BuildReason) Scan

func (e *BuildReason) Scan(src interface{}) error

func (BuildReason) Valid

func (e BuildReason) Valid() bool

type DBCryptKey added in v2.2.0

type DBCryptKey struct {
	// An integer used to identify the key.
	Number int32 `db:"number" json:"number"`
	// If the key is active, the digest of the active key.
	ActiveKeyDigest sql.NullString `db:"active_key_digest" json:"active_key_digest"`
	// If the key has been revoked, the digest of the revoked key.
	RevokedKeyDigest sql.NullString `db:"revoked_key_digest" json:"revoked_key_digest"`
	// The time at which the key was created.
	CreatedAt sql.NullTime `db:"created_at" json:"created_at"`
	// The time at which the key was revoked.
	RevokedAt sql.NullTime `db:"revoked_at" json:"revoked_at"`
	// A column used to test the encryption.
	Test string `db:"test" json:"test"`
}

A table used to store the keys used to encrypt the database.

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
	SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
	GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
}

DBTX represents a database connection or transaction.

type DeleteAllTailnetClientSubscriptionsParams added in v2.2.0

type DeleteAllTailnetClientSubscriptionsParams struct {
	ClientID      uuid.UUID `db:"client_id" json:"client_id"`
	CoordinatorID uuid.UUID `db:"coordinator_id" json:"coordinator_id"`
}

type DeleteAllTailnetTunnelsParams added in v2.4.0

type DeleteAllTailnetTunnelsParams struct {
	CoordinatorID uuid.UUID `db:"coordinator_id" json:"coordinator_id"`
	SrcID         uuid.UUID `db:"src_id" json:"src_id"`
}

type DeleteExternalAuthLinkParams added in v2.5.0

type DeleteExternalAuthLinkParams struct {
	ProviderID string    `db:"provider_id" json:"provider_id"`
	UserID     uuid.UUID `db:"user_id" json:"user_id"`
}

type DeleteGroupMemberFromGroupParams

type DeleteGroupMemberFromGroupParams struct {
	UserID  uuid.UUID `db:"user_id" json:"user_id"`
	GroupID uuid.UUID `db:"group_id" json:"group_id"`
}

type DeleteOAuth2ProviderAppCodesByAppAndUserIDParams added in v2.9.0

type DeleteOAuth2ProviderAppCodesByAppAndUserIDParams struct {
	AppID  uuid.UUID `db:"app_id" json:"app_id"`
	UserID uuid.UUID `db:"user_id" json:"user_id"`
}

type DeleteOAuth2ProviderAppTokensByAppAndUserIDParams added in v2.9.0

type DeleteOAuth2ProviderAppTokensByAppAndUserIDParams struct {
	AppID  uuid.UUID `db:"app_id" json:"app_id"`
	UserID uuid.UUID `db:"user_id" json:"user_id"`
}

type DeleteTailnetAgentParams

type DeleteTailnetAgentParams struct {
	ID            uuid.UUID `db:"id" json:"id"`
	CoordinatorID uuid.UUID `db:"coordinator_id" json:"coordinator_id"`
}

type DeleteTailnetAgentRow

type DeleteTailnetAgentRow struct {
	ID            uuid.UUID `db:"id" json:"id"`
	CoordinatorID uuid.UUID `db:"coordinator_id" json:"coordinator_id"`
}

type DeleteTailnetClientParams

type DeleteTailnetClientParams struct {
	ID            uuid.UUID `db:"id" json:"id"`
	CoordinatorID uuid.UUID `db:"coordinator_id" json:"coordinator_id"`
}

type DeleteTailnetClientRow

type DeleteTailnetClientRow struct {
	ID            uuid.UUID `db:"id" json:"id"`
	CoordinatorID uuid.UUID `db:"coordinator_id" json:"coordinator_id"`
}

type DeleteTailnetClientSubscriptionParams added in v2.2.0

type DeleteTailnetClientSubscriptionParams struct {
	ClientID      uuid.UUID `db:"client_id" json:"client_id"`
	AgentID       uuid.UUID `db:"agent_id" json:"agent_id"`
	CoordinatorID uuid.UUID `db:"coordinator_id" json:"coordinator_id"`
}

type DeleteTailnetPeerParams added in v2.4.0

type DeleteTailnetPeerParams struct {
	ID            uuid.UUID `db:"id" json:"id"`
	CoordinatorID uuid.UUID `db:"coordinator_id" json:"coordinator_id"`
}

type DeleteTailnetPeerRow added in v2.4.0

type DeleteTailnetPeerRow struct {
	ID            uuid.UUID `db:"id" json:"id"`
	CoordinatorID uuid.UUID `db:"coordinator_id" json:"coordinator_id"`
}

type DeleteTailnetTunnelParams added in v2.4.0

type DeleteTailnetTunnelParams struct {
	CoordinatorID uuid.UUID `db:"coordinator_id" json:"coordinator_id"`
	SrcID         uuid.UUID `db:"src_id" json:"src_id"`
	DstID         uuid.UUID `db:"dst_id" json:"dst_id"`
}

type DeleteTailnetTunnelRow added in v2.4.0

type DeleteTailnetTunnelRow struct {
	CoordinatorID uuid.UUID `db:"coordinator_id" json:"coordinator_id"`
	SrcID         uuid.UUID `db:"src_id" json:"src_id"`
	DstID         uuid.UUID `db:"dst_id" json:"dst_id"`
}

type DeleteWorkspaceAgentPortShareParams added in v2.9.0

type DeleteWorkspaceAgentPortShareParams struct {
	WorkspaceID uuid.UUID `db:"workspace_id" json:"workspace_id"`
	AgentName   string    `db:"agent_name" json:"agent_name"`
	Port        int32     `db:"port" json:"port"`
}

type DisplayApp added in v2.1.5

type DisplayApp string
const (
	DisplayAppVscode               DisplayApp = "vscode"
	DisplayAppVscodeInsiders       DisplayApp = "vscode_insiders"
	DisplayAppWebTerminal          DisplayApp = "web_terminal"
	DisplayAppSSHHelper            DisplayApp = "ssh_helper"
	DisplayAppPortForwardingHelper DisplayApp = "port_forwarding_helper"
)

func AllDisplayAppValues added in v2.1.5

func AllDisplayAppValues() []DisplayApp

func (*DisplayApp) Scan added in v2.1.5

func (e *DisplayApp) Scan(src interface{}) error

func (DisplayApp) Valid added in v2.1.5

func (e DisplayApp) Valid() bool
type ExternalAuthLink struct {
	ProviderID        string    `db:"provider_id" json:"provider_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"`
	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"`
	// The ID of the key used to encrypt the OAuth access token. If this is NULL, the access token is not encrypted
	OAuthAccessTokenKeyID sql.NullString `db:"oauth_access_token_key_id" json:"oauth_access_token_key_id"`
	// The ID of the key used to encrypt the OAuth refresh token. If this is NULL, the refresh token is not encrypted
	OAuthRefreshTokenKeyID sql.NullString        `db:"oauth_refresh_token_key_id" json:"oauth_refresh_token_key_id"`
	OAuthExtra             pqtype.NullRawMessage `db:"oauth_extra" json:"oauth_extra"`
}

func (ExternalAuthLink) OAuthToken added in v2.8.0

func (u ExternalAuthLink) OAuthToken() *oauth2.Token

func (ExternalAuthLink) RBACObject added in v2.2.1

func (u ExternalAuthLink) RBACObject() rbac.Object

type ExternalAuthProvider added in v2.9.0

type ExternalAuthProvider struct {
	ID       string `json:"id"`
	Optional bool   `json:"optional,omitempty"`
}

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"`
	ID        uuid.UUID `db:"id" json:"id"`
}

func (File) RBACObject

func (f File) RBACObject() rbac.Object

type ForeignKeyConstraint added in v2.2.0

type ForeignKeyConstraint string

ForeignKeyConstraint represents a named foreign key constraint on a table.

const (
	ForeignKeyAPIKeysUserIDUUID                            ForeignKeyConstraint = "api_keys_user_id_uuid_fkey"                             // ALTER TABLE ONLY api_keys ADD CONSTRAINT api_keys_user_id_uuid_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
	ForeignKeyGitAuthLinksOauthAccessTokenKeyID            ForeignKeyConstraint = "git_auth_links_oauth_access_token_key_id_fkey"          // ALTER TABLE ONLY external_auth_links ADD CONSTRAINT git_auth_links_oauth_access_token_key_id_fkey FOREIGN KEY (oauth_access_token_key_id) REFERENCES dbcrypt_keys(active_key_digest);
	ForeignKeyGitAuthLinksOauthRefreshTokenKeyID           ForeignKeyConstraint = "git_auth_links_oauth_refresh_token_key_id_fkey"         // ALTER TABLE ONLY external_auth_links ADD CONSTRAINT git_auth_links_oauth_refresh_token_key_id_fkey FOREIGN KEY (oauth_refresh_token_key_id) REFERENCES dbcrypt_keys(active_key_digest);
	ForeignKeyGitSSHKeysUserID                             ForeignKeyConstraint = "gitsshkeys_user_id_fkey"                                // ALTER TABLE ONLY gitsshkeys ADD CONSTRAINT gitsshkeys_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
	ForeignKeyGroupMembersGroupID                          ForeignKeyConstraint = "group_members_group_id_fkey"                            // ALTER TABLE ONLY group_members ADD CONSTRAINT group_members_group_id_fkey FOREIGN KEY (group_id) REFERENCES groups(id) ON DELETE CASCADE;
	ForeignKeyGroupMembersUserID                           ForeignKeyConstraint = "group_members_user_id_fkey"                             // ALTER TABLE ONLY group_members ADD CONSTRAINT group_members_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
	ForeignKeyGroupsOrganizationID                         ForeignKeyConstraint = "groups_organization_id_fkey"                            // ALTER TABLE ONLY groups ADD CONSTRAINT groups_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;
	ForeignKeyJfrogXrayScansAgentID                        ForeignKeyConstraint = "jfrog_xray_scans_agent_id_fkey"                         // ALTER TABLE ONLY jfrog_xray_scans ADD CONSTRAINT jfrog_xray_scans_agent_id_fkey FOREIGN KEY (agent_id) REFERENCES workspace_agents(id) ON DELETE CASCADE;
	ForeignKeyJfrogXrayScansWorkspaceID                    ForeignKeyConstraint = "jfrog_xray_scans_workspace_id_fkey"                     // ALTER TABLE ONLY jfrog_xray_scans ADD CONSTRAINT jfrog_xray_scans_workspace_id_fkey FOREIGN KEY (workspace_id) REFERENCES workspaces(id) ON DELETE CASCADE;
	ForeignKeyOauth2ProviderAppCodesAppID                  ForeignKeyConstraint = "oauth2_provider_app_codes_app_id_fkey"                  // ALTER TABLE ONLY oauth2_provider_app_codes ADD CONSTRAINT oauth2_provider_app_codes_app_id_fkey FOREIGN KEY (app_id) REFERENCES oauth2_provider_apps(id) ON DELETE CASCADE;
	ForeignKeyOauth2ProviderAppCodesUserID                 ForeignKeyConstraint = "oauth2_provider_app_codes_user_id_fkey"                 // ALTER TABLE ONLY oauth2_provider_app_codes ADD CONSTRAINT oauth2_provider_app_codes_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
	ForeignKeyOauth2ProviderAppSecretsAppID                ForeignKeyConstraint = "oauth2_provider_app_secrets_app_id_fkey"                // ALTER TABLE ONLY oauth2_provider_app_secrets ADD CONSTRAINT oauth2_provider_app_secrets_app_id_fkey FOREIGN KEY (app_id) REFERENCES oauth2_provider_apps(id) ON DELETE CASCADE;
	ForeignKeyOauth2ProviderAppTokensAPIKeyID              ForeignKeyConstraint = "oauth2_provider_app_tokens_api_key_id_fkey"             // ALTER TABLE ONLY oauth2_provider_app_tokens ADD CONSTRAINT oauth2_provider_app_tokens_api_key_id_fkey FOREIGN KEY (api_key_id) REFERENCES api_keys(id) ON DELETE CASCADE;
	ForeignKeyOauth2ProviderAppTokensAppSecretID           ForeignKeyConstraint = "oauth2_provider_app_tokens_app_secret_id_fkey"          // ALTER TABLE ONLY oauth2_provider_app_tokens ADD CONSTRAINT oauth2_provider_app_tokens_app_secret_id_fkey FOREIGN KEY (app_secret_id) REFERENCES oauth2_provider_app_secrets(id) ON DELETE CASCADE;
	ForeignKeyOrganizationMembersOrganizationIDUUID        ForeignKeyConstraint = "organization_members_organization_id_uuid_fkey"         // ALTER TABLE ONLY organization_members ADD CONSTRAINT organization_members_organization_id_uuid_fkey FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;
	ForeignKeyOrganizationMembersUserIDUUID                ForeignKeyConstraint = "organization_members_user_id_uuid_fkey"                 // ALTER TABLE ONLY organization_members ADD CONSTRAINT organization_members_user_id_uuid_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
	ForeignKeyParameterSchemasJobID                        ForeignKeyConstraint = "parameter_schemas_job_id_fkey"                          // ALTER TABLE ONLY parameter_schemas ADD CONSTRAINT parameter_schemas_job_id_fkey FOREIGN KEY (job_id) REFERENCES provisioner_jobs(id) ON DELETE CASCADE;
	ForeignKeyProvisionerDaemonsOrganizationID             ForeignKeyConstraint = "provisioner_daemons_organization_id_fkey"               // ALTER TABLE ONLY provisioner_daemons ADD CONSTRAINT provisioner_daemons_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;
	ForeignKeyProvisionerJobLogsJobID                      ForeignKeyConstraint = "provisioner_job_logs_job_id_fkey"                       // ALTER TABLE ONLY provisioner_job_logs ADD CONSTRAINT provisioner_job_logs_job_id_fkey FOREIGN KEY (job_id) REFERENCES provisioner_jobs(id) ON DELETE CASCADE;
	ForeignKeyProvisionerJobsOrganizationID                ForeignKeyConstraint = "provisioner_jobs_organization_id_fkey"                  // ALTER TABLE ONLY provisioner_jobs ADD CONSTRAINT provisioner_jobs_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;
	ForeignKeyTailnetAgentsCoordinatorID                   ForeignKeyConstraint = "tailnet_agents_coordinator_id_fkey"                     // ALTER TABLE ONLY tailnet_agents ADD CONSTRAINT tailnet_agents_coordinator_id_fkey FOREIGN KEY (coordinator_id) REFERENCES tailnet_coordinators(id) ON DELETE CASCADE;
	ForeignKeyTailnetClientSubscriptionsCoordinatorID      ForeignKeyConstraint = "tailnet_client_subscriptions_coordinator_id_fkey"       // ALTER TABLE ONLY tailnet_client_subscriptions ADD CONSTRAINT tailnet_client_subscriptions_coordinator_id_fkey FOREIGN KEY (coordinator_id) REFERENCES tailnet_coordinators(id) ON DELETE CASCADE;
	ForeignKeyTailnetClientsCoordinatorID                  ForeignKeyConstraint = "tailnet_clients_coordinator_id_fkey"                    // ALTER TABLE ONLY tailnet_clients ADD CONSTRAINT tailnet_clients_coordinator_id_fkey FOREIGN KEY (coordinator_id) REFERENCES tailnet_coordinators(id) ON DELETE CASCADE;
	ForeignKeyTailnetPeersCoordinatorID                    ForeignKeyConstraint = "tailnet_peers_coordinator_id_fkey"                      // ALTER TABLE ONLY tailnet_peers ADD CONSTRAINT tailnet_peers_coordinator_id_fkey FOREIGN KEY (coordinator_id) REFERENCES tailnet_coordinators(id) ON DELETE CASCADE;
	ForeignKeyTailnetTunnelsCoordinatorID                  ForeignKeyConstraint = "tailnet_tunnels_coordinator_id_fkey"                    // ALTER TABLE ONLY tailnet_tunnels ADD CONSTRAINT tailnet_tunnels_coordinator_id_fkey FOREIGN KEY (coordinator_id) REFERENCES tailnet_coordinators(id) ON DELETE CASCADE;
	ForeignKeyTemplateVersionParametersTemplateVersionID   ForeignKeyConstraint = "template_version_parameters_template_version_id_fkey"   // ALTER TABLE ONLY template_version_parameters ADD CONSTRAINT template_version_parameters_template_version_id_fkey FOREIGN KEY (template_version_id) REFERENCES template_versions(id) ON DELETE CASCADE;
	ForeignKeyTemplateVersionVariablesTemplateVersionID    ForeignKeyConstraint = "template_version_variables_template_version_id_fkey"    // ALTER TABLE ONLY template_version_variables ADD CONSTRAINT template_version_variables_template_version_id_fkey FOREIGN KEY (template_version_id) REFERENCES template_versions(id) ON DELETE CASCADE;
	ForeignKeyTemplateVersionsCreatedBy                    ForeignKeyConstraint = "template_versions_created_by_fkey"                      // ALTER TABLE ONLY template_versions ADD CONSTRAINT template_versions_created_by_fkey FOREIGN KEY (created_by) REFERENCES users(id) ON DELETE RESTRICT;
	ForeignKeyTemplateVersionsOrganizationID               ForeignKeyConstraint = "template_versions_organization_id_fkey"                 // ALTER TABLE ONLY template_versions ADD CONSTRAINT template_versions_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;
	ForeignKeyTemplateVersionsTemplateID                   ForeignKeyConstraint = "template_versions_template_id_fkey"                     // ALTER TABLE ONLY template_versions ADD CONSTRAINT template_versions_template_id_fkey FOREIGN KEY (template_id) REFERENCES templates(id) ON DELETE CASCADE;
	ForeignKeyTemplatesCreatedBy                           ForeignKeyConstraint = "templates_created_by_fkey"                              // ALTER TABLE ONLY templates ADD CONSTRAINT templates_created_by_fkey FOREIGN KEY (created_by) REFERENCES users(id) ON DELETE RESTRICT;
	ForeignKeyTemplatesOrganizationID                      ForeignKeyConstraint = "templates_organization_id_fkey"                         // ALTER TABLE ONLY templates ADD CONSTRAINT templates_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE CASCADE;
	ForeignKeyUserLinksOauthAccessTokenKeyID               ForeignKeyConstraint = "user_links_oauth_access_token_key_id_fkey"              // ALTER TABLE ONLY user_links ADD CONSTRAINT user_links_oauth_access_token_key_id_fkey FOREIGN KEY (oauth_access_token_key_id) REFERENCES dbcrypt_keys(active_key_digest);
	ForeignKeyUserLinksOauthRefreshTokenKeyID              ForeignKeyConstraint = "user_links_oauth_refresh_token_key_id_fkey"             // ALTER TABLE ONLY user_links ADD CONSTRAINT user_links_oauth_refresh_token_key_id_fkey FOREIGN KEY (oauth_refresh_token_key_id) REFERENCES dbcrypt_keys(active_key_digest);
	ForeignKeyUserLinksUserID                              ForeignKeyConstraint = "user_links_user_id_fkey"                                // ALTER TABLE ONLY user_links ADD CONSTRAINT user_links_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
	ForeignKeyWorkspaceAgentLogSourcesWorkspaceAgentID     ForeignKeyConstraint = "workspace_agent_log_sources_workspace_agent_id_fkey"    // ALTER TABLE ONLY workspace_agent_log_sources ADD CONSTRAINT workspace_agent_log_sources_workspace_agent_id_fkey FOREIGN KEY (workspace_agent_id) REFERENCES workspace_agents(id) ON DELETE CASCADE;
	ForeignKeyWorkspaceAgentMetadataWorkspaceAgentID       ForeignKeyConstraint = "workspace_agent_metadata_workspace_agent_id_fkey"       // ALTER TABLE ONLY workspace_agent_metadata ADD CONSTRAINT workspace_agent_metadata_workspace_agent_id_fkey FOREIGN KEY (workspace_agent_id) REFERENCES workspace_agents(id) ON DELETE CASCADE;
	ForeignKeyWorkspaceAgentPortShareWorkspaceID           ForeignKeyConstraint = "workspace_agent_port_share_workspace_id_fkey"           // ALTER TABLE ONLY workspace_agent_port_share ADD CONSTRAINT workspace_agent_port_share_workspace_id_fkey FOREIGN KEY (workspace_id) REFERENCES workspaces(id) ON DELETE CASCADE;
	ForeignKeyWorkspaceAgentScriptsWorkspaceAgentID        ForeignKeyConstraint = "workspace_agent_scripts_workspace_agent_id_fkey"        // ALTER TABLE ONLY workspace_agent_scripts ADD CONSTRAINT workspace_agent_scripts_workspace_agent_id_fkey FOREIGN KEY (workspace_agent_id) REFERENCES workspace_agents(id) ON DELETE CASCADE;
	ForeignKeyWorkspaceAgentStartupLogsAgentID             ForeignKeyConstraint = "workspace_agent_startup_logs_agent_id_fkey"             // ALTER TABLE ONLY workspace_agent_logs ADD CONSTRAINT workspace_agent_startup_logs_agent_id_fkey FOREIGN KEY (agent_id) REFERENCES workspace_agents(id) ON DELETE CASCADE;
	ForeignKeyWorkspaceAgentsResourceID                    ForeignKeyConstraint = "workspace_agents_resource_id_fkey"                      // ALTER TABLE ONLY workspace_agents ADD CONSTRAINT workspace_agents_resource_id_fkey FOREIGN KEY (resource_id) REFERENCES workspace_resources(id) ON DELETE CASCADE;
	ForeignKeyWorkspaceAppStatsAgentID                     ForeignKeyConstraint = "workspace_app_stats_agent_id_fkey"                      // ALTER TABLE ONLY workspace_app_stats ADD CONSTRAINT workspace_app_stats_agent_id_fkey FOREIGN KEY (agent_id) REFERENCES workspace_agents(id);
	ForeignKeyWorkspaceAppStatsUserID                      ForeignKeyConstraint = "workspace_app_stats_user_id_fkey"                       // ALTER TABLE ONLY workspace_app_stats ADD CONSTRAINT workspace_app_stats_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
	ForeignKeyWorkspaceAppStatsWorkspaceID                 ForeignKeyConstraint = "workspace_app_stats_workspace_id_fkey"                  // ALTER TABLE ONLY workspace_app_stats ADD CONSTRAINT workspace_app_stats_workspace_id_fkey FOREIGN KEY (workspace_id) REFERENCES workspaces(id);
	ForeignKeyWorkspaceAppsAgentID                         ForeignKeyConstraint = "workspace_apps_agent_id_fkey"                           // ALTER TABLE ONLY workspace_apps ADD CONSTRAINT workspace_apps_agent_id_fkey FOREIGN KEY (agent_id) REFERENCES workspace_agents(id) ON DELETE CASCADE;
	ForeignKeyWorkspaceBuildParametersWorkspaceBuildID     ForeignKeyConstraint = "workspace_build_parameters_workspace_build_id_fkey"     // ALTER TABLE ONLY workspace_build_parameters ADD CONSTRAINT workspace_build_parameters_workspace_build_id_fkey FOREIGN KEY (workspace_build_id) REFERENCES workspace_builds(id) ON DELETE CASCADE;
	ForeignKeyWorkspaceBuildsJobID                         ForeignKeyConstraint = "workspace_builds_job_id_fkey"                           // ALTER TABLE ONLY workspace_builds ADD CONSTRAINT workspace_builds_job_id_fkey FOREIGN KEY (job_id) REFERENCES provisioner_jobs(id) ON DELETE CASCADE;
	ForeignKeyWorkspaceBuildsTemplateVersionID             ForeignKeyConstraint = "workspace_builds_template_version_id_fkey"              // ALTER TABLE ONLY workspace_builds ADD CONSTRAINT workspace_builds_template_version_id_fkey FOREIGN KEY (template_version_id) REFERENCES template_versions(id) ON DELETE CASCADE;
	ForeignKeyWorkspaceBuildsWorkspaceID                   ForeignKeyConstraint = "workspace_builds_workspace_id_fkey"                     // ALTER TABLE ONLY workspace_builds ADD CONSTRAINT workspace_builds_workspace_id_fkey FOREIGN KEY (workspace_id) REFERENCES workspaces(id) ON DELETE CASCADE;
	ForeignKeyWorkspaceResourceMetadataWorkspaceResourceID ForeignKeyConstraint = "workspace_resource_metadata_workspace_resource_id_fkey" // ALTER TABLE ONLY workspace_resource_metadata ADD CONSTRAINT workspace_resource_metadata_workspace_resource_id_fkey FOREIGN KEY (workspace_resource_id) REFERENCES workspace_resources(id) ON DELETE CASCADE;
	ForeignKeyWorkspaceResourcesJobID                      ForeignKeyConstraint = "workspace_resources_job_id_fkey"                        // ALTER TABLE ONLY workspace_resources ADD CONSTRAINT workspace_resources_job_id_fkey FOREIGN KEY (job_id) REFERENCES provisioner_jobs(id) ON DELETE CASCADE;
	ForeignKeyWorkspacesOrganizationID                     ForeignKeyConstraint = "workspaces_organization_id_fkey"                        // ALTER TABLE ONLY workspaces ADD CONSTRAINT workspaces_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES organizations(id) ON DELETE RESTRICT;
	ForeignKeyWorkspacesOwnerID                            ForeignKeyConstraint = "workspaces_owner_id_fkey"                               // ALTER TABLE ONLY workspaces ADD CONSTRAINT workspaces_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES users(id) ON DELETE RESTRICT;
	ForeignKeyWorkspacesTemplateID                         ForeignKeyConstraint = "workspaces_template_id_fkey"                            // ALTER TABLE ONLY workspaces ADD CONSTRAINT workspaces_template_id_fkey FOREIGN KEY (template_id) REFERENCES templates(id) ON DELETE RESTRICT;
)

ForeignKeyConstraint enums.

type GetAPIKeyByNameParams

type GetAPIKeyByNameParams struct {
	UserID    uuid.UUID `db:"user_id" json:"user_id"`
	TokenName string    `db:"token_name" json:"token_name"`
}

type GetAPIKeysByUserIDParams

type GetAPIKeysByUserIDParams struct {
	LoginType LoginType `db:"login_type" json:"login_type"`
	UserID    uuid.UUID `db:"user_id" json:"user_id"`
}

type GetAuditLogsOffsetParams

type GetAuditLogsOffsetParams struct {
	Limit          int32     `db:"limit" json:"limit"`
	Offset         int32     `db:"offset" json:"offset"`
	ResourceType   string    `db:"resource_type" json:"resource_type"`
	ResourceID     uuid.UUID `db:"resource_id" json:"resource_id"`
	ResourceTarget string    `db:"resource_target" json:"resource_target"`
	Action         string    `db:"action" json:"action"`
	UserID         uuid.UUID `db:"user_id" json:"user_id"`
	Username       string    `db:"username" json:"username"`
	Email          string    `db:"email" json:"email"`
	DateFrom       time.Time `db:"date_from" json:"date_from"`
	DateTo         time.Time `db:"date_to" json:"date_to"`
	BuildReason    string    `db:"build_reason" json:"build_reason"`
}

type GetAuditLogsOffsetRow

type GetAuditLogsOffsetRow 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        sql.NullString  `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"`
	AdditionalFields json.RawMessage `db:"additional_fields" json:"additional_fields"`
	RequestID        uuid.UUID       `db:"request_id" json:"request_id"`
	ResourceIcon     string          `db:"resource_icon" json:"resource_icon"`
	UserUsername     sql.NullString  `db:"user_username" json:"user_username"`
	UserEmail        sql.NullString  `db:"user_email" json:"user_email"`
	UserCreatedAt    sql.NullTime    `db:"user_created_at" json:"user_created_at"`
	UserStatus       NullUserStatus  `db:"user_status" json:"user_status"`
	UserRoles        pq.StringArray  `db:"user_roles" json:"user_roles"`
	UserAvatarUrl    sql.NullString  `db:"user_avatar_url" json:"user_avatar_url"`
	Count            int64           `db:"count" json:"count"`
}

type GetAuthorizationUserRolesRow

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"`
	Groups   []string   `db:"groups" json:"groups"`
}

type GetDefaultProxyConfigRow

type GetDefaultProxyConfigRow struct {
	DisplayName string `db:"display_name" json:"display_name"`
	IconUrl     string `db:"icon_url" json:"icon_url"`
}

type GetDeploymentDAUsRow

type GetDeploymentDAUsRow struct {
	Date   time.Time `db:"date" json:"date"`
	UserID uuid.UUID `db:"user_id" json:"user_id"`
}

type GetDeploymentWorkspaceAgentStatsRow

type GetDeploymentWorkspaceAgentStatsRow struct {
	WorkspaceRxBytes             int64   `db:"workspace_rx_bytes" json:"workspace_rx_bytes"`
	WorkspaceTxBytes             int64   `db:"workspace_tx_bytes" json:"workspace_tx_bytes"`
	WorkspaceConnectionLatency50 float64 `db:"workspace_connection_latency_50" json:"workspace_connection_latency_50"`
	WorkspaceConnectionLatency95 float64 `db:"workspace_connection_latency_95" json:"workspace_connection_latency_95"`
	SessionCountVSCode           int64   `db:"session_count_vscode" json:"session_count_vscode"`
	SessionCountSSH              int64   `db:"session_count_ssh" json:"session_count_ssh"`
	SessionCountJetBrains        int64   `db:"session_count_jetbrains" json:"session_count_jetbrains"`
	SessionCountReconnectingPTY  int64   `db:"session_count_reconnecting_pty" json:"session_count_reconnecting_pty"`
}

type GetDeploymentWorkspaceStatsRow

type GetDeploymentWorkspaceStatsRow struct {
	PendingWorkspaces  int64 `db:"pending_workspaces" json:"pending_workspaces"`
	BuildingWorkspaces int64 `db:"building_workspaces" json:"building_workspaces"`
	RunningWorkspaces  int64 `db:"running_workspaces" json:"running_workspaces"`
	FailedWorkspaces   int64 `db:"failed_workspaces" json:"failed_workspaces"`
	StoppedWorkspaces  int64 `db:"stopped_workspaces" json:"stopped_workspaces"`
}

type GetExternalAuthLinkParams added in v2.2.1

type GetExternalAuthLinkParams struct {
	ProviderID string    `db:"provider_id" json:"provider_id"`
	UserID     uuid.UUID `db:"user_id" json:"user_id"`
}

type GetFileByHashAndCreatorParams

type GetFileByHashAndCreatorParams struct {
	Hash      string    `db:"hash" json:"hash"`
	CreatedBy uuid.UUID `db:"created_by" json:"created_by"`
}

type GetFileTemplatesRow

type GetFileTemplatesRow struct {
	FileID                 uuid.UUID   `db:"file_id" json:"file_id"`
	FileCreatedBy          uuid.UUID   `db:"file_created_by" json:"file_created_by"`
	TemplateID             uuid.UUID   `db:"template_id" json:"template_id"`
	TemplateOrganizationID uuid.UUID   `db:"template_organization_id" json:"template_organization_id"`
	TemplateCreatedBy      uuid.UUID   `db:"template_created_by" json:"template_created_by"`
	UserACL                TemplateACL `db:"user_acl" json:"user_acl"`
	GroupACL               TemplateACL `db:"group_acl" json:"group_acl"`
}

func (GetFileTemplatesRow) RBACObject

func (t GetFileTemplatesRow) RBACObject() rbac.Object

type GetGroupByOrgAndNameParams

type GetGroupByOrgAndNameParams struct {
	OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"`
	Name           string    `db:"name" json:"name"`
}

type GetJFrogXrayScanByWorkspaceAndAgentIDParams added in v2.8.0

type GetJFrogXrayScanByWorkspaceAndAgentIDParams struct {
	AgentID     uuid.UUID `db:"agent_id" json:"agent_id"`
	WorkspaceID uuid.UUID `db:"workspace_id" json:"workspace_id"`
}

type GetOAuth2ProviderAppsByUserIDRow added in v2.9.0

type GetOAuth2ProviderAppsByUserIDRow struct {
	TokenCount        int64             `db:"token_count" json:"token_count"`
	OAuth2ProviderApp OAuth2ProviderApp `db:"oauth2_provider_app" json:"oauth2_provider_app"`
}

func (GetOAuth2ProviderAppsByUserIDRow) RBACObject added in v2.9.0

type GetOrganizationIDsByMemberIDsRow

type GetOrganizationIDsByMemberIDsRow struct {
	UserID          uuid.UUID   `db:"user_id" json:"user_id"`
	OrganizationIDs []uuid.UUID `db:"organization_IDs" json:"organization_IDs"`
}

func (GetOrganizationIDsByMemberIDsRow) RBACObject

type GetOrganizationMemberByUserIDParams

type GetOrganizationMemberByUserIDParams struct {
	OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"`
	UserID         uuid.UUID `db:"user_id" json:"user_id"`
}

type GetPreviousTemplateVersionParams

type GetPreviousTemplateVersionParams struct {
	OrganizationID uuid.UUID     `db:"organization_id" json:"organization_id"`
	Name           string        `db:"name" json:"name"`
	TemplateID     uuid.NullUUID `db:"template_id" json:"template_id"`
}

type GetProvisionerJobsByIDsWithQueuePositionRow

type GetProvisionerJobsByIDsWithQueuePositionRow struct {
	ProvisionerJob ProvisionerJob `db:"provisioner_job" json:"provisioner_job"`
	QueuePosition  int64          `db:"queue_position" json:"queue_position"`
	QueueSize      int64          `db:"queue_size" json:"queue_size"`
}

type GetProvisionerLogsAfterIDParams

type GetProvisionerLogsAfterIDParams struct {
	JobID        uuid.UUID `db:"job_id" json:"job_id"`
	CreatedAfter int64     `db:"created_after" json:"created_after"`
}

type GetTailnetTunnelPeerBindingsRow added in v2.4.0

type GetTailnetTunnelPeerBindingsRow struct {
	PeerID        uuid.UUID     `db:"peer_id" json:"peer_id"`
	CoordinatorID uuid.UUID     `db:"coordinator_id" json:"coordinator_id"`
	UpdatedAt     time.Time     `db:"updated_at" json:"updated_at"`
	Node          []byte        `db:"node" json:"node"`
	Status        TailnetStatus `db:"status" json:"status"`
}

type GetTailnetTunnelPeerIDsRow added in v2.4.0

type GetTailnetTunnelPeerIDsRow struct {
	PeerID        uuid.UUID `db:"peer_id" json:"peer_id"`
	CoordinatorID uuid.UUID `db:"coordinator_id" json:"coordinator_id"`
	UpdatedAt     time.Time `db:"updated_at" json:"updated_at"`
}

type GetTemplateAppInsightsByTemplateParams added in v2.4.0

type GetTemplateAppInsightsByTemplateParams struct {
	StartTime time.Time `db:"start_time" json:"start_time"`
	EndTime   time.Time `db:"end_time" json:"end_time"`
}

type GetTemplateAppInsightsByTemplateRow added in v2.4.0

type GetTemplateAppInsightsByTemplateRow struct {
	TemplateID   uuid.UUID `db:"template_id" json:"template_id"`
	SlugOrPort   string    `db:"slug_or_port" json:"slug_or_port"`
	DisplayName  string    `db:"display_name" json:"display_name"`
	ActiveUsers  int64     `db:"active_users" json:"active_users"`
	UsageSeconds int64     `db:"usage_seconds" json:"usage_seconds"`
}

type GetTemplateAppInsightsParams

type GetTemplateAppInsightsParams struct {
	TemplateIDs []uuid.UUID `db:"template_ids" json:"template_ids"`
	StartTime   time.Time   `db:"start_time" json:"start_time"`
	EndTime     time.Time   `db:"end_time" json:"end_time"`
}

type GetTemplateAppInsightsRow

type GetTemplateAppInsightsRow struct {
	TemplateIDs  []uuid.UUID `db:"template_ids" json:"template_ids"`
	ActiveUsers  int64       `db:"active_users" json:"active_users"`
	Slug         string      `db:"slug" json:"slug"`
	DisplayName  string      `db:"display_name" json:"display_name"`
	Icon         string      `db:"icon" json:"icon"`
	UsageSeconds int64       `db:"usage_seconds" json:"usage_seconds"`
}

type GetTemplateAverageBuildTimeParams

type GetTemplateAverageBuildTimeParams struct {
	TemplateID uuid.NullUUID `db:"template_id" json:"template_id"`
	StartTime  sql.NullTime  `db:"start_time" json:"start_time"`
}

type GetTemplateAverageBuildTimeRow

type GetTemplateAverageBuildTimeRow struct {
	Start50  float64 `db:"start_50" json:"start_50"`
	Stop50   float64 `db:"stop_50" json:"stop_50"`
	Delete50 float64 `db:"delete_50" json:"delete_50"`
	Start95  float64 `db:"start_95" json:"start_95"`
	Stop95   float64 `db:"stop_95" json:"stop_95"`
	Delete95 float64 `db:"delete_95" json:"delete_95"`
}

type GetTemplateByOrganizationAndNameParams

type GetTemplateByOrganizationAndNameParams struct {
	OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"`
	Deleted        bool      `db:"deleted" json:"deleted"`
	Name           string    `db:"name" json:"name"`
}

type GetTemplateDAUsParams

type GetTemplateDAUsParams struct {
	TemplateID uuid.UUID `db:"template_id" json:"template_id"`
	TzOffset   int32     `db:"tz_offset" json:"tz_offset"`
}

type GetTemplateDAUsRow

type GetTemplateDAUsRow struct {
	Date   time.Time `db:"date" json:"date"`
	UserID uuid.UUID `db:"user_id" json:"user_id"`
}

type GetTemplateInsightsByIntervalParams added in v2.2.0

type GetTemplateInsightsByIntervalParams struct {
	TemplateIDs  []uuid.UUID `db:"template_ids" json:"template_ids"`
	IntervalDays int32       `db:"interval_days" json:"interval_days"`
	EndTime      time.Time   `db:"end_time" json:"end_time"`
	StartTime    time.Time   `db:"start_time" json:"start_time"`
}

type GetTemplateInsightsByIntervalRow added in v2.2.0

type GetTemplateInsightsByIntervalRow struct {
	StartTime   time.Time   `db:"start_time" json:"start_time"`
	EndTime     time.Time   `db:"end_time" json:"end_time"`
	TemplateIDs []uuid.UUID `db:"template_ids" json:"template_ids"`
	ActiveUsers int64       `db:"active_users" json:"active_users"`
}

type GetTemplateInsightsByTemplateParams added in v2.3.2

type GetTemplateInsightsByTemplateParams struct {
	StartTime time.Time `db:"start_time" json:"start_time"`
	EndTime   time.Time `db:"end_time" json:"end_time"`
}

type GetTemplateInsightsByTemplateRow added in v2.3.2

type GetTemplateInsightsByTemplateRow struct {
	TemplateID                  uuid.UUID `db:"template_id" json:"template_id"`
	ActiveUsers                 int64     `db:"active_users" json:"active_users"`
	UsageVscodeSeconds          int64     `db:"usage_vscode_seconds" json:"usage_vscode_seconds"`
	UsageJetbrainsSeconds       int64     `db:"usage_jetbrains_seconds" json:"usage_jetbrains_seconds"`
	UsageReconnectingPtySeconds int64     `db:"usage_reconnecting_pty_seconds" json:"usage_reconnecting_pty_seconds"`
	UsageSshSeconds             int64     `db:"usage_ssh_seconds" json:"usage_ssh_seconds"`
}

type GetTemplateInsightsParams

type GetTemplateInsightsParams struct {
	StartTime   time.Time   `db:"start_time" json:"start_time"`
	EndTime     time.Time   `db:"end_time" json:"end_time"`
	TemplateIDs []uuid.UUID `db:"template_ids" json:"template_ids"`
}

type GetTemplateInsightsRow

type GetTemplateInsightsRow struct {
	TemplateIDs                 []uuid.UUID `db:"template_ids" json:"template_ids"`
	SshTemplateIds              []uuid.UUID `db:"ssh_template_ids" json:"ssh_template_ids"`
	SftpTemplateIds             []uuid.UUID `db:"sftp_template_ids" json:"sftp_template_ids"`
	ReconnectingPtyTemplateIds  []uuid.UUID `db:"reconnecting_pty_template_ids" json:"reconnecting_pty_template_ids"`
	VscodeTemplateIds           []uuid.UUID `db:"vscode_template_ids" json:"vscode_template_ids"`
	JetbrainsTemplateIds        []uuid.UUID `db:"jetbrains_template_ids" json:"jetbrains_template_ids"`
	ActiveUsers                 int64       `db:"active_users" json:"active_users"`
	UsageTotalSeconds           int64       `db:"usage_total_seconds" json:"usage_total_seconds"`
	UsageSshSeconds             int64       `db:"usage_ssh_seconds" json:"usage_ssh_seconds"`
	UsageSftpSeconds            int64       `db:"usage_sftp_seconds" json:"usage_sftp_seconds"`
	UsageReconnectingPtySeconds int64       `db:"usage_reconnecting_pty_seconds" json:"usage_reconnecting_pty_seconds"`
	UsageVscodeSeconds          int64       `db:"usage_vscode_seconds" json:"usage_vscode_seconds"`
	UsageJetbrainsSeconds       int64       `db:"usage_jetbrains_seconds" json:"usage_jetbrains_seconds"`
}

type GetTemplateParameterInsightsParams

type GetTemplateParameterInsightsParams struct {
	StartTime   time.Time   `db:"start_time" json:"start_time"`
	EndTime     time.Time   `db:"end_time" json:"end_time"`
	TemplateIDs []uuid.UUID `db:"template_ids" json:"template_ids"`
}

type GetTemplateParameterInsightsRow

type GetTemplateParameterInsightsRow struct {
	Num         int64           `db:"num" json:"num"`
	TemplateIDs []uuid.UUID     `db:"template_ids" json:"template_ids"`
	Name        string          `db:"name" json:"name"`
	Type        string          `db:"type" json:"type"`
	DisplayName string          `db:"display_name" json:"display_name"`
	Description string          `db:"description" json:"description"`
	Options     json.RawMessage `db:"options" json:"options"`
	Value       string          `db:"value" json:"value"`
	Count       int64           `db:"count" json:"count"`
}

type GetTemplateUsageStatsParams added in v2.10.0

type GetTemplateUsageStatsParams struct {
	StartTime   time.Time   `db:"start_time" json:"start_time"`
	EndTime     time.Time   `db:"end_time" json:"end_time"`
	TemplateIDs []uuid.UUID `db:"template_ids" json:"template_ids"`
}

type GetTemplateVersionByTemplateIDAndNameParams

type GetTemplateVersionByTemplateIDAndNameParams struct {
	TemplateID uuid.NullUUID `db:"template_id" json:"template_id"`
	Name       string        `db:"name" json:"name"`
}

type GetTemplateVersionsByTemplateIDParams

type GetTemplateVersionsByTemplateIDParams struct {
	TemplateID uuid.UUID    `db:"template_id" json:"template_id"`
	Archived   sql.NullBool `db:"archived" json:"archived"`
	AfterID    uuid.UUID    `db:"after_id" json:"after_id"`
	OffsetOpt  int32        `db:"offset_opt" json:"offset_opt"`
	LimitOpt   int32        `db:"limit_opt" json:"limit_opt"`
}

type GetTemplatesWithFilterParams

type GetTemplatesWithFilterParams struct {
	Deleted        bool         `db:"deleted" json:"deleted"`
	OrganizationID uuid.UUID    `db:"organization_id" json:"organization_id"`
	ExactName      string       `db:"exact_name" json:"exact_name"`
	IDs            []uuid.UUID  `db:"ids" json:"ids"`
	Deprecated     sql.NullBool `db:"deprecated" json:"deprecated"`
}

type GetUserActivityInsightsParams added in v2.2.0

type GetUserActivityInsightsParams struct {
	StartTime   time.Time   `db:"start_time" json:"start_time"`
	EndTime     time.Time   `db:"end_time" json:"end_time"`
	TemplateIDs []uuid.UUID `db:"template_ids" json:"template_ids"`
}

type GetUserActivityInsightsRow added in v2.2.0

type GetUserActivityInsightsRow struct {
	UserID       uuid.UUID   `db:"user_id" json:"user_id"`
	Username     string      `db:"username" json:"username"`
	AvatarURL    string      `db:"avatar_url" json:"avatar_url"`
	TemplateIDs  []uuid.UUID `db:"template_ids" json:"template_ids"`
	UsageSeconds int64       `db:"usage_seconds" json:"usage_seconds"`
}

type GetUserByEmailOrUsernameParams

type GetUserByEmailOrUsernameParams struct {
	Username string `db:"username" json:"username"`
	Email    string `db:"email" json:"email"`
}

type GetUserLatencyInsightsParams

type GetUserLatencyInsightsParams struct {
	StartTime   time.Time   `db:"start_time" json:"start_time"`
	EndTime     time.Time   `db:"end_time" json:"end_time"`
	TemplateIDs []uuid.UUID `db:"template_ids" json:"template_ids"`
}

type GetUserLatencyInsightsRow

type GetUserLatencyInsightsRow struct {
	UserID                       uuid.UUID   `db:"user_id" json:"user_id"`
	Username                     string      `db:"username" json:"username"`
	AvatarURL                    string      `db:"avatar_url" json:"avatar_url"`
	TemplateIDs                  []uuid.UUID `db:"template_ids" json:"template_ids"`
	WorkspaceConnectionLatency50 float64     `db:"workspace_connection_latency_50" json:"workspace_connection_latency_50"`
	WorkspaceConnectionLatency95 float64     `db:"workspace_connection_latency_95" json:"workspace_connection_latency_95"`
}

type GetUserLinkByUserIDLoginTypeParams

type GetUserLinkByUserIDLoginTypeParams struct {
	UserID    uuid.UUID `db:"user_id" json:"user_id"`
	LoginType LoginType `db:"login_type" json:"login_type"`
}

type GetUserWorkspaceBuildParametersParams added in v2.8.0

type GetUserWorkspaceBuildParametersParams struct {
	OwnerID    uuid.UUID `db:"owner_id" json:"owner_id"`
	TemplateID uuid.UUID `db:"template_id" json:"template_id"`
}

type GetUserWorkspaceBuildParametersRow added in v2.8.0

type GetUserWorkspaceBuildParametersRow struct {
	Name  string `db:"name" json:"name"`
	Value string `db:"value" json:"value"`
}

type GetUsersParams

type GetUsersParams struct {
	AfterID        uuid.UUID    `db:"after_id" json:"after_id"`
	Search         string       `db:"search" json:"search"`
	Status         []UserStatus `db:"status" json:"status"`
	RbacRole       []string     `db:"rbac_role" json:"rbac_role"`
	LastSeenBefore time.Time    `db:"last_seen_before" json:"last_seen_before"`
	LastSeenAfter  time.Time    `db:"last_seen_after" json:"last_seen_after"`
	OffsetOpt      int32        `db:"offset_opt" json:"offset_opt"`
	LimitOpt       int32        `db:"limit_opt" json:"limit_opt"`
}

type GetUsersRow

type GetUsersRow 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          pq.StringArray `db:"rbac_roles" json:"rbac_roles"`
	LoginType          LoginType      `db:"login_type" json:"login_type"`
	AvatarURL          string         `db:"avatar_url" json:"avatar_url"`
	Deleted            bool           `db:"deleted" json:"deleted"`
	LastSeenAt         time.Time      `db:"last_seen_at" json:"last_seen_at"`
	QuietHoursSchedule string         `db:"quiet_hours_schedule" json:"quiet_hours_schedule"`
	ThemePreference    string         `db:"theme_preference" json:"theme_preference"`
	Name               string         `db:"name" json:"name"`
	Count              int64          `db:"count" json:"count"`
}

func (GetUsersRow) RBACObject

func (u GetUsersRow) RBACObject() rbac.Object

type GetWorkspaceAgentAndLatestBuildByAuthTokenRow added in v2.10.0

type GetWorkspaceAgentAndLatestBuildByAuthTokenRow struct {
	Workspace      Workspace      `db:"workspace" json:"workspace"`
	WorkspaceAgent WorkspaceAgent `db:"workspace_agent" json:"workspace_agent"`
	WorkspaceBuild WorkspaceBuild `db:"workspace_build" json:"workspace_build"`
}

type GetWorkspaceAgentLifecycleStateByIDRow

type GetWorkspaceAgentLifecycleStateByIDRow struct {
	LifecycleState WorkspaceAgentLifecycleState `db:"lifecycle_state" json:"lifecycle_state"`
	StartedAt      sql.NullTime                 `db:"started_at" json:"started_at"`
	ReadyAt        sql.NullTime                 `db:"ready_at" json:"ready_at"`
}

type GetWorkspaceAgentLogsAfterParams

type GetWorkspaceAgentLogsAfterParams struct {
	AgentID      uuid.UUID `db:"agent_id" json:"agent_id"`
	CreatedAfter int64     `db:"created_after" json:"created_after"`
}

type GetWorkspaceAgentMetadataParams added in v2.3.1

type GetWorkspaceAgentMetadataParams struct {
	WorkspaceAgentID uuid.UUID `db:"workspace_agent_id" json:"workspace_agent_id"`
	Keys             []string  `db:"keys" json:"keys"`
}

type GetWorkspaceAgentPortShareParams added in v2.9.0

type GetWorkspaceAgentPortShareParams struct {
	WorkspaceID uuid.UUID `db:"workspace_id" json:"workspace_id"`
	AgentName   string    `db:"agent_name" json:"agent_name"`
	Port        int32     `db:"port" json:"port"`
}

type GetWorkspaceAgentStatsAndLabelsRow

type GetWorkspaceAgentStatsAndLabelsRow struct {
	Username                    string  `db:"username" json:"username"`
	AgentName                   string  `db:"agent_name" json:"agent_name"`
	WorkspaceName               string  `db:"workspace_name" json:"workspace_name"`
	RxBytes                     int64   `db:"rx_bytes" json:"rx_bytes"`
	TxBytes                     int64   `db:"tx_bytes" json:"tx_bytes"`
	SessionCountVSCode          int64   `db:"session_count_vscode" json:"session_count_vscode"`
	SessionCountSSH             int64   `db:"session_count_ssh" json:"session_count_ssh"`
	SessionCountJetBrains       int64   `db:"session_count_jetbrains" json:"session_count_jetbrains"`
	SessionCountReconnectingPTY int64   `db:"session_count_reconnecting_pty" json:"session_count_reconnecting_pty"`
	ConnectionCount             int64   `db:"connection_count" json:"connection_count"`
	ConnectionMedianLatencyMS   float64 `db:"connection_median_latency_ms" json:"connection_median_latency_ms"`
}

type GetWorkspaceAgentStatsRow

type GetWorkspaceAgentStatsRow struct {
	UserID                       uuid.UUID `db:"user_id" json:"user_id"`
	AgentID                      uuid.UUID `db:"agent_id" json:"agent_id"`
	WorkspaceID                  uuid.UUID `db:"workspace_id" json:"workspace_id"`
	TemplateID                   uuid.UUID `db:"template_id" json:"template_id"`
	AggregatedFrom               time.Time `db:"aggregated_from" json:"aggregated_from"`
	WorkspaceRxBytes             int64     `db:"workspace_rx_bytes" json:"workspace_rx_bytes"`
	WorkspaceTxBytes             int64     `db:"workspace_tx_bytes" json:"workspace_tx_bytes"`
	WorkspaceConnectionLatency50 float64   `db:"workspace_connection_latency_50" json:"workspace_connection_latency_50"`
	WorkspaceConnectionLatency95 float64   `db:"workspace_connection_latency_95" json:"workspace_connection_latency_95"`
	AgentID_2                    uuid.UUID `db:"agent_id_2" json:"agent_id_2"`
	SessionCountVSCode           int64     `db:"session_count_vscode" json:"session_count_vscode"`
	SessionCountSSH              int64     `db:"session_count_ssh" json:"session_count_ssh"`
	SessionCountJetBrains        int64     `db:"session_count_jetbrains" json:"session_count_jetbrains"`
	SessionCountReconnectingPTY  int64     `db:"session_count_reconnecting_pty" json:"session_count_reconnecting_pty"`
}

type GetWorkspaceAppByAgentIDAndSlugParams

type GetWorkspaceAppByAgentIDAndSlugParams struct {
	AgentID uuid.UUID `db:"agent_id" json:"agent_id"`
	Slug    string    `db:"slug" json:"slug"`
}

type GetWorkspaceBuildByWorkspaceIDAndBuildNumberParams

type GetWorkspaceBuildByWorkspaceIDAndBuildNumberParams struct {
	WorkspaceID uuid.UUID `db:"workspace_id" json:"workspace_id"`
	BuildNumber int32     `db:"build_number" json:"build_number"`
}

type GetWorkspaceBuildsByWorkspaceIDParams

type GetWorkspaceBuildsByWorkspaceIDParams struct {
	WorkspaceID uuid.UUID `db:"workspace_id" json:"workspace_id"`
	Since       time.Time `db:"since" json:"since"`
	AfterID     uuid.UUID `db:"after_id" json:"after_id"`
	OffsetOpt   int32     `db:"offset_opt" json:"offset_opt"`
	LimitOpt    int32     `db:"limit_opt" json:"limit_opt"`
}

type GetWorkspaceByAgentIDRow added in v2.5.1

type GetWorkspaceByAgentIDRow struct {
	Workspace    Workspace `db:"workspace" json:"workspace"`
	TemplateName string    `db:"template_name" json:"template_name"`
}

func (GetWorkspaceByAgentIDRow) RBACObject added in v2.5.1

func (w GetWorkspaceByAgentIDRow) RBACObject() rbac.Object

type GetWorkspaceByOwnerIDAndNameParams

type GetWorkspaceByOwnerIDAndNameParams struct {
	OwnerID uuid.UUID `db:"owner_id" json:"owner_id"`
	Deleted bool      `db:"deleted" json:"deleted"`
	Name    string    `db:"name" json:"name"`
}

type GetWorkspaceProxyByHostnameParams

type GetWorkspaceProxyByHostnameParams struct {
	Hostname              string `db:"hostname" json:"hostname"`
	AllowAccessUrl        bool   `db:"allow_access_url" json:"allow_access_url"`
	AllowWildcardHostname bool   `db:"allow_wildcard_hostname" json:"allow_wildcard_hostname"`
}

type GetWorkspaceUniqueOwnerCountByTemplateIDsRow added in v2.5.0

type GetWorkspaceUniqueOwnerCountByTemplateIDsRow struct {
	TemplateID      uuid.UUID `db:"template_id" json:"template_id"`
	UniqueOwnersSum int64     `db:"unique_owners_sum" json:"unique_owners_sum"`
}

type GetWorkspacesParams

type GetWorkspacesParams struct {
	ParamNames                            []string     `db:"param_names" json:"param_names"`
	ParamValues                           []string     `db:"param_values" json:"param_values"`
	Deleted                               bool         `db:"deleted" json:"deleted"`
	Status                                string       `db:"status" json:"status"`
	OwnerID                               uuid.UUID    `db:"owner_id" json:"owner_id"`
	HasParam                              []string     `db:"has_param" json:"has_param"`
	OwnerUsername                         string       `db:"owner_username" json:"owner_username"`
	TemplateName                          string       `db:"template_name" json:"template_name"`
	TemplateIDs                           []uuid.UUID  `db:"template_ids" json:"template_ids"`
	WorkspaceIds                          []uuid.UUID  `db:"workspace_ids" json:"workspace_ids"`
	Name                                  string       `db:"name" json:"name"`
	HasAgent                              string       `db:"has_agent" json:"has_agent"`
	AgentInactiveDisconnectTimeoutSeconds int64        `db:"agent_inactive_disconnect_timeout_seconds" json:"agent_inactive_disconnect_timeout_seconds"`
	Dormant                               bool         `db:"dormant" json:"dormant"`
	LastUsedBefore                        time.Time    `db:"last_used_before" json:"last_used_before"`
	LastUsedAfter                         time.Time    `db:"last_used_after" json:"last_used_after"`
	UsingActive                           sql.NullBool `db:"using_active" json:"using_active"`
	RequesterID                           uuid.UUID    `db:"requester_id" json:"requester_id"`
	Offset                                int32        `db:"offset_" json:"offset_"`
	Limit                                 int32        `db:"limit_" json:"limit_"`
	WithSummary                           bool         `db:"with_summary" json:"with_summary"`
}

type GetWorkspacesRow

type GetWorkspacesRow 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"`
	LastUsedAt             time.Time            `db:"last_used_at" json:"last_used_at"`
	DormantAt              sql.NullTime         `db:"dormant_at" json:"dormant_at"`
	DeletingAt             sql.NullTime         `db:"deleting_at" json:"deleting_at"`
	AutomaticUpdates       AutomaticUpdates     `db:"automatic_updates" json:"automatic_updates"`
	Favorite               bool                 `db:"favorite" json:"favorite"`
	TemplateName           string               `db:"template_name" json:"template_name"`
	TemplateVersionID      uuid.UUID            `db:"template_version_id" json:"template_version_id"`
	TemplateVersionName    sql.NullString       `db:"template_version_name" json:"template_version_name"`
	Username               string               `db:"username" json:"username"`
	LatestBuildCompletedAt sql.NullTime         `db:"latest_build_completed_at" json:"latest_build_completed_at"`
	LatestBuildCanceledAt  sql.NullTime         `db:"latest_build_canceled_at" json:"latest_build_canceled_at"`
	LatestBuildError       sql.NullString       `db:"latest_build_error" json:"latest_build_error"`
	LatestBuildTransition  WorkspaceTransition  `db:"latest_build_transition" json:"latest_build_transition"`
	LatestBuildStatus      ProvisionerJobStatus `db:"latest_build_status" json:"latest_build_status"`
	Count                  int64                `db:"count" json:"count"`
}

type GitSSHKey

type GitSSHKey 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"`
}

func (GitSSHKey) RBACObject

func (u GitSSHKey) RBACObject() rbac.Object

type Group

type Group struct {
	ID             uuid.UUID `db:"id" json:"id"`
	Name           string    `db:"name" json:"name"`
	OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"`
	AvatarURL      string    `db:"avatar_url" json:"avatar_url"`
	QuotaAllowance int32     `db:"quota_allowance" json:"quota_allowance"`
	// Display name is a custom, human-friendly group name that user can set. This is not required to be unique and can be the empty string.
	DisplayName string `db:"display_name" json:"display_name"`
	// Source indicates how the group was created. It can be created by a user manually, or through some system process like OIDC group sync.
	Source GroupSource `db:"source" json:"source"`
}

func (Group) Auditable

func (g Group) Auditable(users []User) AuditableGroup

Auditable returns an object that can be used in audit logs. Covers both group and group member changes.

func (Group) IsEveryone

func (g Group) IsEveryone() bool

func (Group) RBACObject

func (g Group) RBACObject() rbac.Object

type GroupMember

type GroupMember struct {
	UserID  uuid.UUID `db:"user_id" json:"user_id"`
	GroupID uuid.UUID `db:"group_id" json:"group_id"`
}

type GroupSource

type GroupSource string
const (
	GroupSourceUser GroupSource = "user"
	GroupSourceOidc GroupSource = "oidc"
)

func AllGroupSourceValues

func AllGroupSourceValues() []GroupSource

func (*GroupSource) Scan

func (e *GroupSource) Scan(src interface{}) error

func (GroupSource) Valid

func (e GroupSource) Valid() bool

type HealthSettings added in v2.5.0

type HealthSettings struct {
	ID                    uuid.UUID                 `db:"id" json:"id"`
	DismissedHealthchecks []healthsdk.HealthSection `db:"dismissed_healthchecks" json:"dismissed_healthchecks"`
}

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"`
	IPAddress       pqtype.Inet `db:"ip_address" json:"ip_address"`
	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"`
	Scope           APIKeyScope `db:"scope" json:"scope"`
	TokenName       string      `db:"token_name" json:"token_name"`
}

type InsertAuditLogParams

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        sql.NullString  `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"`
	AdditionalFields json.RawMessage `db:"additional_fields" json:"additional_fields"`
	RequestID        uuid.UUID       `db:"request_id" json:"request_id"`
	ResourceIcon     string          `db:"resource_icon" json:"resource_icon"`
}

type InsertDBCryptKeyParams added in v2.2.0

type InsertDBCryptKeyParams struct {
	Number          int32  `db:"number" json:"number"`
	ActiveKeyDigest string `db:"active_key_digest" json:"active_key_digest"`
	Test            string `db:"test" json:"test"`
}

type InsertExternalAuthLinkParams added in v2.2.1

type InsertExternalAuthLinkParams struct {
	ProviderID             string                `db:"provider_id" json:"provider_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"`
	OAuthAccessToken       string                `db:"oauth_access_token" json:"oauth_access_token"`
	OAuthAccessTokenKeyID  sql.NullString        `db:"oauth_access_token_key_id" json:"oauth_access_token_key_id"`
	OAuthRefreshToken      string                `db:"oauth_refresh_token" json:"oauth_refresh_token"`
	OAuthRefreshTokenKeyID sql.NullString        `db:"oauth_refresh_token_key_id" json:"oauth_refresh_token_key_id"`
	OAuthExpiry            time.Time             `db:"oauth_expiry" json:"oauth_expiry"`
	OAuthExtra             pqtype.NullRawMessage `db:"oauth_extra" json:"oauth_extra"`
}

type InsertFileParams

type InsertFileParams struct {
	ID        uuid.UUID `db:"id" json:"id"`
	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"`
}

type InsertGitSSHKeyParams

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 InsertGroupMemberParams

type InsertGroupMemberParams struct {
	UserID  uuid.UUID `db:"user_id" json:"user_id"`
	GroupID uuid.UUID `db:"group_id" json:"group_id"`
}

type InsertGroupParams

type InsertGroupParams struct {
	ID             uuid.UUID `db:"id" json:"id"`
	Name           string    `db:"name" json:"name"`
	DisplayName    string    `db:"display_name" json:"display_name"`
	OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"`
	AvatarURL      string    `db:"avatar_url" json:"avatar_url"`
	QuotaAllowance int32     `db:"quota_allowance" json:"quota_allowance"`
}

type InsertLicenseParams

type InsertLicenseParams struct {
	UploadedAt time.Time `db:"uploaded_at" json:"uploaded_at"`
	JWT        string    `db:"jwt" json:"jwt"`
	Exp        time.Time `db:"exp" json:"exp"`
	UUID       uuid.UUID `db:"uuid" json:"uuid"`
}

type InsertMissingGroupsParams

type InsertMissingGroupsParams struct {
	OrganizationID uuid.UUID   `db:"organization_id" json:"organization_id"`
	Source         GroupSource `db:"source" json:"source"`
	GroupNames     []string    `db:"group_names" json:"group_names"`
}

type InsertOAuth2ProviderAppCodeParams added in v2.9.0

type InsertOAuth2ProviderAppCodeParams struct {
	ID           uuid.UUID `db:"id" json:"id"`
	CreatedAt    time.Time `db:"created_at" json:"created_at"`
	ExpiresAt    time.Time `db:"expires_at" json:"expires_at"`
	SecretPrefix []byte    `db:"secret_prefix" json:"secret_prefix"`
	HashedSecret []byte    `db:"hashed_secret" json:"hashed_secret"`
	AppID        uuid.UUID `db:"app_id" json:"app_id"`
	UserID       uuid.UUID `db:"user_id" json:"user_id"`
}

type InsertOAuth2ProviderAppParams added in v2.6.0

type InsertOAuth2ProviderAppParams 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"`
	Icon        string    `db:"icon" json:"icon"`
	CallbackURL string    `db:"callback_url" json:"callback_url"`
}

type InsertOAuth2ProviderAppSecretParams added in v2.6.0

type InsertOAuth2ProviderAppSecretParams struct {
	ID            uuid.UUID `db:"id" json:"id"`
	CreatedAt     time.Time `db:"created_at" json:"created_at"`
	SecretPrefix  []byte    `db:"secret_prefix" json:"secret_prefix"`
	HashedSecret  []byte    `db:"hashed_secret" json:"hashed_secret"`
	DisplaySecret string    `db:"display_secret" json:"display_secret"`
	AppID         uuid.UUID `db:"app_id" json:"app_id"`
}

type InsertOAuth2ProviderAppTokenParams added in v2.9.0

type InsertOAuth2ProviderAppTokenParams struct {
	ID          uuid.UUID `db:"id" json:"id"`
	CreatedAt   time.Time `db:"created_at" json:"created_at"`
	ExpiresAt   time.Time `db:"expires_at" json:"expires_at"`
	HashPrefix  []byte    `db:"hash_prefix" json:"hash_prefix"`
	RefreshHash []byte    `db:"refresh_hash" json:"refresh_hash"`
	AppSecretID uuid.UUID `db:"app_secret_id" json:"app_secret_id"`
	APIKeyID    string    `db:"api_key_id" json:"api_key_id"`
}

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 InsertOrganizationParams

type InsertOrganizationParams 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"`
}

type InsertProvisionerJobLogsParams

type InsertProvisionerJobLogsParams struct {
	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"`
	FileID         uuid.UUID                `db:"file_id" json:"file_id"`
	Type           ProvisionerJobType       `db:"type" json:"type"`
	Input          json.RawMessage          `db:"input" json:"input"`
	Tags           StringMap                `db:"tags" json:"tags"`
	TraceMetadata  pqtype.NullRawMessage    `db:"trace_metadata" json:"trace_metadata"`
}

type InsertReplicaParams

type InsertReplicaParams struct {
	ID              uuid.UUID `db:"id" json:"id"`
	CreatedAt       time.Time `db:"created_at" json:"created_at"`
	StartedAt       time.Time `db:"started_at" json:"started_at"`
	UpdatedAt       time.Time `db:"updated_at" json:"updated_at"`
	Hostname        string    `db:"hostname" json:"hostname"`
	RegionID        int32     `db:"region_id" json:"region_id"`
	RelayAddress    string    `db:"relay_address" json:"relay_address"`
	Version         string    `db:"version" json:"version"`
	DatabaseLatency int32     `db:"database_latency" json:"database_latency"`
	Primary         bool      `db:"primary" json:"primary"`
}

type InsertTemplateParams

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"`
	CreatedBy                    uuid.UUID       `db:"created_by" json:"created_by"`
	Icon                         string          `db:"icon" json:"icon"`
	UserACL                      TemplateACL     `db:"user_acl" json:"user_acl"`
	GroupACL                     TemplateACL     `db:"group_acl" json:"group_acl"`
	DisplayName                  string          `db:"display_name" json:"display_name"`
	AllowUserCancelWorkspaceJobs bool            `db:"allow_user_cancel_workspace_jobs" json:"allow_user_cancel_workspace_jobs"`
	MaxPortSharingLevel          AppSharingLevel `db:"max_port_sharing_level" json:"max_port_sharing_level"`
}

type InsertTemplateVersionParameterParams

type InsertTemplateVersionParameterParams struct {
	TemplateVersionID   uuid.UUID       `db:"template_version_id" json:"template_version_id"`
	Name                string          `db:"name" json:"name"`
	Description         string          `db:"description" json:"description"`
	Type                string          `db:"type" json:"type"`
	Mutable             bool            `db:"mutable" json:"mutable"`
	DefaultValue        string          `db:"default_value" json:"default_value"`
	Icon                string          `db:"icon" json:"icon"`
	Options             json.RawMessage `db:"options" json:"options"`
	ValidationRegex     string          `db:"validation_regex" json:"validation_regex"`
	ValidationMin       sql.NullInt32   `db:"validation_min" json:"validation_min"`
	ValidationMax       sql.NullInt32   `db:"validation_max" json:"validation_max"`
	ValidationError     string          `db:"validation_error" json:"validation_error"`
	ValidationMonotonic string          `db:"validation_monotonic" json:"validation_monotonic"`
	Required            bool            `db:"required" json:"required"`
	DisplayName         string          `db:"display_name" json:"display_name"`
	DisplayOrder        int32           `db:"display_order" json:"display_order"`
	Ephemeral           bool            `db:"ephemeral" json:"ephemeral"`
}

type InsertTemplateVersionParams

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"`
	Message        string        `db:"message" json:"message"`
	Readme         string        `db:"readme" json:"readme"`
	JobID          uuid.UUID     `db:"job_id" json:"job_id"`
	CreatedBy      uuid.UUID     `db:"created_by" json:"created_by"`
}

type InsertTemplateVersionVariableParams

type InsertTemplateVersionVariableParams struct {
	TemplateVersionID uuid.UUID `db:"template_version_id" json:"template_version_id"`
	Name              string    `db:"name" json:"name"`
	Description       string    `db:"description" json:"description"`
	Type              string    `db:"type" json:"type"`
	Value             string    `db:"value" json:"value"`
	DefaultValue      string    `db:"default_value" json:"default_value"`
	Required          bool      `db:"required" json:"required"`
	Sensitive         bool      `db:"sensitive" json:"sensitive"`
}

type InsertUserGroupsByNameParams

type InsertUserGroupsByNameParams struct {
	UserID         uuid.UUID `db:"user_id" json:"user_id"`
	OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"`
	GroupNames     []string  `db:"group_names" json:"group_names"`
}

type InsertUserLinkParams

type InsertUserLinkParams struct {
	UserID                 uuid.UUID       `db:"user_id" json:"user_id"`
	LoginType              LoginType       `db:"login_type" json:"login_type"`
	LinkedID               string          `db:"linked_id" json:"linked_id"`
	OAuthAccessToken       string          `db:"oauth_access_token" json:"oauth_access_token"`
	OAuthAccessTokenKeyID  sql.NullString  `db:"oauth_access_token_key_id" json:"oauth_access_token_key_id"`
	OAuthRefreshToken      string          `db:"oauth_refresh_token" json:"oauth_refresh_token"`
	OAuthRefreshTokenKeyID sql.NullString  `db:"oauth_refresh_token_key_id" json:"oauth_refresh_token_key_id"`
	OAuthExpiry            time.Time       `db:"oauth_expiry" json:"oauth_expiry"`
	DebugContext           json.RawMessage `db:"debug_context" json:"debug_context"`
}

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      pq.StringArray `db:"rbac_roles" json:"rbac_roles"`
	LoginType      LoginType      `db:"login_type" json:"login_type"`
}

type InsertWorkspaceAgentLogSourcesParams added in v2.2.0

type InsertWorkspaceAgentLogSourcesParams struct {
	WorkspaceAgentID uuid.UUID   `db:"workspace_agent_id" json:"workspace_agent_id"`
	CreatedAt        time.Time   `db:"created_at" json:"created_at"`
	ID               []uuid.UUID `db:"id" json:"id"`
	DisplayName      []string    `db:"display_name" json:"display_name"`
	Icon             []string    `db:"icon" json:"icon"`
}

type InsertWorkspaceAgentLogsParams

type InsertWorkspaceAgentLogsParams struct {
	AgentID      uuid.UUID  `db:"agent_id" json:"agent_id"`
	CreatedAt    time.Time  `db:"created_at" json:"created_at"`
	Output       []string   `db:"output" json:"output"`
	Level        []LogLevel `db:"level" json:"level"`
	LogSourceID  uuid.UUID  `db:"log_source_id" json:"log_source_id"`
	OutputLength int32      `db:"output_length" json:"output_length"`
}

type InsertWorkspaceAgentMetadataParams

type InsertWorkspaceAgentMetadataParams struct {
	WorkspaceAgentID uuid.UUID `db:"workspace_agent_id" json:"workspace_agent_id"`
	DisplayName      string    `db:"display_name" json:"display_name"`
	Key              string    `db:"key" json:"key"`
	Script           string    `db:"script" json:"script"`
	Timeout          int64     `db:"timeout" json:"timeout"`
	Interval         int64     `db:"interval" json:"interval"`
	DisplayOrder     int32     `db:"display_order" json:"display_order"`
}

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"`
	Directory                string                `db:"directory" json:"directory"`
	InstanceMetadata         pqtype.NullRawMessage `db:"instance_metadata" json:"instance_metadata"`
	ResourceMetadata         pqtype.NullRawMessage `db:"resource_metadata" json:"resource_metadata"`
	ConnectionTimeoutSeconds int32                 `db:"connection_timeout_seconds" json:"connection_timeout_seconds"`
	TroubleshootingURL       string                `db:"troubleshooting_url" json:"troubleshooting_url"`
	MOTDFile                 string                `db:"motd_file" json:"motd_file"`
	DisplayApps              []DisplayApp          `db:"display_apps" json:"display_apps"`
	DisplayOrder             int32                 `db:"display_order" json:"display_order"`
}

type InsertWorkspaceAgentScriptsParams added in v2.2.0

type InsertWorkspaceAgentScriptsParams struct {
	WorkspaceAgentID uuid.UUID   `db:"workspace_agent_id" json:"workspace_agent_id"`
	CreatedAt        time.Time   `db:"created_at" json:"created_at"`
	LogSourceID      []uuid.UUID `db:"log_source_id" json:"log_source_id"`
	LogPath          []string    `db:"log_path" json:"log_path"`
	Script           []string    `db:"script" json:"script"`
	Cron             []string    `db:"cron" json:"cron"`
	StartBlocksLogin []bool      `db:"start_blocks_login" json:"start_blocks_login"`
	RunOnStart       []bool      `db:"run_on_start" json:"run_on_start"`
	RunOnStop        []bool      `db:"run_on_stop" json:"run_on_stop"`
	TimeoutSeconds   []int32     `db:"timeout_seconds" json:"timeout_seconds"`
}

type InsertWorkspaceAgentStatParams

type InsertWorkspaceAgentStatParams struct {
	ID                          uuid.UUID       `db:"id" json:"id"`
	CreatedAt                   time.Time       `db:"created_at" json:"created_at"`
	UserID                      uuid.UUID       `db:"user_id" json:"user_id"`
	WorkspaceID                 uuid.UUID       `db:"workspace_id" json:"workspace_id"`
	TemplateID                  uuid.UUID       `db:"template_id" json:"template_id"`
	AgentID                     uuid.UUID       `db:"agent_id" json:"agent_id"`
	ConnectionsByProto          json.RawMessage `db:"connections_by_proto" json:"connections_by_proto"`
	ConnectionCount             int64           `db:"connection_count" json:"connection_count"`
	RxPackets                   int64           `db:"rx_packets" json:"rx_packets"`
	RxBytes                     int64           `db:"rx_bytes" json:"rx_bytes"`
	TxPackets                   int64           `db:"tx_packets" json:"tx_packets"`
	TxBytes                     int64           `db:"tx_bytes" json:"tx_bytes"`
	SessionCountVSCode          int64           `db:"session_count_vscode" json:"session_count_vscode"`
	SessionCountJetBrains       int64           `db:"session_count_jetbrains" json:"session_count_jetbrains"`
	SessionCountReconnectingPTY int64           `db:"session_count_reconnecting_pty" json:"session_count_reconnecting_pty"`
	SessionCountSSH             int64           `db:"session_count_ssh" json:"session_count_ssh"`
	ConnectionMedianLatencyMS   float64         `db:"connection_median_latency_ms" json:"connection_median_latency_ms"`
}

type InsertWorkspaceAgentStatsParams

type InsertWorkspaceAgentStatsParams struct {
	ID                          []uuid.UUID     `db:"id" json:"id"`
	CreatedAt                   []time.Time     `db:"created_at" json:"created_at"`
	UserID                      []uuid.UUID     `db:"user_id" json:"user_id"`
	WorkspaceID                 []uuid.UUID     `db:"workspace_id" json:"workspace_id"`
	TemplateID                  []uuid.UUID     `db:"template_id" json:"template_id"`
	AgentID                     []uuid.UUID     `db:"agent_id" json:"agent_id"`
	ConnectionsByProto          json.RawMessage `db:"connections_by_proto" json:"connections_by_proto"`
	ConnectionCount             []int64         `db:"connection_count" json:"connection_count"`
	RxPackets                   []int64         `db:"rx_packets" json:"rx_packets"`
	RxBytes                     []int64         `db:"rx_bytes" json:"rx_bytes"`
	TxPackets                   []int64         `db:"tx_packets" json:"tx_packets"`
	TxBytes                     []int64         `db:"tx_bytes" json:"tx_bytes"`
	SessionCountVSCode          []int64         `db:"session_count_vscode" json:"session_count_vscode"`
	SessionCountJetBrains       []int64         `db:"session_count_jetbrains" json:"session_count_jetbrains"`
	SessionCountReconnectingPTY []int64         `db:"session_count_reconnecting_pty" json:"session_count_reconnecting_pty"`
	SessionCountSSH             []int64         `db:"session_count_ssh" json:"session_count_ssh"`
	ConnectionMedianLatencyMS   []float64       `db:"connection_median_latency_ms" json:"connection_median_latency_ms"`
}

type InsertWorkspaceAppParams

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"`
	Slug                 string             `db:"slug" json:"slug"`
	DisplayName          string             `db:"display_name" json:"display_name"`
	Icon                 string             `db:"icon" json:"icon"`
	Command              sql.NullString     `db:"command" json:"command"`
	Url                  sql.NullString     `db:"url" json:"url"`
	External             bool               `db:"external" json:"external"`
	Subdomain            bool               `db:"subdomain" json:"subdomain"`
	SharingLevel         AppSharingLevel    `db:"sharing_level" json:"sharing_level"`
	HealthcheckUrl       string             `db:"healthcheck_url" json:"healthcheck_url"`
	HealthcheckInterval  int32              `db:"healthcheck_interval" json:"healthcheck_interval"`
	HealthcheckThreshold int32              `db:"healthcheck_threshold" json:"healthcheck_threshold"`
	Health               WorkspaceAppHealth `db:"health" json:"health"`
	DisplayOrder         int32              `db:"display_order" json:"display_order"`
}

type InsertWorkspaceAppStatsParams

type InsertWorkspaceAppStatsParams struct {
	UserID           []uuid.UUID `db:"user_id" json:"user_id"`
	WorkspaceID      []uuid.UUID `db:"workspace_id" json:"workspace_id"`
	AgentID          []uuid.UUID `db:"agent_id" json:"agent_id"`
	AccessMethod     []string    `db:"access_method" json:"access_method"`
	SlugOrPort       []string    `db:"slug_or_port" json:"slug_or_port"`
	SessionID        []uuid.UUID `db:"session_id" json:"session_id"`
	SessionStartedAt []time.Time `db:"session_started_at" json:"session_started_at"`
	SessionEndedAt   []time.Time `db:"session_ended_at" json:"session_ended_at"`
	Requests         []int32     `db:"requests" json:"requests"`
}

type InsertWorkspaceBuildParametersParams

type InsertWorkspaceBuildParametersParams struct {
	WorkspaceBuildID uuid.UUID `db:"workspace_build_id" json:"workspace_build_id"`
	Name             []string  `db:"name" json:"name"`
	Value            []string  `db:"value" json:"value"`
}

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"`
	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"`
	MaxDeadline       time.Time           `db:"max_deadline" json:"max_deadline"`
	Reason            BuildReason         `db:"reason" json:"reason"`
}

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"`
	LastUsedAt        time.Time        `db:"last_used_at" json:"last_used_at"`
	AutomaticUpdates  AutomaticUpdates `db:"automatic_updates" json:"automatic_updates"`
}

type InsertWorkspaceProxyParams

type InsertWorkspaceProxyParams struct {
	ID                uuid.UUID `db:"id" json:"id"`
	Name              string    `db:"name" json:"name"`
	DisplayName       string    `db:"display_name" json:"display_name"`
	Icon              string    `db:"icon" json:"icon"`
	DerpEnabled       bool      `db:"derp_enabled" json:"derp_enabled"`
	DerpOnly          bool      `db:"derp_only" json:"derp_only"`
	TokenHashedSecret []byte    `db:"token_hashed_secret" json:"token_hashed_secret"`
	CreatedAt         time.Time `db:"created_at" json:"created_at"`
	UpdatedAt         time.Time `db:"updated_at" json:"updated_at"`
}

type InsertWorkspaceResourceMetadataParams

type InsertWorkspaceResourceMetadataParams struct {
	WorkspaceResourceID uuid.UUID `db:"workspace_resource_id" json:"workspace_resource_id"`
	Key                 []string  `db:"key" json:"key"`
	Value               []string  `db:"value" json:"value"`
	Sensitive           []bool    `db:"sensitive" json:"sensitive"`
}

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"`
	Hide         bool                `db:"hide" json:"hide"`
	Icon         string              `db:"icon" json:"icon"`
	InstanceType sql.NullString      `db:"instance_type" json:"instance_type"`
	DailyCost    int32               `db:"daily_cost" json:"daily_cost"`
}

type JfrogXrayScan added in v2.8.0

type JfrogXrayScan struct {
	AgentID     uuid.UUID `db:"agent_id" json:"agent_id"`
	WorkspaceID uuid.UUID `db:"workspace_id" json:"workspace_id"`
	Critical    int32     `db:"critical" json:"critical"`
	High        int32     `db:"high" json:"high"`
	Medium      int32     `db:"medium" json:"medium"`
	ResultsUrl  string    `db:"results_url" json:"results_url"`
}

type License

type License struct {
	ID         int32     `db:"id" json:"id"`
	UploadedAt time.Time `db:"uploaded_at" json:"uploaded_at"`
	JWT        string    `db:"jwt" json:"jwt"`
	// exp tracks the claim of the same name in the JWT, and we include it here so that we can easily query for licenses that have not yet expired.
	Exp  time.Time `db:"exp" json:"exp"`
	UUID uuid.UUID `db:"uuid" json:"uuid"`
}

func (License) RBACObject

func (l License) RBACObject() rbac.Object

type LogLevel

type LogLevel string
const (
	LogLevelTrace LogLevel = "trace"
	LogLevelDebug LogLevel = "debug"
	LogLevelInfo  LogLevel = "info"
	LogLevelWarn  LogLevel = "warn"
	LogLevelError LogLevel = "error"
)

func AllLogLevelValues

func AllLogLevelValues() []LogLevel

func (*LogLevel) Scan

func (e *LogLevel) Scan(src interface{}) error

func (LogLevel) Valid

func (e LogLevel) Valid() bool

type LogSource

type LogSource string
const (
	LogSourceProvisionerDaemon LogSource = "provisioner_daemon"
	LogSourceProvisioner       LogSource = "provisioner"
)

func AllLogSourceValues

func AllLogSourceValues() []LogSource

func (*LogSource) Scan

func (e *LogSource) Scan(src interface{}) error

func (LogSource) Valid

func (e LogSource) Valid() bool

type LoginType

type LoginType string

Specifies the method of authentication. "none" is a special case in which no authentication method is allowed.

const (
	LoginTypePassword          LoginType = "password"
	LoginTypeGithub            LoginType = "github"
	LoginTypeOIDC              LoginType = "oidc"
	LoginTypeToken             LoginType = "token"
	LoginTypeNone              LoginType = "none"
	LoginTypeOAuth2ProviderApp LoginType = "oauth2_provider_app"
)

func AllLoginTypeValues

func AllLoginTypeValues() []LoginType

func (*LoginType) Scan

func (e *LoginType) Scan(src interface{}) error

func (LoginType) Valid

func (e LoginType) Valid() bool

type NullAPIKeyScope

type NullAPIKeyScope struct {
	APIKeyScope APIKeyScope `json:"api_key_scope"`
	Valid       bool        `json:"valid"` // Valid is true if APIKeyScope is not NULL
}

func (*NullAPIKeyScope) Scan

func (ns *NullAPIKeyScope) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullAPIKeyScope) Value

func (ns NullAPIKeyScope) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullAppSharingLevel

type NullAppSharingLevel struct {
	AppSharingLevel AppSharingLevel `json:"app_sharing_level"`
	Valid           bool            `json:"valid"` // Valid is true if AppSharingLevel is not NULL
}

func (*NullAppSharingLevel) Scan

func (ns *NullAppSharingLevel) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullAppSharingLevel) Value

func (ns NullAppSharingLevel) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullAuditAction

type NullAuditAction struct {
	AuditAction AuditAction `json:"audit_action"`
	Valid       bool        `json:"valid"` // Valid is true if AuditAction is not NULL
}

func (*NullAuditAction) Scan

func (ns *NullAuditAction) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullAuditAction) Value

func (ns NullAuditAction) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullAutomaticUpdates added in v2.3.0

type NullAutomaticUpdates struct {
	AutomaticUpdates AutomaticUpdates `json:"automatic_updates"`
	Valid            bool             `json:"valid"` // Valid is true if AutomaticUpdates is not NULL
}

func (*NullAutomaticUpdates) Scan added in v2.3.0

func (ns *NullAutomaticUpdates) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullAutomaticUpdates) Value added in v2.3.0

func (ns NullAutomaticUpdates) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullBuildReason

type NullBuildReason struct {
	BuildReason BuildReason `json:"build_reason"`
	Valid       bool        `json:"valid"` // Valid is true if BuildReason is not NULL
}

func (*NullBuildReason) Scan

func (ns *NullBuildReason) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullBuildReason) Value

func (ns NullBuildReason) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullDisplayApp added in v2.1.5

type NullDisplayApp struct {
	DisplayApp DisplayApp `json:"display_app"`
	Valid      bool       `json:"valid"` // Valid is true if DisplayApp is not NULL
}

func (*NullDisplayApp) Scan added in v2.1.5

func (ns *NullDisplayApp) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullDisplayApp) Value added in v2.1.5

func (ns NullDisplayApp) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullGroupSource

type NullGroupSource struct {
	GroupSource GroupSource `json:"group_source"`
	Valid       bool        `json:"valid"` // Valid is true if GroupSource is not NULL
}

func (*NullGroupSource) Scan

func (ns *NullGroupSource) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullGroupSource) Value

func (ns NullGroupSource) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullLogLevel

type NullLogLevel struct {
	LogLevel LogLevel `json:"log_level"`
	Valid    bool     `json:"valid"` // Valid is true if LogLevel is not NULL
}

func (*NullLogLevel) Scan

func (ns *NullLogLevel) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullLogLevel) Value

func (ns NullLogLevel) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullLogSource

type NullLogSource struct {
	LogSource LogSource `json:"log_source"`
	Valid     bool      `json:"valid"` // Valid is true if LogSource is not NULL
}

func (*NullLogSource) Scan

func (ns *NullLogSource) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullLogSource) Value

func (ns NullLogSource) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullLoginType

type NullLoginType struct {
	LoginType LoginType `json:"login_type"`
	Valid     bool      `json:"valid"` // Valid is true if LoginType is not NULL
}

func (*NullLoginType) Scan

func (ns *NullLoginType) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullLoginType) Value

func (ns NullLoginType) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullParameterDestinationScheme

type NullParameterDestinationScheme struct {
	ParameterDestinationScheme ParameterDestinationScheme `json:"parameter_destination_scheme"`
	Valid                      bool                       `json:"valid"` // Valid is true if ParameterDestinationScheme is not NULL
}

func (*NullParameterDestinationScheme) Scan

func (ns *NullParameterDestinationScheme) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullParameterDestinationScheme) Value

Value implements the driver Valuer interface.

type NullParameterScope

type NullParameterScope struct {
	ParameterScope ParameterScope `json:"parameter_scope"`
	Valid          bool           `json:"valid"` // Valid is true if ParameterScope is not NULL
}

func (*NullParameterScope) Scan

func (ns *NullParameterScope) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullParameterScope) Value

func (ns NullParameterScope) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullParameterSourceScheme

type NullParameterSourceScheme struct {
	ParameterSourceScheme ParameterSourceScheme `json:"parameter_source_scheme"`
	Valid                 bool                  `json:"valid"` // Valid is true if ParameterSourceScheme is not NULL
}

func (*NullParameterSourceScheme) Scan

func (ns *NullParameterSourceScheme) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullParameterSourceScheme) Value

Value implements the driver Valuer interface.

type NullParameterTypeSystem

type NullParameterTypeSystem struct {
	ParameterTypeSystem ParameterTypeSystem `json:"parameter_type_system"`
	Valid               bool                `json:"valid"` // Valid is true if ParameterTypeSystem is not NULL
}

func (*NullParameterTypeSystem) Scan

func (ns *NullParameterTypeSystem) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullParameterTypeSystem) Value

func (ns NullParameterTypeSystem) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullPortShareProtocol added in v2.9.0

type NullPortShareProtocol struct {
	PortShareProtocol PortShareProtocol `json:"port_share_protocol"`
	Valid             bool              `json:"valid"` // Valid is true if PortShareProtocol is not NULL
}

func (*NullPortShareProtocol) Scan added in v2.9.0

func (ns *NullPortShareProtocol) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullPortShareProtocol) Value added in v2.9.0

func (ns NullPortShareProtocol) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullProvisionerJobStatus added in v2.3.0

type NullProvisionerJobStatus struct {
	ProvisionerJobStatus ProvisionerJobStatus `json:"provisioner_job_status"`
	Valid                bool                 `json:"valid"` // Valid is true if ProvisionerJobStatus is not NULL
}

func (*NullProvisionerJobStatus) Scan added in v2.3.0

func (ns *NullProvisionerJobStatus) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullProvisionerJobStatus) Value added in v2.3.0

Value implements the driver Valuer interface.

type NullProvisionerJobType

type NullProvisionerJobType struct {
	ProvisionerJobType ProvisionerJobType `json:"provisioner_job_type"`
	Valid              bool               `json:"valid"` // Valid is true if ProvisionerJobType is not NULL
}

func (*NullProvisionerJobType) Scan

func (ns *NullProvisionerJobType) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullProvisionerJobType) Value

func (ns NullProvisionerJobType) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullProvisionerStorageMethod

type NullProvisionerStorageMethod struct {
	ProvisionerStorageMethod ProvisionerStorageMethod `json:"provisioner_storage_method"`
	Valid                    bool                     `json:"valid"` // Valid is true if ProvisionerStorageMethod is not NULL
}

func (*NullProvisionerStorageMethod) Scan

func (ns *NullProvisionerStorageMethod) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullProvisionerStorageMethod) Value

Value implements the driver Valuer interface.

type NullProvisionerType

type NullProvisionerType struct {
	ProvisionerType ProvisionerType `json:"provisioner_type"`
	Valid           bool            `json:"valid"` // Valid is true if ProvisionerType is not NULL
}

func (*NullProvisionerType) Scan

func (ns *NullProvisionerType) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullProvisionerType) Value

func (ns NullProvisionerType) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullResourceType

type NullResourceType struct {
	ResourceType ResourceType `json:"resource_type"`
	Valid        bool         `json:"valid"` // Valid is true if ResourceType is not NULL
}

func (*NullResourceType) Scan

func (ns *NullResourceType) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullResourceType) Value

func (ns NullResourceType) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullStartupScriptBehavior

type NullStartupScriptBehavior struct {
	StartupScriptBehavior StartupScriptBehavior `json:"startup_script_behavior"`
	Valid                 bool                  `json:"valid"` // Valid is true if StartupScriptBehavior is not NULL
}

func (*NullStartupScriptBehavior) Scan

func (ns *NullStartupScriptBehavior) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullStartupScriptBehavior) Value

Value implements the driver Valuer interface.

type NullTailnetStatus added in v2.4.0

type NullTailnetStatus struct {
	TailnetStatus TailnetStatus `json:"tailnet_status"`
	Valid         bool          `json:"valid"` // Valid is true if TailnetStatus is not NULL
}

func (*NullTailnetStatus) Scan added in v2.4.0

func (ns *NullTailnetStatus) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullTailnetStatus) Value added in v2.4.0

func (ns NullTailnetStatus) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullUserStatus

type NullUserStatus struct {
	UserStatus UserStatus `json:"user_status"`
	Valid      bool       `json:"valid"` // Valid is true if UserStatus is not NULL
}

func (*NullUserStatus) Scan

func (ns *NullUserStatus) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullUserStatus) Value

func (ns NullUserStatus) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullWorkspaceAgentLifecycleState

type NullWorkspaceAgentLifecycleState struct {
	WorkspaceAgentLifecycleState WorkspaceAgentLifecycleState `json:"workspace_agent_lifecycle_state"`
	Valid                        bool                         `json:"valid"` // Valid is true if WorkspaceAgentLifecycleState is not NULL
}

func (*NullWorkspaceAgentLifecycleState) Scan

func (ns *NullWorkspaceAgentLifecycleState) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullWorkspaceAgentLifecycleState) Value

Value implements the driver Valuer interface.

type NullWorkspaceAgentSubsystem

type NullWorkspaceAgentSubsystem struct {
	WorkspaceAgentSubsystem WorkspaceAgentSubsystem `json:"workspace_agent_subsystem"`
	Valid                   bool                    `json:"valid"` // Valid is true if WorkspaceAgentSubsystem is not NULL
}

func (*NullWorkspaceAgentSubsystem) Scan

func (ns *NullWorkspaceAgentSubsystem) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullWorkspaceAgentSubsystem) Value

Value implements the driver Valuer interface.

type NullWorkspaceAppHealth

type NullWorkspaceAppHealth struct {
	WorkspaceAppHealth WorkspaceAppHealth `json:"workspace_app_health"`
	Valid              bool               `json:"valid"` // Valid is true if WorkspaceAppHealth is not NULL
}

func (*NullWorkspaceAppHealth) Scan

func (ns *NullWorkspaceAppHealth) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullWorkspaceAppHealth) Value

func (ns NullWorkspaceAppHealth) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullWorkspaceTransition

type NullWorkspaceTransition struct {
	WorkspaceTransition WorkspaceTransition `json:"workspace_transition"`
	Valid               bool                `json:"valid"` // Valid is true if WorkspaceTransition is not NULL
}

func (*NullWorkspaceTransition) Scan

func (ns *NullWorkspaceTransition) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullWorkspaceTransition) Value

func (ns NullWorkspaceTransition) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type OAuth2ProviderApp added in v2.6.0

type OAuth2ProviderApp 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"`
	Icon        string    `db:"icon" json:"icon"`
	CallbackURL string    `db:"callback_url" json:"callback_url"`
}

A table used to configure apps that can use Coder as an OAuth2 provider, the reverse of what we are calling external authentication.

func (OAuth2ProviderApp) RBACObject added in v2.9.0

func (OAuth2ProviderApp) RBACObject() rbac.Object

type OAuth2ProviderAppCode added in v2.9.0

type OAuth2ProviderAppCode struct {
	ID           uuid.UUID `db:"id" json:"id"`
	CreatedAt    time.Time `db:"created_at" json:"created_at"`
	ExpiresAt    time.Time `db:"expires_at" json:"expires_at"`
	SecretPrefix []byte    `db:"secret_prefix" json:"secret_prefix"`
	HashedSecret []byte    `db:"hashed_secret" json:"hashed_secret"`
	UserID       uuid.UUID `db:"user_id" json:"user_id"`
	AppID        uuid.UUID `db:"app_id" json:"app_id"`
}

Codes are meant to be exchanged for access tokens.

func (OAuth2ProviderAppCode) RBACObject added in v2.9.0

func (c OAuth2ProviderAppCode) RBACObject() rbac.Object

type OAuth2ProviderAppSecret added in v2.6.0

type OAuth2ProviderAppSecret struct {
	ID           uuid.UUID    `db:"id" json:"id"`
	CreatedAt    time.Time    `db:"created_at" json:"created_at"`
	LastUsedAt   sql.NullTime `db:"last_used_at" json:"last_used_at"`
	HashedSecret []byte       `db:"hashed_secret" json:"hashed_secret"`
	// The tail end of the original secret so secrets can be differentiated.
	DisplaySecret string    `db:"display_secret" json:"display_secret"`
	AppID         uuid.UUID `db:"app_id" json:"app_id"`
	SecretPrefix  []byte    `db:"secret_prefix" json:"secret_prefix"`
}

func (OAuth2ProviderAppSecret) RBACObject added in v2.9.0

func (OAuth2ProviderAppSecret) RBACObject() rbac.Object

type OAuth2ProviderAppToken added in v2.9.0

type OAuth2ProviderAppToken struct {
	ID         uuid.UUID `db:"id" json:"id"`
	CreatedAt  time.Time `db:"created_at" json:"created_at"`
	ExpiresAt  time.Time `db:"expires_at" json:"expires_at"`
	HashPrefix []byte    `db:"hash_prefix" json:"hash_prefix"`
	// Refresh tokens provide a way to refresh an access token (API key). An expired API key can be refreshed if this token is not yet expired, meaning this expiry can outlive an API key.
	RefreshHash []byte    `db:"refresh_hash" json:"refresh_hash"`
	AppSecretID uuid.UUID `db:"app_secret_id" json:"app_secret_id"`
	APIKeyID    string    `db:"api_key_id" json:"api_key_id"`
}

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"`
	IsDefault   bool      `db:"is_default" json:"is_default"`
}

func (Organization) RBACObject

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

func (m OrganizationMember) RBACObject() rbac.Object

type ParameterDestinationScheme

type ParameterDestinationScheme string
const (
	ParameterDestinationSchemeNone                ParameterDestinationScheme = "none"
	ParameterDestinationSchemeEnvironmentVariable ParameterDestinationScheme = "environment_variable"
	ParameterDestinationSchemeProvisionerVariable ParameterDestinationScheme = "provisioner_variable"
)

func AllParameterDestinationSchemeValues

func AllParameterDestinationSchemeValues() []ParameterDestinationScheme

func (*ParameterDestinationScheme) Scan

func (e *ParameterDestinationScheme) Scan(src interface{}) error

func (ParameterDestinationScheme) Valid

func (e ParameterDestinationScheme) Valid() bool

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"`
	Index                    int32                      `db:"index" json:"index"`
}

type ParameterScope

type ParameterScope string
const (
	ParameterScopeTemplate  ParameterScope = "template"
	ParameterScopeImportJob ParameterScope = "import_job"
	ParameterScopeWorkspace ParameterScope = "workspace"
)

func AllParameterScopeValues

func AllParameterScopeValues() []ParameterScope

func (*ParameterScope) Scan

func (e *ParameterScope) Scan(src interface{}) error

func (ParameterScope) Valid

func (e ParameterScope) Valid() bool

type ParameterSourceScheme

type ParameterSourceScheme string
const (
	ParameterSourceSchemeNone ParameterSourceScheme = "none"
	ParameterSourceSchemeData ParameterSourceScheme = "data"
)

func AllParameterSourceSchemeValues

func AllParameterSourceSchemeValues() []ParameterSourceScheme

func (*ParameterSourceScheme) Scan

func (e *ParameterSourceScheme) Scan(src interface{}) error

func (ParameterSourceScheme) Valid

func (e ParameterSourceScheme) Valid() bool

type ParameterTypeSystem

type ParameterTypeSystem string
const (
	ParameterTypeSystemNone ParameterTypeSystem = "none"
	ParameterTypeSystemHCL  ParameterTypeSystem = "hcl"
)

func AllParameterTypeSystemValues

func AllParameterTypeSystemValues() []ParameterTypeSystem

func (*ParameterTypeSystem) Scan

func (e *ParameterTypeSystem) Scan(src interface{}) error

func (ParameterTypeSystem) Valid

func (e ParameterTypeSystem) Valid() bool

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 PortShareProtocol added in v2.9.0

type PortShareProtocol string
const (
	PortShareProtocolHttp  PortShareProtocol = "http"
	PortShareProtocolHttps PortShareProtocol = "https"
)

func AllPortShareProtocolValues added in v2.9.0

func AllPortShareProtocolValues() []PortShareProtocol

func (*PortShareProtocol) Scan added in v2.9.0

func (e *PortShareProtocol) Scan(src interface{}) error

func (PortShareProtocol) Valid added in v2.9.0

func (e PortShareProtocol) Valid() bool

type ProvisionerDaemon

type ProvisionerDaemon struct {
	ID           uuid.UUID         `db:"id" json:"id"`
	CreatedAt    time.Time         `db:"created_at" json:"created_at"`
	Name         string            `db:"name" json:"name"`
	Provisioners []ProvisionerType `db:"provisioners" json:"provisioners"`
	ReplicaID    uuid.NullUUID     `db:"replica_id" json:"replica_id"`
	Tags         StringMap         `db:"tags" json:"tags"`
	LastSeenAt   sql.NullTime      `db:"last_seen_at" json:"last_seen_at"`
	Version      string            `db:"version" json:"version"`
	// The API version of the provisioner daemon
	APIVersion     string    `db:"api_version" json:"api_version"`
	OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"`
}

func (ProvisionerDaemon) RBACObject

func (p 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"`
	Type           ProvisionerJobType       `db:"type" json:"type"`
	Input          json.RawMessage          `db:"input" json:"input"`
	WorkerID       uuid.NullUUID            `db:"worker_id" json:"worker_id"`
	FileID         uuid.UUID                `db:"file_id" json:"file_id"`
	Tags           StringMap                `db:"tags" json:"tags"`
	ErrorCode      sql.NullString           `db:"error_code" json:"error_code"`
	TraceMetadata  pqtype.NullRawMessage    `db:"trace_metadata" json:"trace_metadata"`
	// Computed column to track the status of the job.
	JobStatus ProvisionerJobStatus `db:"job_status" json:"job_status"`
}

func (ProvisionerJob) Finished added in v2.3.0

func (p ProvisionerJob) Finished() bool

func (ProvisionerJob) FinishedAt added in v2.3.0

func (p ProvisionerJob) FinishedAt() time.Time

type ProvisionerJobLog

type ProvisionerJobLog struct {
	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"`
	ID        int64     `db:"id" json:"id"`
}

type ProvisionerJobStatus added in v2.3.0

type ProvisionerJobStatus string

Computed status of a provisioner job. Jobs could be stuck in a hung state, these states do not guarantee any transition to another state.

const (
	ProvisionerJobStatusPending   ProvisionerJobStatus = "pending"
	ProvisionerJobStatusRunning   ProvisionerJobStatus = "running"
	ProvisionerJobStatusSucceeded ProvisionerJobStatus = "succeeded"
	ProvisionerJobStatusCanceling ProvisionerJobStatus = "canceling"
	ProvisionerJobStatusCanceled  ProvisionerJobStatus = "canceled"
	ProvisionerJobStatusFailed    ProvisionerJobStatus = "failed"
	ProvisionerJobStatusUnknown   ProvisionerJobStatus = "unknown"
)

func AllProvisionerJobStatusValues added in v2.3.0

func AllProvisionerJobStatusValues() []ProvisionerJobStatus

func (*ProvisionerJobStatus) Scan added in v2.3.0

func (e *ProvisionerJobStatus) Scan(src interface{}) error

func (ProvisionerJobStatus) Valid added in v2.3.0

func (e ProvisionerJobStatus) Valid() bool

type ProvisionerJobType

type ProvisionerJobType string
const (
	ProvisionerJobTypeTemplateVersionImport ProvisionerJobType = "template_version_import"
	ProvisionerJobTypeWorkspaceBuild        ProvisionerJobType = "workspace_build"
	ProvisionerJobTypeTemplateVersionDryRun ProvisionerJobType = "template_version_dry_run"
)

func AllProvisionerJobTypeValues

func AllProvisionerJobTypeValues() []ProvisionerJobType

func (*ProvisionerJobType) Scan

func (e *ProvisionerJobType) Scan(src interface{}) error

func (ProvisionerJobType) Valid

func (e ProvisionerJobType) Valid() bool

type ProvisionerStorageMethod

type ProvisionerStorageMethod string
const (
	ProvisionerStorageMethodFile ProvisionerStorageMethod = "file"
)

func AllProvisionerStorageMethodValues

func AllProvisionerStorageMethodValues() []ProvisionerStorageMethod

func (*ProvisionerStorageMethod) Scan

func (e *ProvisionerStorageMethod) Scan(src interface{}) error

func (ProvisionerStorageMethod) Valid

func (e ProvisionerStorageMethod) Valid() bool

type ProvisionerType

type ProvisionerType string
const (
	ProvisionerTypeEcho      ProvisionerType = "echo"
	ProvisionerTypeTerraform ProvisionerType = "terraform"
)

func AllProvisionerTypeValues

func AllProvisionerTypeValues() []ProvisionerType

func (*ProvisionerType) Scan

func (e *ProvisionerType) Scan(src interface{}) error

func (ProvisionerType) Valid

func (e ProvisionerType) Valid() bool

type RegisterWorkspaceProxyParams

type RegisterWorkspaceProxyParams struct {
	Url              string    `db:"url" json:"url"`
	WildcardHostname string    `db:"wildcard_hostname" json:"wildcard_hostname"`
	DerpEnabled      bool      `db:"derp_enabled" json:"derp_enabled"`
	DerpOnly         bool      `db:"derp_only" json:"derp_only"`
	Version          string    `db:"version" json:"version"`
	ID               uuid.UUID `db:"id" json:"id"`
}

type Replica

type Replica struct {
	ID              uuid.UUID    `db:"id" json:"id"`
	CreatedAt       time.Time    `db:"created_at" json:"created_at"`
	StartedAt       time.Time    `db:"started_at" json:"started_at"`
	StoppedAt       sql.NullTime `db:"stopped_at" json:"stopped_at"`
	UpdatedAt       time.Time    `db:"updated_at" json:"updated_at"`
	Hostname        string       `db:"hostname" json:"hostname"`
	RegionID        int32        `db:"region_id" json:"region_id"`
	RelayAddress    string       `db:"relay_address" json:"relay_address"`
	DatabaseLatency int32        `db:"database_latency" json:"database_latency"`
	Version         string       `db:"version" json:"version"`
	Error           string       `db:"error" json:"error"`
	Primary         bool         `db:"primary" json:"primary"`
}

type ResourceType

type ResourceType string
const (
	ResourceTypeOrganization            ResourceType = "organization"
	ResourceTypeTemplate                ResourceType = "template"
	ResourceTypeTemplateVersion         ResourceType = "template_version"
	ResourceTypeUser                    ResourceType = "user"
	ResourceTypeWorkspace               ResourceType = "workspace"
	ResourceTypeGitSshKey               ResourceType = "git_ssh_key"
	ResourceTypeApiKey                  ResourceType = "api_key"
	ResourceTypeGroup                   ResourceType = "group"
	ResourceTypeWorkspaceBuild          ResourceType = "workspace_build"
	ResourceTypeLicense                 ResourceType = "license"
	ResourceTypeWorkspaceProxy          ResourceType = "workspace_proxy"
	ResourceTypeConvertLogin            ResourceType = "convert_login"
	ResourceTypeHealthSettings          ResourceType = "health_settings"
	ResourceTypeOauth2ProviderApp       ResourceType = "oauth2_provider_app"
	ResourceTypeOauth2ProviderAppSecret ResourceType = "oauth2_provider_app_secret"
)

func AllResourceTypeValues

func AllResourceTypeValues() []ResourceType

func (*ResourceType) Scan

func (e *ResourceType) Scan(src interface{}) error

func (ResourceType) Valid

func (e ResourceType) Valid() bool

type SiteConfig

type SiteConfig struct {
	Key   string `db:"key" json:"key"`
	Value string `db:"value" json:"value"`
}

type StartupScriptBehavior

type StartupScriptBehavior string
const (
	StartupScriptBehaviorBlocking    StartupScriptBehavior = "blocking"
	StartupScriptBehaviorNonBlocking StartupScriptBehavior = "non-blocking"
)

func AllStartupScriptBehaviorValues

func AllStartupScriptBehaviorValues() []StartupScriptBehavior

func (*StartupScriptBehavior) Scan

func (e *StartupScriptBehavior) Scan(src interface{}) error

func (StartupScriptBehavior) Valid

func (e StartupScriptBehavior) Valid() bool

type Store

type Store interface {
	Ping(ctx context.Context) (time.Duration, error)
	InTx(func(Store) error, *sql.TxOptions) error
	// contains filtered or unexported methods
}

Store contains all queryable database functions. It extends the generated interface to add transaction support.

func New

func New(sdb *sql.DB) Store

New creates a new database store using a SQL database connection.

type StringMap

type StringMap map[string]string

func (*StringMap) Scan

func (m *StringMap) Scan(src interface{}) error

func (StringMap) Value

func (m StringMap) Value() (driver.Value, error)

type StringMapOfInt added in v2.10.0

type StringMapOfInt map[string]int64

func (*StringMapOfInt) Scan added in v2.10.0

func (m *StringMapOfInt) Scan(src interface{}) error

func (StringMapOfInt) Value added in v2.10.0

func (m StringMapOfInt) Value() (driver.Value, error)

type TailnetAgent

type TailnetAgent struct {
	ID            uuid.UUID       `db:"id" json:"id"`
	CoordinatorID uuid.UUID       `db:"coordinator_id" json:"coordinator_id"`
	UpdatedAt     time.Time       `db:"updated_at" json:"updated_at"`
	Node          json.RawMessage `db:"node" json:"node"`
}

type TailnetClient

type TailnetClient struct {
	ID            uuid.UUID       `db:"id" json:"id"`
	CoordinatorID uuid.UUID       `db:"coordinator_id" json:"coordinator_id"`
	UpdatedAt     time.Time       `db:"updated_at" json:"updated_at"`
	Node          json.RawMessage `db:"node" json:"node"`
}

type TailnetClientSubscription added in v2.2.0

type TailnetClientSubscription struct {
	ClientID      uuid.UUID `db:"client_id" json:"client_id"`
	CoordinatorID uuid.UUID `db:"coordinator_id" json:"coordinator_id"`
	AgentID       uuid.UUID `db:"agent_id" json:"agent_id"`
	UpdatedAt     time.Time `db:"updated_at" json:"updated_at"`
}

type TailnetCoordinator

type TailnetCoordinator struct {
	ID          uuid.UUID `db:"id" json:"id"`
	HeartbeatAt time.Time `db:"heartbeat_at" json:"heartbeat_at"`
}

We keep this separate from replicas in case we need to break the coordinator out into its own service

type TailnetPeer added in v2.4.0

type TailnetPeer struct {
	ID            uuid.UUID     `db:"id" json:"id"`
	CoordinatorID uuid.UUID     `db:"coordinator_id" json:"coordinator_id"`
	UpdatedAt     time.Time     `db:"updated_at" json:"updated_at"`
	Node          []byte        `db:"node" json:"node"`
	Status        TailnetStatus `db:"status" json:"status"`
}

type TailnetStatus added in v2.4.0

type TailnetStatus string
const (
	TailnetStatusOk   TailnetStatus = "ok"
	TailnetStatusLost TailnetStatus = "lost"
)

func AllTailnetStatusValues added in v2.4.0

func AllTailnetStatusValues() []TailnetStatus

func (*TailnetStatus) Scan added in v2.4.0

func (e *TailnetStatus) Scan(src interface{}) error

func (TailnetStatus) Valid added in v2.4.0

func (e TailnetStatus) Valid() bool

type TailnetTunnel added in v2.4.0

type TailnetTunnel struct {
	CoordinatorID uuid.UUID `db:"coordinator_id" json:"coordinator_id"`
	SrcID         uuid.UUID `db:"src_id" json:"src_id"`
	DstID         uuid.UUID `db:"dst_id" json:"dst_id"`
	UpdatedAt     time.Time `db:"updated_at" json:"updated_at"`
}

type Template

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"`
	DefaultTTL                    int64           `db:"default_ttl" json:"default_ttl"`
	CreatedBy                     uuid.UUID       `db:"created_by" json:"created_by"`
	Icon                          string          `db:"icon" json:"icon"`
	UserACL                       TemplateACL     `db:"user_acl" json:"user_acl"`
	GroupACL                      TemplateACL     `db:"group_acl" json:"group_acl"`
	DisplayName                   string          `db:"display_name" json:"display_name"`
	AllowUserCancelWorkspaceJobs  bool            `db:"allow_user_cancel_workspace_jobs" json:"allow_user_cancel_workspace_jobs"`
	AllowUserAutostart            bool            `db:"allow_user_autostart" json:"allow_user_autostart"`
	AllowUserAutostop             bool            `db:"allow_user_autostop" json:"allow_user_autostop"`
	FailureTTL                    int64           `db:"failure_ttl" json:"failure_ttl"`
	TimeTilDormant                int64           `db:"time_til_dormant" json:"time_til_dormant"`
	TimeTilDormantAutoDelete      int64           `db:"time_til_dormant_autodelete" json:"time_til_dormant_autodelete"`
	AutostopRequirementDaysOfWeek int16           `db:"autostop_requirement_days_of_week" json:"autostop_requirement_days_of_week"`
	AutostopRequirementWeeks      int64           `db:"autostop_requirement_weeks" json:"autostop_requirement_weeks"`
	AutostartBlockDaysOfWeek      int16           `db:"autostart_block_days_of_week" json:"autostart_block_days_of_week"`
	RequireActiveVersion          bool            `db:"require_active_version" json:"require_active_version"`
	Deprecated                    string          `db:"deprecated" json:"deprecated"`
	ActivityBump                  int64           `db:"activity_bump" json:"activity_bump"`
	MaxPortSharingLevel           AppSharingLevel `db:"max_port_sharing_level" json:"max_port_sharing_level"`
	CreatedByAvatarURL            string          `db:"created_by_avatar_url" json:"created_by_avatar_url"`
	CreatedByUsername             string          `db:"created_by_username" json:"created_by_username"`
}

Joins in the username + avatar url of the created by user.

func (Template) AutostartAllowedDays added in v2.3.1

func (t Template) AutostartAllowedDays() uint8

AutostartAllowedDays returns the inverse of 'AutostartBlockDaysOfWeek'. It is more useful to have the days that are allowed to autostart from a UX POV. The database prefers the 0 value being 'all days allowed'.

func (Template) DeepCopy

func (t Template) DeepCopy() Template

func (Template) RBACObject

func (t Template) RBACObject() rbac.Object

type TemplateACL

type TemplateACL map[string][]rbac.Action

TemplateACL is a map of ids to permissions.

func (*TemplateACL) Scan

func (t *TemplateACL) Scan(src interface{}) error

func (TemplateACL) Value

func (t TemplateACL) Value() (driver.Value, error)

type TemplateGroup

type TemplateGroup struct {
	Group
	Actions Actions `db:"actions"`
}

type TemplateTable

type TemplateTable 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"`
	// The default duration for autostop for workspaces created from this template.
	DefaultTTL int64       `db:"default_ttl" json:"default_ttl"`
	CreatedBy  uuid.UUID   `db:"created_by" json:"created_by"`
	Icon       string      `db:"icon" json:"icon"`
	UserACL    TemplateACL `db:"user_acl" json:"user_acl"`
	GroupACL   TemplateACL `db:"group_acl" json:"group_acl"`
	// Display name is a custom, human-friendly template name that user can set.
	DisplayName string `db:"display_name" json:"display_name"`
	// Allow users to cancel in-progress workspace jobs.
	AllowUserCancelWorkspaceJobs bool `db:"allow_user_cancel_workspace_jobs" json:"allow_user_cancel_workspace_jobs"`
	// Allow users to specify an autostart schedule for workspaces (enterprise).
	AllowUserAutostart bool `db:"allow_user_autostart" json:"allow_user_autostart"`
	// Allow users to specify custom autostop values for workspaces (enterprise).
	AllowUserAutostop        bool  `db:"allow_user_autostop" json:"allow_user_autostop"`
	FailureTTL               int64 `db:"failure_ttl" json:"failure_ttl"`
	TimeTilDormant           int64 `db:"time_til_dormant" json:"time_til_dormant"`
	TimeTilDormantAutoDelete int64 `db:"time_til_dormant_autodelete" json:"time_til_dormant_autodelete"`
	// A bitmap of days of week to restart the workspace on, starting with Monday as the 0th bit, and Sunday as the 6th bit. The 7th bit is unused.
	AutostopRequirementDaysOfWeek int16 `db:"autostop_requirement_days_of_week" json:"autostop_requirement_days_of_week"`
	// The number of weeks between restarts. 0 or 1 weeks means "every week", 2 week means "every second week", etc. Weeks are counted from January 2, 2023, which is the first Monday of 2023. This is to ensure workspaces are started consistently for all customers on the same n-week cycles.
	AutostopRequirementWeeks int64 `db:"autostop_requirement_weeks" json:"autostop_requirement_weeks"`
	// A bitmap of days of week that autostart of a workspace is not allowed. Default allows all days. This is intended as a cost savings measure to prevent auto start on weekends (for example).
	AutostartBlockDaysOfWeek int16 `db:"autostart_block_days_of_week" json:"autostart_block_days_of_week"`
	RequireActiveVersion     bool  `db:"require_active_version" json:"require_active_version"`
	// If set to a non empty string, the template will no longer be able to be used. The message will be displayed to the user.
	Deprecated          string          `db:"deprecated" json:"deprecated"`
	ActivityBump        int64           `db:"activity_bump" json:"activity_bump"`
	MaxPortSharingLevel AppSharingLevel `db:"max_port_sharing_level" json:"max_port_sharing_level"`
}

type TemplateUsageStat added in v2.10.0

type TemplateUsageStat struct {
	// Start time of the usage period.
	StartTime time.Time `db:"start_time" json:"start_time"`
	// End time of the usage period.
	EndTime time.Time `db:"end_time" json:"end_time"`
	// ID of the template being used.
	TemplateID uuid.UUID `db:"template_id" json:"template_id"`
	// ID of the user using the template.
	UserID uuid.UUID `db:"user_id" json:"user_id"`
	// Median latency the user is experiencing, in milliseconds. Null means no value was recorded.
	MedianLatencyMs sql.NullFloat64 `db:"median_latency_ms" json:"median_latency_ms"`
	// Total minutes the user has been using the template.
	UsageMins int16 `db:"usage_mins" json:"usage_mins"`
	// Total minutes the user has been using SSH.
	SshMins int16 `db:"ssh_mins" json:"ssh_mins"`
	// Total minutes the user has been using SFTP.
	SftpMins int16 `db:"sftp_mins" json:"sftp_mins"`
	// Total minutes the user has been using the reconnecting PTY.
	ReconnectingPtyMins int16 `db:"reconnecting_pty_mins" json:"reconnecting_pty_mins"`
	// Total minutes the user has been using VSCode.
	VscodeMins int16 `db:"vscode_mins" json:"vscode_mins"`
	// Total minutes the user has been using JetBrains.
	JetbrainsMins int16 `db:"jetbrains_mins" json:"jetbrains_mins"`
	// Object with app names as keys and total minutes used as values. Null means no app usage was recorded.
	AppUsageMins StringMapOfInt `db:"app_usage_mins" json:"app_usage_mins"`
}

Records aggregated usage statistics for templates/users. All usage is rounded up to the nearest minute.

type TemplateUser

type TemplateUser struct {
	User
	Actions Actions `db:"actions"`
}

type TemplateVersion

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"`
	CreatedBy             uuid.UUID       `db:"created_by" json:"created_by"`
	ExternalAuthProviders json.RawMessage `db:"external_auth_providers" json:"external_auth_providers"`
	Message               string          `db:"message" json:"message"`
	Archived              bool            `db:"archived" json:"archived"`
	CreatedByAvatarURL    string          `db:"created_by_avatar_url" json:"created_by_avatar_url"`
	CreatedByUsername     string          `db:"created_by_username" json:"created_by_username"`
}

Joins in the username + avatar url of the created by user.

func (TemplateVersion) RBACObject

func (TemplateVersion) RBACObject(template Template) rbac.Object

func (TemplateVersion) RBACObjectNoTemplate

func (v TemplateVersion) RBACObjectNoTemplate() rbac.Object

RBACObjectNoTemplate is for orphaned template versions.

type TemplateVersionParameter

type TemplateVersionParameter struct {
	TemplateVersionID uuid.UUID `db:"template_version_id" json:"template_version_id"`
	// Parameter name
	Name string `db:"name" json:"name"`
	// Parameter description
	Description string `db:"description" json:"description"`
	// Parameter type
	Type string `db:"type" json:"type"`
	// Is parameter mutable?
	Mutable bool `db:"mutable" json:"mutable"`
	// Default value
	DefaultValue string `db:"default_value" json:"default_value"`
	// Icon
	Icon string `db:"icon" json:"icon"`
	// Additional options
	Options json.RawMessage `db:"options" json:"options"`
	// Validation: regex pattern
	ValidationRegex string `db:"validation_regex" json:"validation_regex"`
	// Validation: minimum length of value
	ValidationMin sql.NullInt32 `db:"validation_min" json:"validation_min"`
	// Validation: maximum length of value
	ValidationMax sql.NullInt32 `db:"validation_max" json:"validation_max"`
	// Validation: error displayed when the regex does not match.
	ValidationError string `db:"validation_error" json:"validation_error"`
	// Validation: consecutive values preserve the monotonic order
	ValidationMonotonic string `db:"validation_monotonic" json:"validation_monotonic"`
	// Is parameter required?
	Required bool `db:"required" json:"required"`
	// Display name of the rich parameter
	DisplayName string `db:"display_name" json:"display_name"`
	// Specifies the order in which to display parameters in user interfaces.
	DisplayOrder int32 `db:"display_order" json:"display_order"`
	// The value of an ephemeral parameter will not be preserved between consecutive workspace builds.
	Ephemeral bool `db:"ephemeral" json:"ephemeral"`
}

type TemplateVersionTable

type TemplateVersionTable 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"`
	CreatedBy      uuid.UUID     `db:"created_by" json:"created_by"`
	// IDs of External auth providers for a specific template version
	ExternalAuthProviders json.RawMessage `db:"external_auth_providers" json:"external_auth_providers"`
	// Message describing the changes in this version of the template, similar to a Git commit message. Like a commit message, this should be a short, high-level description of the changes in this version of the template. This message is immutable and should not be updated after the fact.
	Message  string `db:"message" json:"message"`
	Archived bool   `db:"archived" json:"archived"`
}

type TemplateVersionVariable

type TemplateVersionVariable struct {
	TemplateVersionID uuid.UUID `db:"template_version_id" json:"template_version_id"`
	// Variable name
	Name string `db:"name" json:"name"`
	// Variable description
	Description string `db:"description" json:"description"`
	// Variable type
	Type string `db:"type" json:"type"`
	// Variable value
	Value string `db:"value" json:"value"`
	// Variable default value
	DefaultValue string `db:"default_value" json:"default_value"`
	// Required variables needs a default value or a value provided by template admin
	Required bool `db:"required" json:"required"`
	// Sensitive variables have their values redacted in logs or site UI
	Sensitive bool `db:"sensitive" json:"sensitive"`
}

type UnarchiveTemplateVersionParams added in v2.3.0

type UnarchiveTemplateVersionParams struct {
	UpdatedAt         time.Time `db:"updated_at" json:"updated_at"`
	TemplateVersionID uuid.UUID `db:"template_version_id" json:"template_version_id"`
}

type UniqueConstraint

type UniqueConstraint string

UniqueConstraint represents a named unique constraint on a table.

const (
	UniqueAgentStatsPkey                                    UniqueConstraint = "agent_stats_pkey"                                         // ALTER TABLE ONLY workspace_agent_stats ADD CONSTRAINT agent_stats_pkey PRIMARY KEY (id);
	UniqueAPIKeysPkey                                       UniqueConstraint = "api_keys_pkey"                                            // ALTER TABLE ONLY api_keys ADD CONSTRAINT api_keys_pkey PRIMARY KEY (id);
	UniqueAuditLogsPkey                                     UniqueConstraint = "audit_logs_pkey"                                          // ALTER TABLE ONLY audit_logs ADD CONSTRAINT audit_logs_pkey PRIMARY KEY (id);
	UniqueDbcryptKeysActiveKeyDigestKey                     UniqueConstraint = "dbcrypt_keys_active_key_digest_key"                       // ALTER TABLE ONLY dbcrypt_keys ADD CONSTRAINT dbcrypt_keys_active_key_digest_key UNIQUE (active_key_digest);
	UniqueDbcryptKeysPkey                                   UniqueConstraint = "dbcrypt_keys_pkey"                                        // ALTER TABLE ONLY dbcrypt_keys ADD CONSTRAINT dbcrypt_keys_pkey PRIMARY KEY (number);
	UniqueDbcryptKeysRevokedKeyDigestKey                    UniqueConstraint = "dbcrypt_keys_revoked_key_digest_key"                      // ALTER TABLE ONLY dbcrypt_keys ADD CONSTRAINT dbcrypt_keys_revoked_key_digest_key UNIQUE (revoked_key_digest);
	UniqueFilesHashCreatedByKey                             UniqueConstraint = "files_hash_created_by_key"                                // ALTER TABLE ONLY files ADD CONSTRAINT files_hash_created_by_key UNIQUE (hash, created_by);
	UniqueFilesPkey                                         UniqueConstraint = "files_pkey"                                               // ALTER TABLE ONLY files ADD CONSTRAINT files_pkey PRIMARY KEY (id);
	UniqueGitAuthLinksProviderIDUserIDKey                   UniqueConstraint = "git_auth_links_provider_id_user_id_key"                   // ALTER TABLE ONLY external_auth_links ADD CONSTRAINT git_auth_links_provider_id_user_id_key UNIQUE (provider_id, user_id);
	UniqueGitSSHKeysPkey                                    UniqueConstraint = "gitsshkeys_pkey"                                          // ALTER TABLE ONLY gitsshkeys ADD CONSTRAINT gitsshkeys_pkey PRIMARY KEY (user_id);
	UniqueGroupMembersUserIDGroupIDKey                      UniqueConstraint = "group_members_user_id_group_id_key"                       // ALTER TABLE ONLY group_members ADD CONSTRAINT group_members_user_id_group_id_key UNIQUE (user_id, group_id);
	UniqueGroupsNameOrganizationIDKey                       UniqueConstraint = "groups_name_organization_id_key"                          // ALTER TABLE ONLY groups ADD CONSTRAINT groups_name_organization_id_key UNIQUE (name, organization_id);
	UniqueGroupsPkey                                        UniqueConstraint = "groups_pkey"                                              // ALTER TABLE ONLY groups ADD CONSTRAINT groups_pkey PRIMARY KEY (id);
	UniqueJfrogXrayScansPkey                                UniqueConstraint = "jfrog_xray_scans_pkey"                                    // ALTER TABLE ONLY jfrog_xray_scans ADD CONSTRAINT jfrog_xray_scans_pkey PRIMARY KEY (agent_id, workspace_id);
	UniqueLicensesJWTKey                                    UniqueConstraint = "licenses_jwt_key"                                         // ALTER TABLE ONLY licenses ADD CONSTRAINT licenses_jwt_key UNIQUE (jwt);
	UniqueLicensesPkey                                      UniqueConstraint = "licenses_pkey"                                            // ALTER TABLE ONLY licenses ADD CONSTRAINT licenses_pkey PRIMARY KEY (id);
	UniqueOauth2ProviderAppCodesPkey                        UniqueConstraint = "oauth2_provider_app_codes_pkey"                           // ALTER TABLE ONLY oauth2_provider_app_codes ADD CONSTRAINT oauth2_provider_app_codes_pkey PRIMARY KEY (id);
	UniqueOauth2ProviderAppCodesSecretPrefixKey             UniqueConstraint = "oauth2_provider_app_codes_secret_prefix_key"              // ALTER TABLE ONLY oauth2_provider_app_codes ADD CONSTRAINT oauth2_provider_app_codes_secret_prefix_key UNIQUE (secret_prefix);
	UniqueOauth2ProviderAppSecretsPkey                      UniqueConstraint = "oauth2_provider_app_secrets_pkey"                         // ALTER TABLE ONLY oauth2_provider_app_secrets ADD CONSTRAINT oauth2_provider_app_secrets_pkey PRIMARY KEY (id);
	UniqueOauth2ProviderAppSecretsSecretPrefixKey           UniqueConstraint = "oauth2_provider_app_secrets_secret_prefix_key"            // ALTER TABLE ONLY oauth2_provider_app_secrets ADD CONSTRAINT oauth2_provider_app_secrets_secret_prefix_key UNIQUE (secret_prefix);
	UniqueOauth2ProviderAppTokensHashPrefixKey              UniqueConstraint = "oauth2_provider_app_tokens_hash_prefix_key"               // ALTER TABLE ONLY oauth2_provider_app_tokens ADD CONSTRAINT oauth2_provider_app_tokens_hash_prefix_key UNIQUE (hash_prefix);
	UniqueOauth2ProviderAppTokensPkey                       UniqueConstraint = "oauth2_provider_app_tokens_pkey"                          // ALTER TABLE ONLY oauth2_provider_app_tokens ADD CONSTRAINT oauth2_provider_app_tokens_pkey PRIMARY KEY (id);
	UniqueOauth2ProviderAppsNameKey                         UniqueConstraint = "oauth2_provider_apps_name_key"                            // ALTER TABLE ONLY oauth2_provider_apps ADD CONSTRAINT oauth2_provider_apps_name_key UNIQUE (name);
	UniqueOauth2ProviderAppsPkey                            UniqueConstraint = "oauth2_provider_apps_pkey"                                // ALTER TABLE ONLY oauth2_provider_apps ADD CONSTRAINT oauth2_provider_apps_pkey PRIMARY KEY (id);
	UniqueOrganizationMembersPkey                           UniqueConstraint = "organization_members_pkey"                                // ALTER TABLE ONLY organization_members ADD CONSTRAINT organization_members_pkey PRIMARY KEY (organization_id, user_id);
	UniqueOrganizationsPkey                                 UniqueConstraint = "organizations_pkey"                                       // ALTER TABLE ONLY organizations ADD CONSTRAINT organizations_pkey PRIMARY KEY (id);
	UniqueParameterSchemasJobIDNameKey                      UniqueConstraint = "parameter_schemas_job_id_name_key"                        // ALTER TABLE ONLY parameter_schemas ADD CONSTRAINT parameter_schemas_job_id_name_key UNIQUE (job_id, name);
	UniqueParameterSchemasPkey                              UniqueConstraint = "parameter_schemas_pkey"                                   // ALTER TABLE ONLY parameter_schemas ADD CONSTRAINT parameter_schemas_pkey PRIMARY KEY (id);
	UniqueParameterValuesPkey                               UniqueConstraint = "parameter_values_pkey"                                    // ALTER TABLE ONLY parameter_values ADD CONSTRAINT parameter_values_pkey PRIMARY KEY (id);
	UniqueParameterValuesScopeIDNameKey                     UniqueConstraint = "parameter_values_scope_id_name_key"                       // ALTER TABLE ONLY parameter_values ADD CONSTRAINT parameter_values_scope_id_name_key UNIQUE (scope_id, name);
	UniqueProvisionerDaemonsPkey                            UniqueConstraint = "provisioner_daemons_pkey"                                 // ALTER TABLE ONLY provisioner_daemons ADD CONSTRAINT provisioner_daemons_pkey PRIMARY KEY (id);
	UniqueProvisionerJobLogsPkey                            UniqueConstraint = "provisioner_job_logs_pkey"                                // ALTER TABLE ONLY provisioner_job_logs ADD CONSTRAINT provisioner_job_logs_pkey PRIMARY KEY (id);
	UniqueProvisionerJobsPkey                               UniqueConstraint = "provisioner_jobs_pkey"                                    // ALTER TABLE ONLY provisioner_jobs ADD CONSTRAINT provisioner_jobs_pkey PRIMARY KEY (id);
	UniqueSiteConfigsKeyKey                                 UniqueConstraint = "site_configs_key_key"                                     // ALTER TABLE ONLY site_configs ADD CONSTRAINT site_configs_key_key UNIQUE (key);
	UniqueTailnetAgentsPkey                                 UniqueConstraint = "tailnet_agents_pkey"                                      // ALTER TABLE ONLY tailnet_agents ADD CONSTRAINT tailnet_agents_pkey PRIMARY KEY (id, coordinator_id);
	UniqueTailnetClientSubscriptionsPkey                    UniqueConstraint = "tailnet_client_subscriptions_pkey"                        // ALTER TABLE ONLY tailnet_client_subscriptions ADD CONSTRAINT tailnet_client_subscriptions_pkey PRIMARY KEY (client_id, coordinator_id, agent_id);
	UniqueTailnetClientsPkey                                UniqueConstraint = "tailnet_clients_pkey"                                     // ALTER TABLE ONLY tailnet_clients ADD CONSTRAINT tailnet_clients_pkey PRIMARY KEY (id, coordinator_id);
	UniqueTailnetCoordinatorsPkey                           UniqueConstraint = "tailnet_coordinators_pkey"                                // ALTER TABLE ONLY tailnet_coordinators ADD CONSTRAINT tailnet_coordinators_pkey PRIMARY KEY (id);
	UniqueTailnetPeersPkey                                  UniqueConstraint = "tailnet_peers_pkey"                                       // ALTER TABLE ONLY tailnet_peers ADD CONSTRAINT tailnet_peers_pkey PRIMARY KEY (id, coordinator_id);
	UniqueTailnetTunnelsPkey                                UniqueConstraint = "tailnet_tunnels_pkey"                                     // ALTER TABLE ONLY tailnet_tunnels ADD CONSTRAINT tailnet_tunnels_pkey PRIMARY KEY (coordinator_id, src_id, dst_id);
	UniqueTemplateUsageStatsPkey                            UniqueConstraint = "template_usage_stats_pkey"                                // ALTER TABLE ONLY template_usage_stats ADD CONSTRAINT template_usage_stats_pkey PRIMARY KEY (start_time, template_id, user_id);
	UniqueTemplateVersionParametersTemplateVersionIDNameKey UniqueConstraint = "template_version_parameters_template_version_id_name_key" // ALTER TABLE ONLY template_version_parameters ADD CONSTRAINT template_version_parameters_template_version_id_name_key UNIQUE (template_version_id, name);
	UniqueTemplateVersionVariablesTemplateVersionIDNameKey  UniqueConstraint = "template_version_variables_template_version_id_name_key"  // ALTER TABLE ONLY template_version_variables ADD CONSTRAINT template_version_variables_template_version_id_name_key UNIQUE (template_version_id, name);
	UniqueTemplateVersionsPkey                              UniqueConstraint = "template_versions_pkey"                                   // ALTER TABLE ONLY template_versions ADD CONSTRAINT template_versions_pkey PRIMARY KEY (id);
	UniqueTemplateVersionsTemplateIDNameKey                 UniqueConstraint = "template_versions_template_id_name_key"                   // ALTER TABLE ONLY template_versions ADD CONSTRAINT template_versions_template_id_name_key UNIQUE (template_id, name);
	UniqueTemplatesPkey                                     UniqueConstraint = "templates_pkey"                                           // ALTER TABLE ONLY templates ADD CONSTRAINT templates_pkey PRIMARY KEY (id);
	UniqueUserLinksPkey                                     UniqueConstraint = "user_links_pkey"                                          // ALTER TABLE ONLY user_links ADD CONSTRAINT user_links_pkey PRIMARY KEY (user_id, login_type);
	UniqueUsersPkey                                         UniqueConstraint = "users_pkey"                                               // ALTER TABLE ONLY users ADD CONSTRAINT users_pkey PRIMARY KEY (id);
	UniqueWorkspaceAgentLogSourcesPkey                      UniqueConstraint = "workspace_agent_log_sources_pkey"                         // ALTER TABLE ONLY workspace_agent_log_sources ADD CONSTRAINT workspace_agent_log_sources_pkey PRIMARY KEY (workspace_agent_id, id);
	UniqueWorkspaceAgentMetadataPkey                        UniqueConstraint = "workspace_agent_metadata_pkey"                            // ALTER TABLE ONLY workspace_agent_metadata ADD CONSTRAINT workspace_agent_metadata_pkey PRIMARY KEY (workspace_agent_id, key);
	UniqueWorkspaceAgentPortSharePkey                       UniqueConstraint = "workspace_agent_port_share_pkey"                          // ALTER TABLE ONLY workspace_agent_port_share ADD CONSTRAINT workspace_agent_port_share_pkey PRIMARY KEY (workspace_id, agent_name, port);
	UniqueWorkspaceAgentStartupLogsPkey                     UniqueConstraint = "workspace_agent_startup_logs_pkey"                        // ALTER TABLE ONLY workspace_agent_logs ADD CONSTRAINT workspace_agent_startup_logs_pkey PRIMARY KEY (id);
	UniqueWorkspaceAgentsPkey                               UniqueConstraint = "workspace_agents_pkey"                                    // ALTER TABLE ONLY workspace_agents ADD CONSTRAINT workspace_agents_pkey PRIMARY KEY (id);
	UniqueWorkspaceAppStatsPkey                             UniqueConstraint = "workspace_app_stats_pkey"                                 // ALTER TABLE ONLY workspace_app_stats ADD CONSTRAINT workspace_app_stats_pkey PRIMARY KEY (id);
	UniqueWorkspaceAppStatsUserIDAgentIDSessionIDKey        UniqueConstraint = "workspace_app_stats_user_id_agent_id_session_id_key"      // ALTER TABLE ONLY workspace_app_stats ADD CONSTRAINT workspace_app_stats_user_id_agent_id_session_id_key UNIQUE (user_id, agent_id, session_id);
	UniqueWorkspaceAppsAgentIDSlugIndex                     UniqueConstraint = "workspace_apps_agent_id_slug_idx"                         // ALTER TABLE ONLY workspace_apps ADD CONSTRAINT workspace_apps_agent_id_slug_idx UNIQUE (agent_id, slug);
	UniqueWorkspaceAppsPkey                                 UniqueConstraint = "workspace_apps_pkey"                                      // ALTER TABLE ONLY workspace_apps ADD CONSTRAINT workspace_apps_pkey PRIMARY KEY (id);
	UniqueWorkspaceBuildParametersWorkspaceBuildIDNameKey   UniqueConstraint = "workspace_build_parameters_workspace_build_id_name_key"   // ALTER TABLE ONLY workspace_build_parameters ADD CONSTRAINT workspace_build_parameters_workspace_build_id_name_key UNIQUE (workspace_build_id, name);
	UniqueWorkspaceBuildsJobIDKey                           UniqueConstraint = "workspace_builds_job_id_key"                              // ALTER TABLE ONLY workspace_builds ADD CONSTRAINT workspace_builds_job_id_key UNIQUE (job_id);
	UniqueWorkspaceBuildsPkey                               UniqueConstraint = "workspace_builds_pkey"                                    // ALTER TABLE ONLY workspace_builds ADD CONSTRAINT workspace_builds_pkey PRIMARY KEY (id);
	UniqueWorkspaceBuildsWorkspaceIDBuildNumberKey          UniqueConstraint = "workspace_builds_workspace_id_build_number_key"           // ALTER TABLE ONLY workspace_builds ADD CONSTRAINT workspace_builds_workspace_id_build_number_key UNIQUE (workspace_id, build_number);
	UniqueWorkspaceProxiesPkey                              UniqueConstraint = "workspace_proxies_pkey"                                   // ALTER TABLE ONLY workspace_proxies ADD CONSTRAINT workspace_proxies_pkey PRIMARY KEY (id);
	UniqueWorkspaceProxiesRegionIDUnique                    UniqueConstraint = "workspace_proxies_region_id_unique"                       // ALTER TABLE ONLY workspace_proxies ADD CONSTRAINT workspace_proxies_region_id_unique UNIQUE (region_id);
	UniqueWorkspaceResourceMetadataName                     UniqueConstraint = "workspace_resource_metadata_name"                         // ALTER TABLE ONLY workspace_resource_metadata ADD CONSTRAINT workspace_resource_metadata_name UNIQUE (workspace_resource_id, key);
	UniqueWorkspaceResourceMetadataPkey                     UniqueConstraint = "workspace_resource_metadata_pkey"                         // ALTER TABLE ONLY workspace_resource_metadata ADD CONSTRAINT workspace_resource_metadata_pkey PRIMARY KEY (id);
	UniqueWorkspaceResourcesPkey                            UniqueConstraint = "workspace_resources_pkey"                                 // ALTER TABLE ONLY workspace_resources ADD CONSTRAINT workspace_resources_pkey PRIMARY KEY (id);
	UniqueWorkspacesPkey                                    UniqueConstraint = "workspaces_pkey"                                          // ALTER TABLE ONLY workspaces ADD CONSTRAINT workspaces_pkey PRIMARY KEY (id);
	UniqueIndexAPIKeyName                                   UniqueConstraint = "idx_api_key_name"                                         // CREATE UNIQUE INDEX idx_api_key_name ON api_keys USING btree (user_id, token_name) WHERE (login_type = 'token'::login_type);
	UniqueIndexOrganizationName                             UniqueConstraint = "idx_organization_name"                                    // CREATE UNIQUE INDEX idx_organization_name ON organizations USING btree (name);
	UniqueIndexOrganizationNameLower                        UniqueConstraint = "idx_organization_name_lower"                              // CREATE UNIQUE INDEX idx_organization_name_lower ON organizations USING btree (lower(name));
	UniqueIndexProvisionerDaemonsNameOwnerKey               UniqueConstraint = "idx_provisioner_daemons_name_owner_key"                   // CREATE UNIQUE INDEX idx_provisioner_daemons_name_owner_key ON provisioner_daemons USING btree (name, lower(COALESCE((tags ->> 'owner'::text), ”::text)));
	UniqueIndexUsersEmail                                   UniqueConstraint = "idx_users_email"                                          // CREATE UNIQUE INDEX idx_users_email ON users USING btree (email) WHERE (deleted = false);
	UniqueIndexUsersUsername                                UniqueConstraint = "idx_users_username"                                       // CREATE UNIQUE INDEX idx_users_username ON users USING btree (username) WHERE (deleted = false);
	UniqueOrganizationsSingleDefaultOrg                     UniqueConstraint = "organizations_single_default_org"                         // CREATE UNIQUE INDEX organizations_single_default_org ON organizations USING btree (is_default) WHERE (is_default = true);
	UniqueTemplateUsageStatsStartTimeTemplateIDUserIDIndex  UniqueConstraint = "template_usage_stats_start_time_template_id_user_id_idx"  // CREATE UNIQUE INDEX template_usage_stats_start_time_template_id_user_id_idx ON template_usage_stats USING btree (start_time, template_id, user_id);
	UniqueTemplatesOrganizationIDNameIndex                  UniqueConstraint = "templates_organization_id_name_idx"                       // CREATE UNIQUE INDEX templates_organization_id_name_idx ON templates USING btree (organization_id, lower((name)::text)) WHERE (deleted = false);
	UniqueUserLinksLinkedIDLoginTypeIndex                   UniqueConstraint = "user_links_linked_id_login_type_idx"                      // CREATE UNIQUE INDEX user_links_linked_id_login_type_idx ON user_links USING btree (linked_id, login_type) WHERE (linked_id <> ”::text);
	UniqueUsersEmailLowerIndex                              UniqueConstraint = "users_email_lower_idx"                                    // CREATE UNIQUE INDEX users_email_lower_idx ON users USING btree (lower(email)) WHERE (deleted = false);
	UniqueUsersUsernameLowerIndex                           UniqueConstraint = "users_username_lower_idx"                                 // CREATE UNIQUE INDEX users_username_lower_idx ON users USING btree (lower(username)) WHERE (deleted = false);
	UniqueWorkspaceProxiesLowerNameIndex                    UniqueConstraint = "workspace_proxies_lower_name_idx"                         // CREATE UNIQUE INDEX workspace_proxies_lower_name_idx ON workspace_proxies USING btree (lower(name)) WHERE (deleted = false);
	UniqueWorkspacesOwnerIDLowerIndex                       UniqueConstraint = "workspaces_owner_id_lower_idx"                            // CREATE UNIQUE INDEX workspaces_owner_id_lower_idx ON workspaces USING btree (owner_id, lower((name)::text)) WHERE (deleted = false);
)

UniqueConstraint enums.

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"`
	IPAddress pqtype.Inet `db:"ip_address" json:"ip_address"`
}

type UpdateExternalAuthLinkParams added in v2.2.1

type UpdateExternalAuthLinkParams struct {
	ProviderID             string                `db:"provider_id" json:"provider_id"`
	UserID                 uuid.UUID             `db:"user_id" json:"user_id"`
	UpdatedAt              time.Time             `db:"updated_at" json:"updated_at"`
	OAuthAccessToken       string                `db:"oauth_access_token" json:"oauth_access_token"`
	OAuthAccessTokenKeyID  sql.NullString        `db:"oauth_access_token_key_id" json:"oauth_access_token_key_id"`
	OAuthRefreshToken      string                `db:"oauth_refresh_token" json:"oauth_refresh_token"`
	OAuthRefreshTokenKeyID sql.NullString        `db:"oauth_refresh_token_key_id" json:"oauth_refresh_token_key_id"`
	OAuthExpiry            time.Time             `db:"oauth_expiry" json:"oauth_expiry"`
	OAuthExtra             pqtype.NullRawMessage `db:"oauth_extra" json:"oauth_extra"`
}

type UpdateGitSSHKeyParams

type UpdateGitSSHKeyParams struct {
	UserID     uuid.UUID `db:"user_id" json:"user_id"`
	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 UpdateGroupByIDParams

type UpdateGroupByIDParams struct {
	Name           string    `db:"name" json:"name"`
	DisplayName    string    `db:"display_name" json:"display_name"`
	AvatarURL      string    `db:"avatar_url" json:"avatar_url"`
	QuotaAllowance int32     `db:"quota_allowance" json:"quota_allowance"`
	ID             uuid.UUID `db:"id" json:"id"`
}

type UpdateInactiveUsersToDormantParams

type UpdateInactiveUsersToDormantParams struct {
	UpdatedAt     time.Time `db:"updated_at" json:"updated_at"`
	LastSeenAfter time.Time `db:"last_seen_after" json:"last_seen_after"`
}

type UpdateInactiveUsersToDormantRow

type UpdateInactiveUsersToDormantRow struct {
	ID         uuid.UUID `db:"id" json:"id"`
	Email      string    `db:"email" json:"email"`
	LastSeenAt time.Time `db:"last_seen_at" json:"last_seen_at"`
}

type UpdateMemberRolesParams

type UpdateMemberRolesParams struct {
	GrantedRoles []string  `db:"granted_roles" json:"granted_roles"`
	UserID       uuid.UUID `db:"user_id" json:"user_id"`
	OrgID        uuid.UUID `db:"org_id" json:"org_id"`
}

type UpdateOAuth2ProviderAppByIDParams added in v2.6.0

type UpdateOAuth2ProviderAppByIDParams struct {
	ID          uuid.UUID `db:"id" json:"id"`
	UpdatedAt   time.Time `db:"updated_at" json:"updated_at"`
	Name        string    `db:"name" json:"name"`
	Icon        string    `db:"icon" json:"icon"`
	CallbackURL string    `db:"callback_url" json:"callback_url"`
}

type UpdateOAuth2ProviderAppSecretByIDParams added in v2.6.0

type UpdateOAuth2ProviderAppSecretByIDParams struct {
	ID         uuid.UUID    `db:"id" json:"id"`
	LastUsedAt sql.NullTime `db:"last_used_at" json:"last_used_at"`
}

type UpdateProvisionerDaemonLastSeenAtParams added in v2.6.0

type UpdateProvisionerDaemonLastSeenAtParams struct {
	LastSeenAt sql.NullTime `db:"last_seen_at" json:"last_seen_at"`
	ID         uuid.UUID    `db:"id" json:"id"`
}

type UpdateProvisionerJobByIDParams

type UpdateProvisionerJobByIDParams struct {
	ID        uuid.UUID `db:"id" json:"id"`
	UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
}

type UpdateProvisionerJobWithCancelByIDParams

type UpdateProvisionerJobWithCancelByIDParams struct {
	ID          uuid.UUID    `db:"id" json:"id"`
	CanceledAt  sql.NullTime `db:"canceled_at" json:"canceled_at"`
	CompletedAt sql.NullTime `db:"completed_at" json:"completed_at"`
}

type UpdateProvisionerJobWithCompleteByIDParams

type UpdateProvisionerJobWithCompleteByIDParams struct {
	ID          uuid.UUID      `db:"id" json:"id"`
	UpdatedAt   time.Time      `db:"updated_at" json:"updated_at"`
	CompletedAt sql.NullTime   `db:"completed_at" json:"completed_at"`
	Error       sql.NullString `db:"error" json:"error"`
	ErrorCode   sql.NullString `db:"error_code" json:"error_code"`
}

type UpdateReplicaParams

type UpdateReplicaParams struct {
	ID              uuid.UUID    `db:"id" json:"id"`
	UpdatedAt       time.Time    `db:"updated_at" json:"updated_at"`
	StartedAt       time.Time    `db:"started_at" json:"started_at"`
	StoppedAt       sql.NullTime `db:"stopped_at" json:"stopped_at"`
	RelayAddress    string       `db:"relay_address" json:"relay_address"`
	RegionID        int32        `db:"region_id" json:"region_id"`
	Hostname        string       `db:"hostname" json:"hostname"`
	Version         string       `db:"version" json:"version"`
	Error           string       `db:"error" json:"error"`
	DatabaseLatency int32        `db:"database_latency" json:"database_latency"`
	Primary         bool         `db:"primary" json:"primary"`
}

type UpdateTemplateACLByIDParams

type UpdateTemplateACLByIDParams struct {
	GroupACL TemplateACL `db:"group_acl" json:"group_acl"`
	UserACL  TemplateACL `db:"user_acl" json:"user_acl"`
	ID       uuid.UUID   `db:"id" json:"id"`
}

type UpdateTemplateAccessControlByIDParams added in v2.3.2

type UpdateTemplateAccessControlByIDParams struct {
	ID                   uuid.UUID `db:"id" json:"id"`
	RequireActiveVersion bool      `db:"require_active_version" json:"require_active_version"`
	Deprecated           string    `db:"deprecated" json:"deprecated"`
}

type UpdateTemplateActiveVersionByIDParams

type UpdateTemplateActiveVersionByIDParams struct {
	ID              uuid.UUID `db:"id" json:"id"`
	ActiveVersionID uuid.UUID `db:"active_version_id" json:"active_version_id"`
	UpdatedAt       time.Time `db:"updated_at" json:"updated_at"`
}

type UpdateTemplateDeletedByIDParams

type UpdateTemplateDeletedByIDParams struct {
	ID        uuid.UUID `db:"id" json:"id"`
	Deleted   bool      `db:"deleted" json:"deleted"`
	UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
}

type UpdateTemplateMetaByIDParams

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"`
	Name                         string          `db:"name" json:"name"`
	Icon                         string          `db:"icon" json:"icon"`
	DisplayName                  string          `db:"display_name" json:"display_name"`
	AllowUserCancelWorkspaceJobs bool            `db:"allow_user_cancel_workspace_jobs" json:"allow_user_cancel_workspace_jobs"`
	GroupACL                     TemplateACL     `db:"group_acl" json:"group_acl"`
	MaxPortSharingLevel          AppSharingLevel `db:"max_port_sharing_level" json:"max_port_sharing_level"`
}

type UpdateTemplateScheduleByIDParams

type UpdateTemplateScheduleByIDParams struct {
	ID                            uuid.UUID `db:"id" json:"id"`
	UpdatedAt                     time.Time `db:"updated_at" json:"updated_at"`
	AllowUserAutostart            bool      `db:"allow_user_autostart" json:"allow_user_autostart"`
	AllowUserAutostop             bool      `db:"allow_user_autostop" json:"allow_user_autostop"`
	DefaultTTL                    int64     `db:"default_ttl" json:"default_ttl"`
	ActivityBump                  int64     `db:"activity_bump" json:"activity_bump"`
	AutostopRequirementDaysOfWeek int16     `db:"autostop_requirement_days_of_week" json:"autostop_requirement_days_of_week"`
	AutostopRequirementWeeks      int64     `db:"autostop_requirement_weeks" json:"autostop_requirement_weeks"`
	AutostartBlockDaysOfWeek      int16     `db:"autostart_block_days_of_week" json:"autostart_block_days_of_week"`
	FailureTTL                    int64     `db:"failure_ttl" json:"failure_ttl"`
	TimeTilDormant                int64     `db:"time_til_dormant" json:"time_til_dormant"`
	TimeTilDormantAutoDelete      int64     `db:"time_til_dormant_autodelete" json:"time_til_dormant_autodelete"`
}

type UpdateTemplateVersionByIDParams

type UpdateTemplateVersionByIDParams struct {
	ID         uuid.UUID     `db:"id" json:"id"`
	TemplateID uuid.NullUUID `db:"template_id" json:"template_id"`
	UpdatedAt  time.Time     `db:"updated_at" json:"updated_at"`
	Name       string        `db:"name" json:"name"`
	Message    string        `db:"message" json:"message"`
}

type UpdateTemplateVersionDescriptionByJobIDParams

type UpdateTemplateVersionDescriptionByJobIDParams struct {
	JobID     uuid.UUID `db:"job_id" json:"job_id"`
	Readme    string    `db:"readme" json:"readme"`
	UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
}

type UpdateTemplateVersionExternalAuthProvidersByJobIDParams added in v2.2.1

type UpdateTemplateVersionExternalAuthProvidersByJobIDParams struct {
	JobID                 uuid.UUID       `db:"job_id" json:"job_id"`
	ExternalAuthProviders json.RawMessage `db:"external_auth_providers" json:"external_auth_providers"`
	UpdatedAt             time.Time       `db:"updated_at" json:"updated_at"`
}

type UpdateTemplateWorkspacesLastUsedAtParams added in v2.1.2

type UpdateTemplateWorkspacesLastUsedAtParams struct {
	LastUsedAt time.Time `db:"last_used_at" json:"last_used_at"`
	TemplateID uuid.UUID `db:"template_id" json:"template_id"`
}

type UpdateUserAppearanceSettingsParams added in v2.5.1

type UpdateUserAppearanceSettingsParams struct {
	ID              uuid.UUID `db:"id" json:"id"`
	ThemePreference string    `db:"theme_preference" json:"theme_preference"`
	UpdatedAt       time.Time `db:"updated_at" json:"updated_at"`
}

type UpdateUserHashedPasswordParams

type UpdateUserHashedPasswordParams struct {
	ID             uuid.UUID `db:"id" json:"id"`
	HashedPassword []byte    `db:"hashed_password" json:"hashed_password"`
}

type UpdateUserLastSeenAtParams

type UpdateUserLastSeenAtParams struct {
	ID         uuid.UUID `db:"id" json:"id"`
	LastSeenAt time.Time `db:"last_seen_at" json:"last_seen_at"`
	UpdatedAt  time.Time `db:"updated_at" json:"updated_at"`
}

type UpdateUserLinkParams

type UpdateUserLinkParams struct {
	OAuthAccessToken       string          `db:"oauth_access_token" json:"oauth_access_token"`
	OAuthAccessTokenKeyID  sql.NullString  `db:"oauth_access_token_key_id" json:"oauth_access_token_key_id"`
	OAuthRefreshToken      string          `db:"oauth_refresh_token" json:"oauth_refresh_token"`
	OAuthRefreshTokenKeyID sql.NullString  `db:"oauth_refresh_token_key_id" json:"oauth_refresh_token_key_id"`
	OAuthExpiry            time.Time       `db:"oauth_expiry" json:"oauth_expiry"`
	DebugContext           json.RawMessage `db:"debug_context" json:"debug_context"`
	UserID                 uuid.UUID       `db:"user_id" json:"user_id"`
	LoginType              LoginType       `db:"login_type" json:"login_type"`
}

type UpdateUserLinkedIDParams

type UpdateUserLinkedIDParams struct {
	LinkedID  string    `db:"linked_id" json:"linked_id"`
	UserID    uuid.UUID `db:"user_id" json:"user_id"`
	LoginType LoginType `db:"login_type" json:"login_type"`
}

type UpdateUserLoginTypeParams

type UpdateUserLoginTypeParams struct {
	NewLoginType LoginType `db:"new_login_type" json:"new_login_type"`
	UserID       uuid.UUID `db:"user_id" json:"user_id"`
}

type UpdateUserProfileParams

type UpdateUserProfileParams struct {
	ID        uuid.UUID `db:"id" json:"id"`
	Email     string    `db:"email" json:"email"`
	Username  string    `db:"username" json:"username"`
	AvatarURL string    `db:"avatar_url" json:"avatar_url"`
	UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
	Name      string    `db:"name" json:"name"`
}

type UpdateUserQuietHoursScheduleParams

type UpdateUserQuietHoursScheduleParams struct {
	ID                 uuid.UUID `db:"id" json:"id"`
	QuietHoursSchedule string    `db:"quiet_hours_schedule" json:"quiet_hours_schedule"`
}

type UpdateUserRolesParams

type UpdateUserRolesParams struct {
	GrantedRoles []string  `db:"granted_roles" json:"granted_roles"`
	ID           uuid.UUID `db:"id" json:"id"`
}

type UpdateUserStatusParams

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"`
	LastConnectedReplicaID uuid.NullUUID `db:"last_connected_replica_id" json:"last_connected_replica_id"`
	DisconnectedAt         sql.NullTime  `db:"disconnected_at" json:"disconnected_at"`
	UpdatedAt              time.Time     `db:"updated_at" json:"updated_at"`
}

type UpdateWorkspaceAgentLifecycleStateByIDParams

type UpdateWorkspaceAgentLifecycleStateByIDParams struct {
	ID             uuid.UUID                    `db:"id" json:"id"`
	LifecycleState WorkspaceAgentLifecycleState `db:"lifecycle_state" json:"lifecycle_state"`
	StartedAt      sql.NullTime                 `db:"started_at" json:"started_at"`
	ReadyAt        sql.NullTime                 `db:"ready_at" json:"ready_at"`
}

type UpdateWorkspaceAgentLogOverflowByIDParams

type UpdateWorkspaceAgentLogOverflowByIDParams struct {
	ID             uuid.UUID `db:"id" json:"id"`
	LogsOverflowed bool      `db:"logs_overflowed" json:"logs_overflowed"`
}

type UpdateWorkspaceAgentMetadataParams

type UpdateWorkspaceAgentMetadataParams struct {
	WorkspaceAgentID uuid.UUID   `db:"workspace_agent_id" json:"workspace_agent_id"`
	Key              []string    `db:"key" json:"key"`
	Value            []string    `db:"value" json:"value"`
	Error            []string    `db:"error" json:"error"`
	CollectedAt      []time.Time `db:"collected_at" json:"collected_at"`
}

type UpdateWorkspaceAgentStartupByIDParams

type UpdateWorkspaceAgentStartupByIDParams struct {
	ID                uuid.UUID                 `db:"id" json:"id"`
	Version           string                    `db:"version" json:"version"`
	ExpandedDirectory string                    `db:"expanded_directory" json:"expanded_directory"`
	Subsystems        []WorkspaceAgentSubsystem `db:"subsystems" json:"subsystems"`
	APIVersion        string                    `db:"api_version" json:"api_version"`
}

type UpdateWorkspaceAppHealthByIDParams

type UpdateWorkspaceAppHealthByIDParams struct {
	ID     uuid.UUID          `db:"id" json:"id"`
	Health WorkspaceAppHealth `db:"health" json:"health"`
}

type UpdateWorkspaceAutomaticUpdatesParams added in v2.3.0

type UpdateWorkspaceAutomaticUpdatesParams struct {
	ID               uuid.UUID        `db:"id" json:"id"`
	AutomaticUpdates AutomaticUpdates `db:"automatic_updates" json:"automatic_updates"`
}

type UpdateWorkspaceAutostartParams

type UpdateWorkspaceAutostartParams struct {
	ID                uuid.UUID      `db:"id" json:"id"`
	AutostartSchedule sql.NullString `db:"autostart_schedule" json:"autostart_schedule"`
}

type UpdateWorkspaceBuildCostByIDParams

type UpdateWorkspaceBuildCostByIDParams struct {
	ID        uuid.UUID `db:"id" json:"id"`
	DailyCost int32     `db:"daily_cost" json:"daily_cost"`
}

type UpdateWorkspaceBuildDeadlineByIDParams added in v2.2.0

type UpdateWorkspaceBuildDeadlineByIDParams struct {
	Deadline    time.Time `db:"deadline" json:"deadline"`
	MaxDeadline time.Time `db:"max_deadline" json:"max_deadline"`
	UpdatedAt   time.Time `db:"updated_at" json:"updated_at"`
	ID          uuid.UUID `db:"id" json:"id"`
}

type UpdateWorkspaceBuildProvisionerStateByIDParams added in v2.2.0

type UpdateWorkspaceBuildProvisionerStateByIDParams struct {
	ProvisionerState []byte    `db:"provisioner_state" json:"provisioner_state"`
	UpdatedAt        time.Time `db:"updated_at" json:"updated_at"`
	ID               uuid.UUID `db:"id" json:"id"`
}

type UpdateWorkspaceDeletedByIDParams

type UpdateWorkspaceDeletedByIDParams struct {
	ID      uuid.UUID `db:"id" json:"id"`
	Deleted bool      `db:"deleted" json:"deleted"`
}

type UpdateWorkspaceDormantDeletingAtParams added in v2.1.4

type UpdateWorkspaceDormantDeletingAtParams struct {
	ID        uuid.UUID    `db:"id" json:"id"`
	DormantAt sql.NullTime `db:"dormant_at" json:"dormant_at"`
}

type UpdateWorkspaceLastUsedAtParams

type UpdateWorkspaceLastUsedAtParams struct {
	ID         uuid.UUID `db:"id" json:"id"`
	LastUsedAt time.Time `db:"last_used_at" json:"last_used_at"`
}

type UpdateWorkspaceParams

type UpdateWorkspaceParams struct {
	ID   uuid.UUID `db:"id" json:"id"`
	Name string    `db:"name" json:"name"`
}

type UpdateWorkspaceProxyDeletedParams

type UpdateWorkspaceProxyDeletedParams struct {
	Deleted bool      `db:"deleted" json:"deleted"`
	ID      uuid.UUID `db:"id" json:"id"`
}

type UpdateWorkspaceProxyParams

type UpdateWorkspaceProxyParams struct {
	Name              string    `db:"name" json:"name"`
	DisplayName       string    `db:"display_name" json:"display_name"`
	Icon              string    `db:"icon" json:"icon"`
	TokenHashedSecret []byte    `db:"token_hashed_secret" json:"token_hashed_secret"`
	ID                uuid.UUID `db:"id" json:"id"`
}

type UpdateWorkspaceTTLParams

type UpdateWorkspaceTTLParams struct {
	ID  uuid.UUID     `db:"id" json:"id"`
	Ttl sql.NullInt64 `db:"ttl" json:"ttl"`
}

type UpdateWorkspacesDormantDeletingAtByTemplateIDParams added in v2.1.4

type UpdateWorkspacesDormantDeletingAtByTemplateIDParams struct {
	TimeTilDormantAutodeleteMs int64     `db:"time_til_dormant_autodelete_ms" json:"time_til_dormant_autodelete_ms"`
	DormantAt                  time.Time `db:"dormant_at" json:"dormant_at"`
	TemplateID                 uuid.UUID `db:"template_id" json:"template_id"`
}

type UpsertDefaultProxyParams

type UpsertDefaultProxyParams struct {
	DisplayName string `db:"display_name" json:"display_name"`
	IconUrl     string `db:"icon_url" json:"icon_url"`
}

type UpsertJFrogXrayScanByWorkspaceAndAgentIDParams added in v2.8.0

type UpsertJFrogXrayScanByWorkspaceAndAgentIDParams struct {
	AgentID     uuid.UUID `db:"agent_id" json:"agent_id"`
	WorkspaceID uuid.UUID `db:"workspace_id" json:"workspace_id"`
	Critical    int32     `db:"critical" json:"critical"`
	High        int32     `db:"high" json:"high"`
	Medium      int32     `db:"medium" json:"medium"`
	ResultsUrl  string    `db:"results_url" json:"results_url"`
}

type UpsertProvisionerDaemonParams added in v2.5.1

type UpsertProvisionerDaemonParams struct {
	CreatedAt      time.Time         `db:"created_at" json:"created_at"`
	Name           string            `db:"name" json:"name"`
	Provisioners   []ProvisionerType `db:"provisioners" json:"provisioners"`
	Tags           StringMap         `db:"tags" json:"tags"`
	LastSeenAt     sql.NullTime      `db:"last_seen_at" json:"last_seen_at"`
	Version        string            `db:"version" json:"version"`
	OrganizationID uuid.UUID         `db:"organization_id" json:"organization_id"`
	APIVersion     string            `db:"api_version" json:"api_version"`
}

type UpsertTailnetAgentParams

type UpsertTailnetAgentParams struct {
	ID            uuid.UUID       `db:"id" json:"id"`
	CoordinatorID uuid.UUID       `db:"coordinator_id" json:"coordinator_id"`
	Node          json.RawMessage `db:"node" json:"node"`
}

type UpsertTailnetClientParams

type UpsertTailnetClientParams struct {
	ID            uuid.UUID       `db:"id" json:"id"`
	CoordinatorID uuid.UUID       `db:"coordinator_id" json:"coordinator_id"`
	Node          json.RawMessage `db:"node" json:"node"`
}

type UpsertTailnetClientSubscriptionParams added in v2.2.0

type UpsertTailnetClientSubscriptionParams struct {
	ClientID      uuid.UUID `db:"client_id" json:"client_id"`
	CoordinatorID uuid.UUID `db:"coordinator_id" json:"coordinator_id"`
	AgentID       uuid.UUID `db:"agent_id" json:"agent_id"`
}

type UpsertTailnetPeerParams added in v2.4.0

type UpsertTailnetPeerParams struct {
	ID            uuid.UUID     `db:"id" json:"id"`
	CoordinatorID uuid.UUID     `db:"coordinator_id" json:"coordinator_id"`
	Node          []byte        `db:"node" json:"node"`
	Status        TailnetStatus `db:"status" json:"status"`
}

type UpsertTailnetTunnelParams added in v2.4.0

type UpsertTailnetTunnelParams struct {
	CoordinatorID uuid.UUID `db:"coordinator_id" json:"coordinator_id"`
	SrcID         uuid.UUID `db:"src_id" json:"src_id"`
	DstID         uuid.UUID `db:"dst_id" json:"dst_id"`
}

type UpsertWorkspaceAgentPortShareParams added in v2.9.0

type UpsertWorkspaceAgentPortShareParams struct {
	WorkspaceID uuid.UUID         `db:"workspace_id" json:"workspace_id"`
	AgentName   string            `db:"agent_name" json:"agent_name"`
	Port        int32             `db:"port" json:"port"`
	ShareLevel  AppSharingLevel   `db:"share_level" json:"share_level"`
	Protocol    PortShareProtocol `db:"protocol" json:"protocol"`
}

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      pq.StringArray `db:"rbac_roles" json:"rbac_roles"`
	LoginType      LoginType      `db:"login_type" json:"login_type"`
	AvatarURL      string         `db:"avatar_url" json:"avatar_url"`
	Deleted        bool           `db:"deleted" json:"deleted"`
	LastSeenAt     time.Time      `db:"last_seen_at" json:"last_seen_at"`
	// Daily (!) cron schedule (with optional CRON_TZ) signifying the start of the user's quiet hours. If empty, the default quiet hours on the instance is used instead.
	QuietHoursSchedule string `db:"quiet_hours_schedule" json:"quiet_hours_schedule"`
	// "" can be interpreted as "the user does not care", falling back to the default theme
	ThemePreference string `db:"theme_preference" json:"theme_preference"`
	// Name of the Coder user
	Name string `db:"name" json:"name"`
}

func ConvertUserRows

func ConvertUserRows(rows []GetUsersRow) []User

func (User) RBACObject

func (u User) RBACObject() rbac.Object

RBACObject returns the RBAC object for the site wide user resource. If you are trying to get the RBAC object for the UserData, use u.UserDataRBACObject() instead.

func (User) UserDataRBACObject

func (u User) UserDataRBACObject() rbac.Object

func (User) UserWorkspaceBuildParametersObject added in v2.8.0

func (u User) UserWorkspaceBuildParametersObject() rbac.Object
type UserLink struct {
	UserID            uuid.UUID `db:"user_id" json:"user_id"`
	LoginType         LoginType `db:"login_type" json:"login_type"`
	LinkedID          string    `db:"linked_id" json:"linked_id"`
	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"`
	// The ID of the key used to encrypt the OAuth access token. If this is NULL, the access token is not encrypted
	OAuthAccessTokenKeyID sql.NullString `db:"oauth_access_token_key_id" json:"oauth_access_token_key_id"`
	// The ID of the key used to encrypt the OAuth refresh token. If this is NULL, the refresh token is not encrypted
	OAuthRefreshTokenKeyID sql.NullString `db:"oauth_refresh_token_key_id" json:"oauth_refresh_token_key_id"`
	// Debug information includes information like id_token and userinfo claims.
	DebugContext json.RawMessage `db:"debug_context" json:"debug_context"`
}

func (UserLink) RBACObject

func (u UserLink) RBACObject() rbac.Object

type UserStatus

type UserStatus string

Defines the users status: active, dormant, or suspended.

const (
	UserStatusActive    UserStatus = "active"
	UserStatusSuspended UserStatus = "suspended"
	UserStatusDormant   UserStatus = "dormant"
)

func AllUserStatusValues

func AllUserStatusValues() []UserStatus

func (*UserStatus) Scan

func (e *UserStatus) Scan(src interface{}) error

func (UserStatus) Valid

func (e UserStatus) Valid() bool

type VisibleUser

type VisibleUser struct {
	ID        uuid.UUID `db:"id" json:"id"`
	Username  string    `db:"username" json:"username"`
	AvatarURL string    `db:"avatar_url" json:"avatar_url"`
}

Visible fields of users are allowed to be joined with other tables for including context of other resources.

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"`
	LastUsedAt        time.Time        `db:"last_used_at" json:"last_used_at"`
	DormantAt         sql.NullTime     `db:"dormant_at" json:"dormant_at"`
	DeletingAt        sql.NullTime     `db:"deleting_at" json:"deleting_at"`
	AutomaticUpdates  AutomaticUpdates `db:"automatic_updates" json:"automatic_updates"`
	// Favorite is true if the workspace owner has favorited the workspace.
	Favorite bool `db:"favorite" json:"favorite"`
}

func ConvertWorkspaceRows

func ConvertWorkspaceRows(rows []GetWorkspacesRow) []Workspace

func (Workspace) ApplicationConnectRBAC

func (w Workspace) ApplicationConnectRBAC() rbac.Object

func (Workspace) DormantRBAC added in v2.1.4

func (w Workspace) DormantRBAC() rbac.Object

func (Workspace) ExecutionRBAC

func (w Workspace) ExecutionRBAC() rbac.Object

func (Workspace) RBACObject

func (w Workspace) RBACObject() rbac.Object

func (Workspace) WorkspaceBuildRBAC

func (w Workspace) WorkspaceBuildRBAC(transition WorkspaceTransition) rbac.Object

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"`
	InstanceMetadata     pqtype.NullRawMessage `db:"instance_metadata" json:"instance_metadata"`
	ResourceMetadata     pqtype.NullRawMessage `db:"resource_metadata" json:"resource_metadata"`
	Directory            string                `db:"directory" json:"directory"`
	// Version tracks the version of the currently running workspace agent. Workspace agents register their version upon start.
	Version                string        `db:"version" json:"version"`
	LastConnectedReplicaID uuid.NullUUID `db:"last_connected_replica_id" json:"last_connected_replica_id"`
	// Connection timeout in seconds, 0 means disabled.
	ConnectionTimeoutSeconds int32 `db:"connection_timeout_seconds" json:"connection_timeout_seconds"`
	// URL for troubleshooting the agent.
	TroubleshootingURL string `db:"troubleshooting_url" json:"troubleshooting_url"`
	// Path to file inside workspace containing the message of the day (MOTD) to show to the user when logging in via SSH.
	MOTDFile string `db:"motd_file" json:"motd_file"`
	// The current lifecycle state reported by the workspace agent.
	LifecycleState WorkspaceAgentLifecycleState `db:"lifecycle_state" json:"lifecycle_state"`
	// The resolved path of a user-specified directory. e.g. ~/coder -> /home/coder/coder
	ExpandedDirectory string `db:"expanded_directory" json:"expanded_directory"`
	// Total length of startup logs
	LogsLength int32 `db:"logs_length" json:"logs_length"`
	// Whether the startup logs overflowed in length
	LogsOverflowed bool `db:"logs_overflowed" json:"logs_overflowed"`
	// The time the agent entered the starting lifecycle state
	StartedAt sql.NullTime `db:"started_at" json:"started_at"`
	// The time the agent entered the ready or start_error lifecycle state
	ReadyAt     sql.NullTime              `db:"ready_at" json:"ready_at"`
	Subsystems  []WorkspaceAgentSubsystem `db:"subsystems" json:"subsystems"`
	DisplayApps []DisplayApp              `db:"display_apps" json:"display_apps"`
	APIVersion  string                    `db:"api_version" json:"api_version"`
	// Specifies the order in which to display agents in user interfaces.
	DisplayOrder int32 `db:"display_order" json:"display_order"`
}

func (WorkspaceAgent) Status

func (a WorkspaceAgent) Status(inactiveTimeout time.Duration) WorkspaceAgentConnectionStatus

type WorkspaceAgentConnectionStatus

type WorkspaceAgentConnectionStatus struct {
	Status           WorkspaceAgentStatus `json:"status"`
	FirstConnectedAt *time.Time           `json:"first_connected_at"`
	LastConnectedAt  *time.Time           `json:"last_connected_at"`
	DisconnectedAt   *time.Time           `json:"disconnected_at"`
}

type WorkspaceAgentLifecycleState

type WorkspaceAgentLifecycleState string
const (
	WorkspaceAgentLifecycleStateCreated         WorkspaceAgentLifecycleState = "created"
	WorkspaceAgentLifecycleStateStarting        WorkspaceAgentLifecycleState = "starting"
	WorkspaceAgentLifecycleStateStartTimeout    WorkspaceAgentLifecycleState = "start_timeout"
	WorkspaceAgentLifecycleStateStartError      WorkspaceAgentLifecycleState = "start_error"
	WorkspaceAgentLifecycleStateReady           WorkspaceAgentLifecycleState = "ready"
	WorkspaceAgentLifecycleStateShuttingDown    WorkspaceAgentLifecycleState = "shutting_down"
	WorkspaceAgentLifecycleStateShutdownTimeout WorkspaceAgentLifecycleState = "shutdown_timeout"
	WorkspaceAgentLifecycleStateShutdownError   WorkspaceAgentLifecycleState = "shutdown_error"
	WorkspaceAgentLifecycleStateOff             WorkspaceAgentLifecycleState = "off"
)

func AllWorkspaceAgentLifecycleStateValues

func AllWorkspaceAgentLifecycleStateValues() []WorkspaceAgentLifecycleState

func (*WorkspaceAgentLifecycleState) Scan

func (e *WorkspaceAgentLifecycleState) Scan(src interface{}) error

func (WorkspaceAgentLifecycleState) Valid

type WorkspaceAgentLog

type WorkspaceAgentLog struct {
	AgentID     uuid.UUID `db:"agent_id" json:"agent_id"`
	CreatedAt   time.Time `db:"created_at" json:"created_at"`
	Output      string    `db:"output" json:"output"`
	ID          int64     `db:"id" json:"id"`
	Level       LogLevel  `db:"level" json:"level"`
	LogSourceID uuid.UUID `db:"log_source_id" json:"log_source_id"`
}

type WorkspaceAgentLogSource

type WorkspaceAgentLogSource struct {
	WorkspaceAgentID uuid.UUID `db:"workspace_agent_id" json:"workspace_agent_id"`
	ID               uuid.UUID `db:"id" json:"id"`
	CreatedAt        time.Time `db:"created_at" json:"created_at"`
	DisplayName      string    `db:"display_name" json:"display_name"`
	Icon             string    `db:"icon" json:"icon"`
}

type WorkspaceAgentMetadatum

type WorkspaceAgentMetadatum struct {
	WorkspaceAgentID uuid.UUID `db:"workspace_agent_id" json:"workspace_agent_id"`
	DisplayName      string    `db:"display_name" json:"display_name"`
	Key              string    `db:"key" json:"key"`
	Script           string    `db:"script" json:"script"`
	Value            string    `db:"value" json:"value"`
	Error            string    `db:"error" json:"error"`
	Timeout          int64     `db:"timeout" json:"timeout"`
	Interval         int64     `db:"interval" json:"interval"`
	CollectedAt      time.Time `db:"collected_at" json:"collected_at"`
	// Specifies the order in which to display agent metadata in user interfaces.
	DisplayOrder int32 `db:"display_order" json:"display_order"`
}

type WorkspaceAgentPortShare added in v2.9.0

type WorkspaceAgentPortShare struct {
	WorkspaceID uuid.UUID         `db:"workspace_id" json:"workspace_id"`
	AgentName   string            `db:"agent_name" json:"agent_name"`
	Port        int32             `db:"port" json:"port"`
	ShareLevel  AppSharingLevel   `db:"share_level" json:"share_level"`
	Protocol    PortShareProtocol `db:"protocol" json:"protocol"`
}

type WorkspaceAgentScript added in v2.2.0

type WorkspaceAgentScript struct {
	WorkspaceAgentID uuid.UUID `db:"workspace_agent_id" json:"workspace_agent_id"`
	LogSourceID      uuid.UUID `db:"log_source_id" json:"log_source_id"`
	LogPath          string    `db:"log_path" json:"log_path"`
	CreatedAt        time.Time `db:"created_at" json:"created_at"`
	Script           string    `db:"script" json:"script"`
	Cron             string    `db:"cron" json:"cron"`
	StartBlocksLogin bool      `db:"start_blocks_login" json:"start_blocks_login"`
	RunOnStart       bool      `db:"run_on_start" json:"run_on_start"`
	RunOnStop        bool      `db:"run_on_stop" json:"run_on_stop"`
	TimeoutSeconds   int32     `db:"timeout_seconds" json:"timeout_seconds"`
}

type WorkspaceAgentStat

type WorkspaceAgentStat struct {
	ID                          uuid.UUID       `db:"id" json:"id"`
	CreatedAt                   time.Time       `db:"created_at" json:"created_at"`
	UserID                      uuid.UUID       `db:"user_id" json:"user_id"`
	AgentID                     uuid.UUID       `db:"agent_id" json:"agent_id"`
	WorkspaceID                 uuid.UUID       `db:"workspace_id" json:"workspace_id"`
	TemplateID                  uuid.UUID       `db:"template_id" json:"template_id"`
	ConnectionsByProto          json.RawMessage `db:"connections_by_proto" json:"connections_by_proto"`
	ConnectionCount             int64           `db:"connection_count" json:"connection_count"`
	RxPackets                   int64           `db:"rx_packets" json:"rx_packets"`
	RxBytes                     int64           `db:"rx_bytes" json:"rx_bytes"`
	TxPackets                   int64           `db:"tx_packets" json:"tx_packets"`
	TxBytes                     int64           `db:"tx_bytes" json:"tx_bytes"`
	ConnectionMedianLatencyMS   float64         `db:"connection_median_latency_ms" json:"connection_median_latency_ms"`
	SessionCountVSCode          int64           `db:"session_count_vscode" json:"session_count_vscode"`
	SessionCountJetBrains       int64           `db:"session_count_jetbrains" json:"session_count_jetbrains"`
	SessionCountReconnectingPTY int64           `db:"session_count_reconnecting_pty" json:"session_count_reconnecting_pty"`
	SessionCountSSH             int64           `db:"session_count_ssh" json:"session_count_ssh"`
}

type WorkspaceAgentStatus

type WorkspaceAgentStatus string
const (
	WorkspaceAgentStatusConnecting   WorkspaceAgentStatus = "connecting"
	WorkspaceAgentStatusConnected    WorkspaceAgentStatus = "connected"
	WorkspaceAgentStatusDisconnected WorkspaceAgentStatus = "disconnected"
	WorkspaceAgentStatusTimeout      WorkspaceAgentStatus = "timeout"
)

This is also in codersdk/workspaceagents.go and should be kept in sync.

func (WorkspaceAgentStatus) Valid

func (s WorkspaceAgentStatus) Valid() bool

type WorkspaceAgentSubsystem

type WorkspaceAgentSubsystem string
const (
	WorkspaceAgentSubsystemEnvbuilder WorkspaceAgentSubsystem = "envbuilder"
	WorkspaceAgentSubsystemEnvbox     WorkspaceAgentSubsystem = "envbox"
	WorkspaceAgentSubsystemNone       WorkspaceAgentSubsystem = "none"
	WorkspaceAgentSubsystemExectrace  WorkspaceAgentSubsystem = "exectrace"
)

func AllWorkspaceAgentSubsystemValues

func AllWorkspaceAgentSubsystemValues() []WorkspaceAgentSubsystem

func (*WorkspaceAgentSubsystem) Scan

func (e *WorkspaceAgentSubsystem) Scan(src interface{}) error

func (WorkspaceAgentSubsystem) Valid

func (e WorkspaceAgentSubsystem) Valid() bool

type WorkspaceApp

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"`
	DisplayName          string             `db:"display_name" json:"display_name"`
	Icon                 string             `db:"icon" json:"icon"`
	Command              sql.NullString     `db:"command" json:"command"`
	Url                  sql.NullString     `db:"url" json:"url"`
	HealthcheckUrl       string             `db:"healthcheck_url" json:"healthcheck_url"`
	HealthcheckInterval  int32              `db:"healthcheck_interval" json:"healthcheck_interval"`
	HealthcheckThreshold int32              `db:"healthcheck_threshold" json:"healthcheck_threshold"`
	Health               WorkspaceAppHealth `db:"health" json:"health"`
	Subdomain            bool               `db:"subdomain" json:"subdomain"`
	SharingLevel         AppSharingLevel    `db:"sharing_level" json:"sharing_level"`
	Slug                 string             `db:"slug" json:"slug"`
	External             bool               `db:"external" json:"external"`
	// Specifies the order in which to display agent app in user interfaces.
	DisplayOrder int32 `db:"display_order" json:"display_order"`
}

type WorkspaceAppHealth

type WorkspaceAppHealth string
const (
	WorkspaceAppHealthDisabled     WorkspaceAppHealth = "disabled"
	WorkspaceAppHealthInitializing WorkspaceAppHealth = "initializing"
	WorkspaceAppHealthHealthy      WorkspaceAppHealth = "healthy"
	WorkspaceAppHealthUnhealthy    WorkspaceAppHealth = "unhealthy"
)

func AllWorkspaceAppHealthValues

func AllWorkspaceAppHealthValues() []WorkspaceAppHealth

func (*WorkspaceAppHealth) Scan

func (e *WorkspaceAppHealth) Scan(src interface{}) error

func (WorkspaceAppHealth) Valid

func (e WorkspaceAppHealth) Valid() bool

type WorkspaceAppStat

type WorkspaceAppStat struct {
	// The ID of the record
	ID int64 `db:"id" json:"id"`
	// The user who used the workspace app
	UserID uuid.UUID `db:"user_id" json:"user_id"`
	// The workspace that the workspace app was used in
	WorkspaceID uuid.UUID `db:"workspace_id" json:"workspace_id"`
	// The workspace agent that was used
	AgentID uuid.UUID `db:"agent_id" json:"agent_id"`
	// The method used to access the workspace app
	AccessMethod string `db:"access_method" json:"access_method"`
	// The slug or port used to to identify the app
	SlugOrPort string `db:"slug_or_port" json:"slug_or_port"`
	// The unique identifier for the session
	SessionID uuid.UUID `db:"session_id" json:"session_id"`
	// The time the session started
	SessionStartedAt time.Time `db:"session_started_at" json:"session_started_at"`
	// The time the session ended
	SessionEndedAt time.Time `db:"session_ended_at" json:"session_ended_at"`
	// The number of requests made during the session, a number larger than 1 indicates that multiple sessions were rolled up into one
	Requests int32 `db:"requests" json:"requests"`
}

A record of workspace app usage statistics

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"`
	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"`
	Reason               BuildReason         `db:"reason" json:"reason"`
	DailyCost            int32               `db:"daily_cost" json:"daily_cost"`
	MaxDeadline          time.Time           `db:"max_deadline" json:"max_deadline"`
	InitiatorByAvatarUrl string              `db:"initiator_by_avatar_url" json:"initiator_by_avatar_url"`
	InitiatorByUsername  string              `db:"initiator_by_username" json:"initiator_by_username"`
}

Joins in the username + avatar url of the initiated by user.

type WorkspaceBuildParameter

type WorkspaceBuildParameter struct {
	WorkspaceBuildID uuid.UUID `db:"workspace_build_id" json:"workspace_build_id"`
	// Parameter name
	Name string `db:"name" json:"name"`
	// Parameter value
	Value string `db:"value" json:"value"`
}

type WorkspaceBuildTable

type WorkspaceBuildTable 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"`
	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"`
	Reason            BuildReason         `db:"reason" json:"reason"`
	DailyCost         int32               `db:"daily_cost" json:"daily_cost"`
	MaxDeadline       time.Time           `db:"max_deadline" json:"max_deadline"`
}

type WorkspaceProxy

type WorkspaceProxy struct {
	ID          uuid.UUID `db:"id" json:"id"`
	Name        string    `db:"name" json:"name"`
	DisplayName string    `db:"display_name" json:"display_name"`
	// Expects an emoji character. (/emojis/1f1fa-1f1f8.png)
	Icon string `db:"icon" json:"icon"`
	// Full url including scheme of the proxy api url: https://us.example.com
	Url string `db:"url" json:"url"`
	// Hostname with the wildcard for subdomain based app hosting: *.us.example.com
	WildcardHostname string    `db:"wildcard_hostname" json:"wildcard_hostname"`
	CreatedAt        time.Time `db:"created_at" json:"created_at"`
	UpdatedAt        time.Time `db:"updated_at" json:"updated_at"`
	// Boolean indicator of a deleted workspace proxy. Proxies are soft-deleted.
	Deleted bool `db:"deleted" json:"deleted"`
	// Hashed secret is used to authenticate the workspace proxy using a session token.
	TokenHashedSecret []byte `db:"token_hashed_secret" json:"token_hashed_secret"`
	RegionID          int32  `db:"region_id" json:"region_id"`
	DerpEnabled       bool   `db:"derp_enabled" json:"derp_enabled"`
	// Disables app/terminal proxying for this proxy and only acts as a DERP relay.
	DerpOnly bool   `db:"derp_only" json:"derp_only"`
	Version  string `db:"version" json:"version"`
}

func (WorkspaceProxy) IsPrimary

func (w WorkspaceProxy) IsPrimary() bool

func (WorkspaceProxy) RBACObject

func (w WorkspaceProxy) RBACObject() rbac.Object

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"`
	Hide         bool                `db:"hide" json:"hide"`
	Icon         string              `db:"icon" json:"icon"`
	InstanceType sql.NullString      `db:"instance_type" json:"instance_type"`
	DailyCost    int32               `db:"daily_cost" json:"daily_cost"`
}

type WorkspaceResourceMetadatum

type WorkspaceResourceMetadatum struct {
	WorkspaceResourceID uuid.UUID      `db:"workspace_resource_id" json:"workspace_resource_id"`
	Key                 string         `db:"key" json:"key"`
	Value               sql.NullString `db:"value" json:"value"`
	Sensitive           bool           `db:"sensitive" json:"sensitive"`
	ID                  int64          `db:"id" json:"id"`
}

type WorkspaceStatus

type WorkspaceStatus string
const (
	WorkspaceStatusPending   WorkspaceStatus = "pending"
	WorkspaceStatusStarting  WorkspaceStatus = "starting"
	WorkspaceStatusRunning   WorkspaceStatus = "running"
	WorkspaceStatusStopping  WorkspaceStatus = "stopping"
	WorkspaceStatusStopped   WorkspaceStatus = "stopped"
	WorkspaceStatusFailed    WorkspaceStatus = "failed"
	WorkspaceStatusCanceling WorkspaceStatus = "canceling"
	WorkspaceStatusCanceled  WorkspaceStatus = "canceled"
	WorkspaceStatusDeleting  WorkspaceStatus = "deleting"
	WorkspaceStatusDeleted   WorkspaceStatus = "deleted"
)

func (WorkspaceStatus) Valid

func (s WorkspaceStatus) Valid() bool

type WorkspaceTransition

type WorkspaceTransition string
const (
	WorkspaceTransitionStart  WorkspaceTransition = "start"
	WorkspaceTransitionStop   WorkspaceTransition = "stop"
	WorkspaceTransitionDelete WorkspaceTransition = "delete"
)

func AllWorkspaceTransitionValues

func AllWorkspaceTransitionValues() []WorkspaceTransition

func (*WorkspaceTransition) Scan

func (e *WorkspaceTransition) Scan(src interface{}) error

func (WorkspaceTransition) Valid

func (e WorkspaceTransition) Valid() bool

Directories

Path Synopsis
Package db2sdk provides common conversion routines from database types to codersdk types
Package db2sdk provides common conversion routines from database types to codersdk types
Package dbauthz provides an authorization layer on top of the database.
Package dbauthz provides an authorization layer on top of the database.
Code generated by coderd/database/gen/metrics.
Code generated by coderd/database/gen/metrics.
Package dbmock is a generated GoMock package.
Package dbmock is a generated GoMock package.
gen
Package gentest contains tests that are run at db generate time.
Package gentest contains tests that are run at db generate time.

Jump to

Keyboard shortcuts

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