codersdk package - github.com/coder/coder/v2/codersdk - Go Packages

Code generated by scripts/apikeyscopesgen. DO NOT EDIT.

Code generated by typegen/main.go. DO NOT EDIT.

View Source

const (
	SessionTokenHeader = "Coder-Session-Token"
	
	OAuth2StateCookie = "oauth_state"
	
	
	
	OAuth2PKCEVerifier = "oauth_pkce_verifier"
	
	OAuth2RedirectCookie = "oauth_redirect"

	
	
	
	PathAppSessionTokenCookie = "coder_path_app_session_token"
	
	
	
	
	
	
	
	SubdomainAppSessionTokenCookie = "coder_subdomain_app_session_token"
	
	
	
	SignedAppTokenCookie = "coder_signed_app_token"
	
	
	
	
	
	
	
	
	SignedAppTokenQueryParameter = "coder_signed_app_token_23db1dde"

	
	
	BypassRatelimitHeader = "X-Coder-Bypass-Ratelimit"

	
	
	CLITelemetryHeader = "Coder-CLI-Telemetry"

	
	CoderDesktopTelemetryHeader = "Coder-Desktop-Telemetry"

	
	ProvisionerDaemonPSK = "Coder-Provisioner-Daemon-PSK"

	
	ProvisionerDaemonKey = "Coder-Provisioner-Daemon-Key"

	BuildVersionHeader = "X-Coder-Build-Version"

	EntitlementsWarningHeader = "X-Coder-Entitlements-Warning"
)

View Source

const (
	ContentTypeTar = "application/x-tar"
	ContentTypeZip = "application/zip"

	FormatZip = "zip"
)

View Source

const (
	InboxNotificationFallbackIconWorkspace = "DEFAULT_ICON_WORKSPACE"
	InboxNotificationFallbackIconAccount   = "DEFAULT_ICON_ACCOUNT"
	InboxNotificationFallbackIconTemplate  = "DEFAULT_ICON_TEMPLATE"
	InboxNotificationFallbackIconOther     = "DEFAULT_ICON_OTHER"
)

View Source

const (
	TemplateBuiltinAppDisplayNameVSCode      string = "Visual Studio Code"
	TemplateBuiltinAppDisplayNameJetBrains   string = "JetBrains"
	TemplateBuiltinAppDisplayNameWebTerminal string = "Web Terminal"
	TemplateBuiltinAppDisplayNameSSH         string = "SSH"
	TemplateBuiltinAppDisplayNameSFTP        string = "SFTP"
)

Enums define the display name of the builtin app reported.

View Source

const (
	LicenseExpiryClaim                          = "license_expires"
	LicenseTelemetryRequiredErrorText           = "License requires telemetry but telemetry is disabled"
	LicenseManagedAgentLimitExceededWarningText = "You have built more workspaces with managed agents than your license allows."
)

View Source

const (
	LogSourceProvisionerDaemon LogSource = "provisioner_daemon"
	LogSourceProvisioner       LogSource = "provisioner"

	LogLevelTrace LogLevel = "trace"
	LogLevelDebug LogLevel = "debug"
	LogLevelInfo  LogLevel = "info"
	LogLevelWarn  LogLevel = "warn"
	LogLevelError LogLevel = "error"
)

View Source

const (
	ProvisionerKeyIDBuiltIn  = "00000000-0000-0000-0000-000000000001"
	ProvisionerKeyIDUserAuth = "00000000-0000-0000-0000-000000000002"
	ProvisionerKeyIDPSK      = "00000000-0000-0000-0000-000000000003"
)

View Source

const (
	ProvisionerKeyNameBuiltIn  = "built-in"
	ProvisionerKeyNameUserAuth = "user-auth"
	ProvisionerKeyNamePSK      = "psk"
)

View Source

const (
	RoleOwner         string = "owner"
	RoleMember        string = "member"
	RoleTemplateAdmin string = "template-admin"
	RoleUserAdmin     string = "user-admin"
	RoleAuditor       string = "auditor"

	RoleOrganizationAdmin                string = "organization-admin"
	RoleOrganizationMember               string = "organization-member"
	RoleOrganizationAuditor              string = "organization-auditor"
	RoleOrganizationTemplateAdmin        string = "organization-template-admin"
	RoleOrganizationUserAdmin            string = "organization-user-admin"
	RoleOrganizationWorkspaceCreationBan string = "organization-workspace-creation-ban"
)

Ideally this roles would be generated from the rbac/roles.go package.

View Source

const (
	WorkspaceAgentPortShareLevelOwner         WorkspaceAgentPortShareLevel = "owner"
	WorkspaceAgentPortShareLevelAuthenticated WorkspaceAgentPortShareLevel = "authenticated"
	WorkspaceAgentPortShareLevelOrganization  WorkspaceAgentPortShareLevel = "organization"
	WorkspaceAgentPortShareLevelPublic        WorkspaceAgentPortShareLevel = "public"

	WorkspaceAgentPortShareProtocolHTTP  WorkspaceAgentPortShareProtocol = "http"
	WorkspaceAgentPortShareProtocolHTTPS WorkspaceAgentPortShareProtocol = "https"
)

View Source

const DatabaseNotReachable = "database not reachable"

PostgresConnMaxIdleAuto is the value for auto-computing max idle connections based on max open connections.

View Source

var (
	
	AddonsNames = []Addon{
		AddonAIGovernance,
	}

	
	AddonsMap = func() map[Addon]struct{} {
		addonsMap := make(map[Addon]struct{}, len(AddonsNames))
		for _, addon := range AddonsNames {
			addonsMap[addon] = struct{}{}
		}
		return addonsMap
	}()
)

View Source

var (
	
	FeatureNames = []FeatureName{
		FeatureUserLimit,
		FeatureAuditLog,
		FeatureConnectionLog,
		FeatureBrowserOnly,
		FeatureSCIM,
		FeatureTemplateRBAC,
		FeatureHighAvailability,
		FeatureMultipleExternalAuth,
		FeatureExternalProvisionerDaemons,
		FeatureAppearance,
		FeatureAdvancedTemplateScheduling,
		FeatureWorkspaceProxy,
		FeatureUserRoleManagement,
		FeatureExternalTokenEncryption,
		FeatureWorkspaceBatchActions,
		FeatureTaskBatchActions,
		FeatureAccessControl,
		FeatureControlSharedPorts,
		FeatureCustomRoles,
		FeatureMultipleOrganizations,
		FeatureWorkspacePrebuilds,
		FeatureManagedAgentLimit,
		FeatureWorkspaceExternalAgent,
		FeatureAIBridge,
		FeatureBoundary,
		FeatureAIGovernanceUserLimit,
	}

	
	FeatureNamesMap = func() map[FeatureName]struct{} {
		featureNamesMap := make(map[FeatureName]struct{}, len(FeatureNames))
		for _, featureName := range FeatureNames {
			featureNamesMap[featureName] = struct{}{}
		}
		return featureNamesMap
	}()
)

View Source

var AllDaysOfWeek = []string{"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"}

DefaultOrganization is used as a replacement for the default organization.

ExperimentsKnown should include all experiments defined above.

ExperimentsSafe should include all experiments that are safe for users to opt-in to via --experimental='*'. Experiments that are not ready for consumption by all users should not be included here and will be essentially hidden.

Me is used as a replacement for your own ID.

View Source

var PublicAPIKeyScopes = []APIKeyScope{
	APIKeyScopeApiKeyAll,
	APIKeyScopeApiKeyCreate,
	APIKeyScopeApiKeyDelete,
	APIKeyScopeApiKeyRead,
	APIKeyScopeApiKeyUpdate,
	APIKeyScopeCoderAll,
	APIKeyScopeCoderApikeysManageSelf,
	APIKeyScopeCoderApplicationConnect,
	APIKeyScopeCoderTemplatesAuthor,
	APIKeyScopeCoderTemplatesBuild,
	APIKeyScopeCoderWorkspacesAccess,
	APIKeyScopeCoderWorkspacesCreate,
	APIKeyScopeCoderWorkspacesDelete,
	APIKeyScopeCoderWorkspacesOperate,
	APIKeyScopeFileAll,
	APIKeyScopeFileCreate,
	APIKeyScopeFileRead,
	APIKeyScopeOrganizationAll,
	APIKeyScopeOrganizationDelete,
	APIKeyScopeOrganizationRead,
	APIKeyScopeOrganizationUpdate,
	APIKeyScopeTaskAll,
	APIKeyScopeTaskCreate,
	APIKeyScopeTaskDelete,
	APIKeyScopeTaskRead,
	APIKeyScopeTaskUpdate,
	APIKeyScopeTemplateAll,
	APIKeyScopeTemplateCreate,
	APIKeyScopeTemplateDelete,
	APIKeyScopeTemplateRead,
	APIKeyScopeTemplateUpdate,
	APIKeyScopeTemplateUse,
	APIKeyScopeUserReadPersonal,
	APIKeyScopeUserUpdatePersonal,
	APIKeyScopeUserSecretAll,
	APIKeyScopeUserSecretCreate,
	APIKeyScopeUserSecretDelete,
	APIKeyScopeUserSecretRead,
	APIKeyScopeUserSecretUpdate,
	APIKeyScopeWorkspaceAll,
	APIKeyScopeWorkspaceApplicationConnect,
	APIKeyScopeWorkspaceCreate,
	APIKeyScopeWorkspaceDelete,
	APIKeyScopeWorkspaceRead,
	APIKeyScopeWorkspaceSsh,
	APIKeyScopeWorkspaceStart,
	APIKeyScopeWorkspaceStop,
	APIKeyScopeWorkspaceUpdate,
}

PublicAPIKeyScopes lists all public low-level API key scopes.

View Source

var RBACResourceActions = map[RBACResource][]RBACAction{
	ResourceWildcard:                      {},
	ResourceAibridgeInterception:          {ActionCreate, ActionRead, ActionUpdate},
	ResourceApiKey:                        {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
	ResourceAssignOrgRole:                 {ActionAssign, ActionCreate, ActionDelete, ActionRead, ActionUnassign, ActionUpdate},
	ResourceAssignRole:                    {ActionAssign, ActionRead, ActionUnassign},
	ResourceAuditLog:                      {ActionCreate, ActionRead},
	ResourceBoundaryUsage:                 {ActionDelete, ActionRead, ActionUpdate},
	ResourceConnectionLog:                 {ActionRead, ActionUpdate},
	ResourceCryptoKey:                     {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
	ResourceDebugInfo:                     {ActionRead},
	ResourceDeploymentConfig:              {ActionRead, ActionUpdate},
	ResourceDeploymentStats:               {ActionRead},
	ResourceFile:                          {ActionCreate, ActionRead},
	ResourceGroup:                         {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
	ResourceGroupMember:                   {ActionRead},
	ResourceIdpsyncSettings:               {ActionRead, ActionUpdate},
	ResourceInboxNotification:             {ActionCreate, ActionRead, ActionUpdate},
	ResourceLicense:                       {ActionCreate, ActionDelete, ActionRead},
	ResourceNotificationMessage:           {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
	ResourceNotificationPreference:        {ActionRead, ActionUpdate},
	ResourceNotificationTemplate:          {ActionRead, ActionUpdate},
	ResourceOauth2App:                     {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
	ResourceOauth2AppCodeToken:            {ActionCreate, ActionDelete, ActionRead},
	ResourceOauth2AppSecret:               {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
	ResourceOrganization:                  {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
	ResourceOrganizationMember:            {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
	ResourcePrebuiltWorkspace:             {ActionDelete, ActionUpdate},
	ResourceProvisionerDaemon:             {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
	ResourceProvisionerJobs:               {ActionCreate, ActionRead, ActionUpdate},
	ResourceReplicas:                      {ActionRead},
	ResourceSystem:                        {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
	ResourceTailnetCoordinator:            {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
	ResourceTask:                          {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
	ResourceTemplate:                      {ActionCreate, ActionDelete, ActionRead, ActionUpdate, ActionUse, ActionViewInsights},
	ResourceUsageEvent:                    {ActionCreate, ActionRead, ActionUpdate},
	ResourceUser:                          {ActionCreate, ActionDelete, ActionRead, ActionReadPersonal, ActionUpdate, ActionUpdatePersonal},
	ResourceUserSecret:                    {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
	ResourceWebpushSubscription:           {ActionCreate, ActionDelete, ActionRead},
	ResourceWorkspace:                     {ActionApplicationConnect, ActionCreate, ActionCreateAgent, ActionDelete, ActionDeleteAgent, ActionRead, ActionShare, ActionSSH, ActionWorkspaceStart, ActionWorkspaceStop, ActionUpdate, ActionUpdateAgent},
	ResourceWorkspaceAgentDevcontainers:   {ActionCreate},
	ResourceWorkspaceAgentResourceMonitor: {ActionCreate, ActionRead, ActionUpdate},
	ResourceWorkspaceDormant:              {ActionApplicationConnect, ActionCreate, ActionCreateAgent, ActionDelete, ActionDeleteAgent, ActionRead, ActionShare, ActionSSH, ActionWorkspaceStart, ActionWorkspaceStop, ActionUpdate, ActionUpdateAgent},
	ResourceWorkspaceProxy:                {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
}

RBACResourceActions is the mapping of resources to which actions are valid for said resource type.

View Source

var SessionTokenCookie = "coder_session_token"

These cookies are Coder-specific. If a new one is added or changed, the name shouldn't be likely to conflict with any user-application set cookies. Be sure to strip additional cookies in httpapi.StripCoderCookies! SessionTokenCookie represents the name of the cookie or query parameter the API key is stored in. NOTE: This is declared as a var so that we can override it in `develop.sh` if required.

WorkspaceAgentLifecycleOrder is the order in which workspace agent lifecycle states are expected to be reported during the lifetime of the agent process. For instance, the agent can go from starting to ready without reporting timeout or error, but it should not go from ready to starting. This is merely a hint for the agent process, and is not enforced by the server.

BitmapToWeekdays converts a bitmap to a list of weekdays in accordance with the schedule package's rules (see above).

ComputeMaxIdleConns calculates the effective maxIdleConns value. If configuredIdle is "auto", it returns maxOpen/3 with a minimum of 1. If configuredIdle exceeds maxOpen, it returns an error.

DeploymentOptionsWithoutSecrets returns a copy of the OptionSet with secret values omitted.

*

  • DiscoverVarsFiles function loads vars files in a predefined order:
  • 1. terraform.tfvars
  • 2. terraform.tfvars.json
  • 3. *.auto.tfvars
  • 4. *.auto.tfvars.json

DisplayNameValid returns whether the input string is a valid template display name.

ExpectJSONMime is a helper function that will assert the content type of the response is application/json.

GroupNameValid returns whether the input string is a valid group name.

IsConnectionError is a convenience function for checking if the source of an error is due to a 'connection refused', 'no such host', etc.

IsWorkspaceProxies returns true if the cli option is used by workspace proxies.

func JobIsMissingParameterErrorCode(code JobErrorCode) bool

JobIsMissingParameterErrorCode returns whether the error is a missing parameter error. This can indicate to consumers that they should check parameters.

func JobIsMissingRequiredTemplateVariableErrorCode(code JobErrorCode) bool

JobIsMissingRequiredTemplateVariableErrorCode returns whether the error is a missing a required template variable error. This can indicate to consumers that they need to provide required template variables.

NameValid returns whether the input string is a valid name. It is a generic validator for any name (user, workspace, template, role name, etc.).

NormalizeUserRealName normalizes a user name such that it will pass validation by UserRealNameValid. This is done to avoid blocking little Bobby Whitespace from using Coder.

ParseSSHConfigOption parses a single ssh config option into it's key/value pair.

ProvisionerTypeValid accepts string or ProvisionerType for easier usage. Will validate the enum is in the set.

func ReadBodyAsError ¶

ReadBodyAsError reads the response as a codersdk.Response, and wraps it in a codersdk.Error type for easy marshaling.

This will always return an error, so only call it if the response failed your expectations. Usually via status code checking. nolint:staticcheck

func ReservedProvisionerKeyNames() []string

TemplateVersionNameValid returns whether the input string is a valid template version name.

TimezoneOffsetHourWithTime is implemented to match the javascript 'getTimezoneOffset()' function. This is the amount of time between this date evaluated in UTC and evaluated in the 'loc' The trivial case of times being on the same day is: 'time.Now().UTC().Hour() - time.Now().In(loc).Hour()'

UserRealNameValid returns whether the input string is a valid real user name.

UsernameFrom returns a best-effort username from the provided string.

It first attempts to validate the incoming string, which will be returned if it is valid. It then will attempt to extract the username from an email address. If no success happens during these steps, a random username will be returned.

func ValidateNewWorkspaceParameters(richParameters []TemplateVersionParameter, buildParameters []WorkspaceBuildParameter) error
func ValidatePKCECodeChallengeMethod(method string) error

ValidatePKCECodeChallengeMethod validates PKCE code_challenge_method parameter. Per OAuth 2.1, only S256 is supported; plain is rejected for security reasons.

func ValidateWorkspaceBuildParameter(richParameter TemplateVersionParameter, buildParameter *WorkspaceBuildParameter, lastBuildParameter *WorkspaceBuildParameter) error
func ValidateWorkspaceBuildParameters(richParameters []TemplateVersionParameter, buildParameters, lastBuildParameters []WorkspaceBuildParameter) error

WebsocketNetConn wraps websocket.NetConn and returns a context that is tied to the parent context and the lifetime of the conn. Any error during read or write will cancel the context, but not close the conn. Close should be called to release context resources.

WeekdaysToBitmap converts a list of weekdays to a bitmap in accordance with the schedule package's rules. The 0th bit is Monday, ..., the 6th bit is Sunday. The 7th bit is unused.

func WorkspaceDisplayStatus(jobStatus ProvisionerJobStatus, transition WorkspaceTransition) string

WorkspaceDisplayStatus computes a status to display on CLI/UI based on the workspace transition and the status of the provisioner job. This code is in sync with how we compute the status on frontend. Ref: site/src/util/workspace.ts (getWorkspaceStatus)

type ACLAvailable struct {
	Users  []ReducedUser `json:"users"`
	Groups []Group       `json:"groups"`
}

ACLAvailable is a list of users and groups that can be added to a template ACL.

type AIBridgeAnthropicConfig struct {
	BaseURL serpent.String `json:"base_url" typescript:",notnull"`
	Key     serpent.String `json:"key" typescript:",notnull"`
}
type AIBridgeBedrockConfig struct {
	BaseURL         serpent.String `json:"base_url" typescript:",notnull"`
	Region          serpent.String `json:"region" typescript:",notnull"`
	AccessKey       serpent.String `json:"access_key" typescript:",notnull"`
	AccessKeySecret serpent.String `json:"access_key_secret" typescript:",notnull"`
	Model           serpent.String `json:"model" typescript:",notnull"`
	SmallFastModel  serpent.String `json:"small_fast_model" typescript:",notnull"`
}
type AIBridgeConfig struct {
	Enabled             serpent.Bool            `json:"enabled" typescript:",notnull"`
	OpenAI              AIBridgeOpenAIConfig    `json:"openai" typescript:",notnull"`
	Anthropic           AIBridgeAnthropicConfig `json:"anthropic" typescript:",notnull"`
	Bedrock             AIBridgeBedrockConfig   `json:"bedrock" typescript:",notnull"`
	InjectCoderMCPTools serpent.Bool            `json:"inject_coder_mcp_tools" typescript:",notnull"`
	Retention           serpent.Duration        `json:"retention" typescript:",notnull"`
	MaxConcurrency      serpent.Int64           `json:"max_concurrency" typescript:",notnull"`
	RateLimit           serpent.Int64           `json:"rate_limit" typescript:",notnull"`
	StructuredLogging   serpent.Bool            `json:"structured_logging" typescript:",notnull"`
	
	
	CircuitBreakerEnabled          serpent.Bool     `json:"circuit_breaker_enabled" typescript:",notnull"`
	CircuitBreakerFailureThreshold serpent.Int64    `json:"circuit_breaker_failure_threshold" typescript:",notnull"`
	CircuitBreakerInterval         serpent.Duration `json:"circuit_breaker_interval" typescript:",notnull"`
	CircuitBreakerTimeout          serpent.Duration `json:"circuit_breaker_timeout" typescript:",notnull"`
	CircuitBreakerMaxRequests      serpent.Int64    `json:"circuit_breaker_max_requests" typescript:",notnull"`
}
type AIBridgeInterception struct {
	ID          uuid.UUID            `json:"id" format:"uuid"`
	APIKeyID    *string              `json:"api_key_id"`
	Initiator   MinimalUser          `json:"initiator"`
	Provider    string               `json:"provider"`
	Model       string               `json:"model"`
	Client      *string              `json:"client"`
	Metadata    map[string]any       `json:"metadata"`
	StartedAt   time.Time            `json:"started_at" format:"date-time"`
	EndedAt     *time.Time           `json:"ended_at" format:"date-time"`
	TokenUsages []AIBridgeTokenUsage `json:"token_usages"`
	UserPrompts []AIBridgeUserPrompt `json:"user_prompts"`
	ToolUsages  []AIBridgeToolUsage  `json:"tool_usages"`
}
type AIBridgeListInterceptionsFilter struct {
	
	
	Pagination Pagination `json:"pagination,omitempty"`

	
	Initiator     string    `json:"initiator,omitempty"`
	StartedBefore time.Time `json:"started_before,omitempty" format:"date-time"`
	StartedAfter  time.Time `json:"started_after,omitempty" format:"date-time"`
	Provider      string    `json:"provider,omitempty"`
	Model         string    `json:"model,omitempty"`
	Client        string    `json:"client,omitempty"`

	FilterQuery string `json:"q,omitempty"`
}

@typescript-ignore AIBridgeListInterceptionsFilter

type AIBridgeListInterceptionsResponse struct {
	Count   int64                  `json:"count"`
	Results []AIBridgeInterception `json:"results"`
}
type AIBridgeOpenAIConfig struct {
	BaseURL serpent.String `json:"base_url" typescript:",notnull"`
	Key     serpent.String `json:"key" typescript:",notnull"`
}
type AIBridgeProxyConfig struct {
	Enabled         serpent.Bool        `json:"enabled" typescript:",notnull"`
	ListenAddr      serpent.String      `json:"listen_addr" typescript:",notnull"`
	CertFile        serpent.String      `json:"cert_file" typescript:",notnull"`
	KeyFile         serpent.String      `json:"key_file" typescript:",notnull"`
	DomainAllowlist serpent.StringArray `json:"domain_allowlist" typescript:",notnull"`
	UpstreamProxy   serpent.String      `json:"upstream_proxy" typescript:",notnull"`
	UpstreamProxyCA serpent.String      `json:"upstream_proxy_ca" typescript:",notnull"`
}
type AIBridgeTokenUsage struct {
	ID                 uuid.UUID      `json:"id" format:"uuid"`
	InterceptionID     uuid.UUID      `json:"interception_id" format:"uuid"`
	ProviderResponseID string         `json:"provider_response_id"`
	InputTokens        int64          `json:"input_tokens"`
	OutputTokens       int64          `json:"output_tokens"`
	Metadata           map[string]any `json:"metadata"`
	CreatedAt          time.Time      `json:"created_at" format:"date-time"`
}
type AIBridgeToolUsage struct {
	ID                 uuid.UUID      `json:"id" format:"uuid"`
	InterceptionID     uuid.UUID      `json:"interception_id" format:"uuid"`
	ProviderResponseID string         `json:"provider_response_id"`
	ServerURL          string         `json:"server_url"`
	Tool               string         `json:"tool"`
	Input              string         `json:"input"`
	Injected           bool           `json:"injected"`
	InvocationError    string         `json:"invocation_error"`
	Metadata           map[string]any `json:"metadata"`
	CreatedAt          time.Time      `json:"created_at" format:"date-time"`
}
type AIBridgeUserPrompt struct {
	ID                 uuid.UUID      `json:"id" format:"uuid"`
	InterceptionID     uuid.UUID      `json:"interception_id" format:"uuid"`
	ProviderResponseID string         `json:"provider_response_id"`
	Prompt             string         `json:"prompt"`
	Metadata           map[string]any `json:"metadata"`
	CreatedAt          time.Time      `json:"created_at" format:"date-time"`
}
type AIConfig struct {
	BridgeConfig      AIBridgeConfig      `json:"bridge,omitempty"`
	BridgeProxyConfig AIBridgeProxyConfig `json:"aibridge_proxy,omitempty"`
}
type APIAllowListTarget struct {
	Type RBACResource `json:"type"`
	ID   string       `json:"id"`
}

APIAllowListTarget represents a single allow-list entry using the canonical string form "<resource_type>:<id>". The wildcard symbol "*" is treated as a permissive match for either side.

func AllowAllTarget() APIAllowListTarget
func AllowTypeTarget(r RBACResource) APIAllowListTarget

MarshalJSON encodes as a JSON string: "<type>:<id>".

String returns the canonical string representation "<type>:<id>" with "*" wildcards.

UnmarshalJSON decodes from a JSON string: "<type>:<id>".

type APIKey struct {
	ID              string               `json:"id" validate:"required"`
	UserID          uuid.UUID            `json:"user_id" validate:"required" format:"uuid"`
	LastUsed        time.Time            `json:"last_used" validate:"required" format:"date-time"`
	ExpiresAt       time.Time            `json:"expires_at" validate:"required" format:"date-time"`
	CreatedAt       time.Time            `json:"created_at" validate:"required" format:"date-time"`
	UpdatedAt       time.Time            `json:"updated_at" validate:"required" format:"date-time"`
	LoginType       LoginType            `json:"login_type" validate:"required" enums:"password,github,oidc,token"`
	Scope           APIKeyScope          `json:"scope" enums:"all,application_connect"` 
	Scopes          []APIKeyScope        `json:"scopes"`
	TokenName       string               `json:"token_name" validate:"required"`
	LifetimeSeconds int64                `json:"lifetime_seconds" validate:"required"`
	AllowList       []APIAllowListTarget `json:"allow_list"`
}

APIKey: do not ever return the HashedSecret

const (
	
	APIKeyScopeAll APIKeyScope = "all"
	
	APIKeyScopeApplicationConnect                  APIKeyScope = "application_connect"
	APIKeyScopeAibridgeInterceptionAll             APIKeyScope = "aibridge_interception:*"
	APIKeyScopeAibridgeInterceptionCreate          APIKeyScope = "aibridge_interception:create"
	APIKeyScopeAibridgeInterceptionRead            APIKeyScope = "aibridge_interception:read"
	APIKeyScopeAibridgeInterceptionUpdate          APIKeyScope = "aibridge_interception:update"
	APIKeyScopeApiKeyAll                           APIKeyScope = "api_key:*"
	APIKeyScopeApiKeyCreate                        APIKeyScope = "api_key:create"
	APIKeyScopeApiKeyDelete                        APIKeyScope = "api_key:delete"
	APIKeyScopeApiKeyRead                          APIKeyScope = "api_key:read"
	APIKeyScopeApiKeyUpdate                        APIKeyScope = "api_key:update"
	APIKeyScopeAssignOrgRoleAll                    APIKeyScope = "assign_org_role:*"
	APIKeyScopeAssignOrgRoleAssign                 APIKeyScope = "assign_org_role:assign"
	APIKeyScopeAssignOrgRoleCreate                 APIKeyScope = "assign_org_role:create"
	APIKeyScopeAssignOrgRoleDelete                 APIKeyScope = "assign_org_role:delete"
	APIKeyScopeAssignOrgRoleRead                   APIKeyScope = "assign_org_role:read"
	APIKeyScopeAssignOrgRoleUnassign               APIKeyScope = "assign_org_role:unassign"
	APIKeyScopeAssignOrgRoleUpdate                 APIKeyScope = "assign_org_role:update"
	APIKeyScopeAssignRoleAll                       APIKeyScope = "assign_role:*"
	APIKeyScopeAssignRoleAssign                    APIKeyScope = "assign_role:assign"
	APIKeyScopeAssignRoleRead                      APIKeyScope = "assign_role:read"
	APIKeyScopeAssignRoleUnassign                  APIKeyScope = "assign_role:unassign"
	APIKeyScopeAuditLogAll                         APIKeyScope = "audit_log:*"
	APIKeyScopeAuditLogCreate                      APIKeyScope = "audit_log:create"
	APIKeyScopeAuditLogRead                        APIKeyScope = "audit_log:read"
	APIKeyScopeBoundaryUsageAll                    APIKeyScope = "boundary_usage:*"
	APIKeyScopeBoundaryUsageDelete                 APIKeyScope = "boundary_usage:delete"
	APIKeyScopeBoundaryUsageRead                   APIKeyScope = "boundary_usage:read"
	APIKeyScopeBoundaryUsageUpdate                 APIKeyScope = "boundary_usage:update"
	APIKeyScopeCoderAll                            APIKeyScope = "coder:all"
	APIKeyScopeCoderApikeysManageSelf              APIKeyScope = "coder:apikeys.manage_self"
	APIKeyScopeCoderApplicationConnect             APIKeyScope = "coder:application_connect"
	APIKeyScopeCoderTemplatesBuild                 APIKeyScope = "coder:templates.build"
	APIKeyScopeCoderWorkspacesAccess               APIKeyScope = "coder:workspaces.access"
	APIKeyScopeCoderWorkspacesCreate               APIKeyScope = "coder:workspaces.create"
	APIKeyScopeCoderWorkspacesDelete               APIKeyScope = "coder:workspaces.delete"
	APIKeyScopeCoderWorkspacesOperate              APIKeyScope = "coder:workspaces.operate"
	APIKeyScopeConnectionLogAll                    APIKeyScope = "connection_log:*"
	APIKeyScopeConnectionLogRead                   APIKeyScope = "connection_log:read"
	APIKeyScopeConnectionLogUpdate                 APIKeyScope = "connection_log:update"
	APIKeyScopeCryptoKeyAll                        APIKeyScope = "crypto_key:*"
	APIKeyScopeCryptoKeyCreate                     APIKeyScope = "crypto_key:create"
	APIKeyScopeCryptoKeyDelete                     APIKeyScope = "crypto_key:delete"
	APIKeyScopeCryptoKeyRead                       APIKeyScope = "crypto_key:read"
	APIKeyScopeCryptoKeyUpdate                     APIKeyScope = "crypto_key:update"
	APIKeyScopeDebugInfoAll                        APIKeyScope = "debug_info:*"
	APIKeyScopeDebugInfoRead                       APIKeyScope = "debug_info:read"
	APIKeyScopeDeploymentConfigAll                 APIKeyScope = "deployment_config:*"
	APIKeyScopeDeploymentConfigRead                APIKeyScope = "deployment_config:read"
	APIKeyScopeDeploymentConfigUpdate              APIKeyScope = "deployment_config:update"
	APIKeyScopeDeploymentStatsAll                  APIKeyScope = "deployment_stats:*"
	APIKeyScopeDeploymentStatsRead                 APIKeyScope = "deployment_stats:read"
	APIKeyScopeFileAll                             APIKeyScope = "file:*"
	APIKeyScopeFileCreate                          APIKeyScope = "file:create"
	APIKeyScopeFileRead                            APIKeyScope = "file:read"
	APIKeyScopeGroupAll                            APIKeyScope = "group:*"
	APIKeyScopeGroupCreate                         APIKeyScope = "group:create"
	APIKeyScopeGroupDelete                         APIKeyScope = "group:delete"
	APIKeyScopeGroupRead                           APIKeyScope = "group:read"
	APIKeyScopeGroupUpdate                         APIKeyScope = "group:update"
	APIKeyScopeGroupMemberAll                      APIKeyScope = "group_member:*"
	APIKeyScopeGroupMemberRead                     APIKeyScope = "group_member:read"
	APIKeyScopeIdpsyncSettingsAll                  APIKeyScope = "idpsync_settings:*"
	APIKeyScopeIdpsyncSettingsRead                 APIKeyScope = "idpsync_settings:read"
	APIKeyScopeIdpsyncSettingsUpdate               APIKeyScope = "idpsync_settings:update"
	APIKeyScopeInboxNotificationAll                APIKeyScope = "inbox_notification:*"
	APIKeyScopeInboxNotificationCreate             APIKeyScope = "inbox_notification:create"
	APIKeyScopeInboxNotificationRead               APIKeyScope = "inbox_notification:read"
	APIKeyScopeInboxNotificationUpdate             APIKeyScope = "inbox_notification:update"
	APIKeyScopeLicenseAll                          APIKeyScope = "license:*"
	APIKeyScopeLicenseCreate                       APIKeyScope = "license:create"
	APIKeyScopeLicenseDelete                       APIKeyScope = "license:delete"
	APIKeyScopeLicenseRead                         APIKeyScope = "license:read"
	APIKeyScopeNotificationMessageAll              APIKeyScope = "notification_message:*"
	APIKeyScopeNotificationMessageCreate           APIKeyScope = "notification_message:create"
	APIKeyScopeNotificationMessageDelete           APIKeyScope = "notification_message:delete"
	APIKeyScopeNotificationMessageRead             APIKeyScope = "notification_message:read"
	APIKeyScopeNotificationMessageUpdate           APIKeyScope = "notification_message:update"
	APIKeyScopeNotificationPreferenceAll           APIKeyScope = "notification_preference:*"
	APIKeyScopeNotificationPreferenceRead          APIKeyScope = "notification_preference:read"
	APIKeyScopeNotificationPreferenceUpdate        APIKeyScope = "notification_preference:update"
	APIKeyScopeNotificationTemplateAll             APIKeyScope = "notification_template:*"
	APIKeyScopeNotificationTemplateRead            APIKeyScope = "notification_template:read"
	APIKeyScopeNotificationTemplateUpdate          APIKeyScope = "notification_template:update"
	APIKeyScopeOauth2AppAll                        APIKeyScope = "oauth2_app:*"
	APIKeyScopeOauth2AppCreate                     APIKeyScope = "oauth2_app:create"
	APIKeyScopeOauth2AppDelete                     APIKeyScope = "oauth2_app:delete"
	APIKeyScopeOauth2AppRead                       APIKeyScope = "oauth2_app:read"
	APIKeyScopeOauth2AppUpdate                     APIKeyScope = "oauth2_app:update"
	APIKeyScopeOauth2AppCodeTokenAll               APIKeyScope = "oauth2_app_code_token:*"
	APIKeyScopeOauth2AppCodeTokenCreate            APIKeyScope = "oauth2_app_code_token:create"
	APIKeyScopeOauth2AppCodeTokenDelete            APIKeyScope = "oauth2_app_code_token:delete"
	APIKeyScopeOauth2AppCodeTokenRead              APIKeyScope = "oauth2_app_code_token:read"
	APIKeyScopeOauth2AppSecretAll                  APIKeyScope = "oauth2_app_secret:*"
	APIKeyScopeOauth2AppSecretCreate               APIKeyScope = "oauth2_app_secret:create"
	APIKeyScopeOauth2AppSecretDelete               APIKeyScope = "oauth2_app_secret:delete"
	APIKeyScopeOauth2AppSecretRead                 APIKeyScope = "oauth2_app_secret:read"
	APIKeyScopeOauth2AppSecretUpdate               APIKeyScope = "oauth2_app_secret:update"
	APIKeyScopeOrganizationAll                     APIKeyScope = "organization:*"
	APIKeyScopeOrganizationCreate                  APIKeyScope = "organization:create"
	APIKeyScopeOrganizationDelete                  APIKeyScope = "organization:delete"
	APIKeyScopeOrganizationRead                    APIKeyScope = "organization:read"
	APIKeyScopeOrganizationUpdate                  APIKeyScope = "organization:update"
	APIKeyScopeOrganizationMemberAll               APIKeyScope = "organization_member:*"
	APIKeyScopeOrganizationMemberCreate            APIKeyScope = "organization_member:create"
	APIKeyScopeOrganizationMemberDelete            APIKeyScope = "organization_member:delete"
	APIKeyScopeOrganizationMemberRead              APIKeyScope = "organization_member:read"
	APIKeyScopeOrganizationMemberUpdate            APIKeyScope = "organization_member:update"
	APIKeyScopePrebuiltWorkspaceAll                APIKeyScope = "prebuilt_workspace:*"
	APIKeyScopePrebuiltWorkspaceDelete             APIKeyScope = "prebuilt_workspace:delete"
	APIKeyScopePrebuiltWorkspaceUpdate             APIKeyScope = "prebuilt_workspace:update"
	APIKeyScopeProvisionerDaemonAll                APIKeyScope = "provisioner_daemon:*"
	APIKeyScopeProvisionerDaemonCreate             APIKeyScope = "provisioner_daemon:create"
	APIKeyScopeProvisionerDaemonDelete             APIKeyScope = "provisioner_daemon:delete"
	APIKeyScopeProvisionerDaemonRead               APIKeyScope = "provisioner_daemon:read"
	APIKeyScopeProvisionerDaemonUpdate             APIKeyScope = "provisioner_daemon:update"
	APIKeyScopeProvisionerJobsAll                  APIKeyScope = "provisioner_jobs:*"
	APIKeyScopeProvisionerJobsCreate               APIKeyScope = "provisioner_jobs:create"
	APIKeyScopeProvisionerJobsRead                 APIKeyScope = "provisioner_jobs:read"
	APIKeyScopeProvisionerJobsUpdate               APIKeyScope = "provisioner_jobs:update"
	APIKeyScopeReplicasAll                         APIKeyScope = "replicas:*"
	APIKeyScopeReplicasRead                        APIKeyScope = "replicas:read"
	APIKeyScopeSystemAll                           APIKeyScope = "system:*"
	APIKeyScopeSystemCreate                        APIKeyScope = "system:create"
	APIKeyScopeSystemDelete                        APIKeyScope = "system:delete"
	APIKeyScopeSystemRead                          APIKeyScope = "system:read"
	APIKeyScopeSystemUpdate                        APIKeyScope = "system:update"
	APIKeyScopeTailnetCoordinatorAll               APIKeyScope = "tailnet_coordinator:*"
	APIKeyScopeTailnetCoordinatorCreate            APIKeyScope = "tailnet_coordinator:create"
	APIKeyScopeTailnetCoordinatorDelete            APIKeyScope = "tailnet_coordinator:delete"
	APIKeyScopeTailnetCoordinatorRead              APIKeyScope = "tailnet_coordinator:read"
	APIKeyScopeTailnetCoordinatorUpdate            APIKeyScope = "tailnet_coordinator:update"
	APIKeyScopeTaskAll                             APIKeyScope = "task:*"
	APIKeyScopeTaskCreate                          APIKeyScope = "task:create"
	APIKeyScopeTaskDelete                          APIKeyScope = "task:delete"
	APIKeyScopeTaskRead                            APIKeyScope = "task:read"
	APIKeyScopeTaskUpdate                          APIKeyScope = "task:update"
	APIKeyScopeTemplateAll                         APIKeyScope = "template:*"
	APIKeyScopeTemplateCreate                      APIKeyScope = "template:create"
	APIKeyScopeTemplateDelete                      APIKeyScope = "template:delete"
	APIKeyScopeTemplateRead                        APIKeyScope = "template:read"
	APIKeyScopeTemplateUpdate                      APIKeyScope = "template:update"
	APIKeyScopeTemplateUse                         APIKeyScope = "template:use"
	APIKeyScopeTemplateViewInsights                APIKeyScope = "template:view_insights"
	APIKeyScopeUsageEventAll                       APIKeyScope = "usage_event:*"
	APIKeyScopeUsageEventCreate                    APIKeyScope = "usage_event:create"
	APIKeyScopeUsageEventRead                      APIKeyScope = "usage_event:read"
	APIKeyScopeUsageEventUpdate                    APIKeyScope = "usage_event:update"
	APIKeyScopeUserAll                             APIKeyScope = "user:*"
	APIKeyScopeUserCreate                          APIKeyScope = "user:create"
	APIKeyScopeUserDelete                          APIKeyScope = "user:delete"
	APIKeyScopeUserRead                            APIKeyScope = "user:read"
	APIKeyScopeUserReadPersonal                    APIKeyScope = "user:read_personal"
	APIKeyScopeUserUpdate                          APIKeyScope = "user:update"
	APIKeyScopeUserUpdatePersonal                  APIKeyScope = "user:update_personal"
	APIKeyScopeUserSecretAll                       APIKeyScope = "user_secret:*"
	APIKeyScopeUserSecretCreate                    APIKeyScope = "user_secret:create"
	APIKeyScopeUserSecretDelete                    APIKeyScope = "user_secret:delete"
	APIKeyScopeUserSecretRead                      APIKeyScope = "user_secret:read"
	APIKeyScopeUserSecretUpdate                    APIKeyScope = "user_secret:update"
	APIKeyScopeWebpushSubscriptionAll              APIKeyScope = "webpush_subscription:*"
	APIKeyScopeWebpushSubscriptionCreate           APIKeyScope = "webpush_subscription:create"
	APIKeyScopeWebpushSubscriptionDelete           APIKeyScope = "webpush_subscription:delete"
	APIKeyScopeWebpushSubscriptionRead             APIKeyScope = "webpush_subscription:read"
	APIKeyScopeWorkspaceAll                        APIKeyScope = "workspace:*"
	APIKeyScopeWorkspaceApplicationConnect         APIKeyScope = "workspace:application_connect"
	APIKeyScopeWorkspaceCreate                     APIKeyScope = "workspace:create"
	APIKeyScopeWorkspaceCreateAgent                APIKeyScope = "workspace:create_agent"
	APIKeyScopeWorkspaceDelete                     APIKeyScope = "workspace:delete"
	APIKeyScopeWorkspaceDeleteAgent                APIKeyScope = "workspace:delete_agent"
	APIKeyScopeWorkspaceRead                       APIKeyScope = "workspace:read"
	APIKeyScopeWorkspaceShare                      APIKeyScope = "workspace:share"
	APIKeyScopeWorkspaceSsh                        APIKeyScope = "workspace:ssh"
	APIKeyScopeWorkspaceStart                      APIKeyScope = "workspace:start"
	APIKeyScopeWorkspaceStop                       APIKeyScope = "workspace:stop"
	APIKeyScopeWorkspaceUpdate                     APIKeyScope = "workspace:update"
	APIKeyScopeWorkspaceUpdateAgent                APIKeyScope = "workspace:update_agent"
	APIKeyScopeWorkspaceAgentDevcontainersAll      APIKeyScope = "workspace_agent_devcontainers:*"
	APIKeyScopeWorkspaceAgentDevcontainersCreate   APIKeyScope = "workspace_agent_devcontainers:create"
	APIKeyScopeWorkspaceAgentResourceMonitorAll    APIKeyScope = "workspace_agent_resource_monitor:*"
	APIKeyScopeWorkspaceAgentResourceMonitorCreate APIKeyScope = "workspace_agent_resource_monitor:create"
	APIKeyScopeWorkspaceAgentResourceMonitorRead   APIKeyScope = "workspace_agent_resource_monitor:read"
	APIKeyScopeWorkspaceAgentResourceMonitorUpdate APIKeyScope = "workspace_agent_resource_monitor:update"
	APIKeyScopeWorkspaceDormantAll                 APIKeyScope = "workspace_dormant:*"
	APIKeyScopeWorkspaceDormantApplicationConnect  APIKeyScope = "workspace_dormant:application_connect"
	APIKeyScopeWorkspaceDormantCreate              APIKeyScope = "workspace_dormant:create"
	APIKeyScopeWorkspaceDormantCreateAgent         APIKeyScope = "workspace_dormant:create_agent"
	APIKeyScopeWorkspaceDormantDelete              APIKeyScope = "workspace_dormant:delete"
	APIKeyScopeWorkspaceDormantDeleteAgent         APIKeyScope = "workspace_dormant:delete_agent"
	APIKeyScopeWorkspaceDormantRead                APIKeyScope = "workspace_dormant:read"
	APIKeyScopeWorkspaceDormantShare               APIKeyScope = "workspace_dormant:share"
	APIKeyScopeWorkspaceDormantSsh                 APIKeyScope = "workspace_dormant:ssh"
	APIKeyScopeWorkspaceDormantStart               APIKeyScope = "workspace_dormant:start"
	APIKeyScopeWorkspaceDormantStop                APIKeyScope = "workspace_dormant:stop"
	APIKeyScopeWorkspaceDormantUpdate              APIKeyScope = "workspace_dormant:update"
	APIKeyScopeWorkspaceDormantUpdateAgent         APIKeyScope = "workspace_dormant:update_agent"
	APIKeyScopeWorkspaceProxyAll                   APIKeyScope = "workspace_proxy:*"
	APIKeyScopeWorkspaceProxyCreate                APIKeyScope = "workspace_proxy:create"
	APIKeyScopeWorkspaceProxyDelete                APIKeyScope = "workspace_proxy:delete"
	APIKeyScopeWorkspaceProxyRead                  APIKeyScope = "workspace_proxy:read"
	APIKeyScopeWorkspaceProxyUpdate                APIKeyScope = "workspace_proxy:update"
)
type APIKeyWithOwner struct {
	APIKey
	Username string `json:"username"`
}
type AddLicenseRequest struct {
	License string `json:"license" validate:"required"`
}

Addon represents a grouping of features used for additional license SKUs. It is complementary to FeatureSet and similar in implementation, allowing features to be grouped together dynamically. Unlike FeatureSet, licenses can have multiple addons. This also means that entitlements don't require reissuing when new features are added to an addon.

const (
	AddonAIGovernance Addon = "ai_governance"
)
func (a Addon) Features() []FeatureName

Features returns all the features that are part of the addon.

Humanize returns the addon name in a human-readable format.

func (a Addon) ValidateDependencies(features map[FeatureName]Feature) []string

ValidateDependencies validates the dependencies of the addon and returns a list of errors for the missing dependencies.

type AgentConnectionTiming struct {
	StartedAt          time.Time   `json:"started_at" format:"date-time"`
	EndedAt            time.Time   `json:"ended_at" format:"date-time"`
	Stage              TimingStage `json:"stage"`
	WorkspaceAgentID   string      `json:"workspace_agent_id"`
	WorkspaceAgentName string      `json:"workspace_agent_name"`
}
type AgentScriptTiming struct {
	StartedAt          time.Time   `json:"started_at" format:"date-time"`
	EndedAt            time.Time   `json:"ended_at" format:"date-time"`
	ExitCode           int32       `json:"exit_code"`
	Stage              TimingStage `json:"stage"`
	Status             string      `json:"status"`
	DisplayName        string      `json:"display_name"`
	WorkspaceAgentID   string      `json:"workspace_agent_id"`
	WorkspaceAgentName string      `json:"workspace_agent_name"`
}
type AgentStatsReportRequest struct{}

AgentStatsReportRequest is a WebSocket request by coderd to the agent for stats. @typescript-ignore AgentStatsReportRequest

type AgentStatsReportResponse struct {
	NumConns int64 `json:"num_comms"`
	
	RxBytes int64 `json:"rx_bytes"`
	
	TxBytes int64 `json:"tx_bytes"`
}

AgentStatsReportResponse is returned for each report request by the agent.

const (
	AgentSubsystemEnvbox     AgentSubsystem = "envbox"
	AgentSubsystemEnvbuilder AgentSubsystem = "envbuilder"
	AgentSubsystemExectrace  AgentSubsystem = "exectrace"
)
type AppHostResponse struct {
	
	Host string `json:"host"`
}
type AppearanceConfig struct {
	ApplicationName string `json:"application_name"`
	LogoURL         string `json:"logo_url"`
	DocsURL         string `json:"docs_url"`
	
	SupportLinks        []LinkConfig   `json:"support_links,omitempty"`
}
type ArchiveTemplateVersionsRequest struct {
	
	
	All bool `json:"all"`
}
type ArchiveTemplateVersionsResponse struct {
	TemplateID  uuid.UUID   `json:"template_id" format:"uuid"`
	ArchivedIDs []uuid.UUID `json:"archived_ids"`
}
type AssignableRoles struct {
	Role       `table:"r,recursive_inline"`
	Assignable bool `json:"assignable" table:"assignable"`
	
	BuiltIn bool `json:"built_in" table:"built_in"`
}
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"
	AuditActionRequestPasswordReset AuditAction = "request_password_reset"
	
	
	AuditActionConnect AuditAction = "connect"
	
	
	AuditActionDisconnect AuditAction = "disconnect"
	
	
	AuditActionOpen AuditAction = "open"
	
	AuditActionClose AuditAction = "close"
)
type AuditDiffField struct {
	Old    any  `json:"old,omitempty"`
	New    any  `json:"new,omitempty"`
	Secret bool `json:"secret"`
}
type AuditLog struct {
	ID           uuid.UUID    `json:"id" format:"uuid"`
	RequestID    uuid.UUID    `json:"request_id" format:"uuid"`
	Time         time.Time    `json:"time" format:"date-time"`
	IP           netip.Addr   `json:"ip"`
	UserAgent    string       `json:"user_agent"`
	ResourceType ResourceType `json:"resource_type"`
	ResourceID   uuid.UUID    `json:"resource_id" format:"uuid"`
	
	ResourceTarget   string          `json:"resource_target"`
	ResourceIcon     string          `json:"resource_icon"`
	Action           AuditAction     `json:"action"`
	Diff             AuditDiff       `json:"diff"`
	StatusCode       int32           `json:"status_code"`
	AdditionalFields json.RawMessage `json:"additional_fields" swaggertype:"object"`
	Description      string          `json:"description"`
	ResourceLink     string          `json:"resource_link"`
	IsDeleted        bool            `json:"is_deleted"`

	
	OrganizationID uuid.UUID `json:"organization_id" format:"uuid"`

	Organization *MinimalOrganization `json:"organization,omitempty"`

	User *User `json:"user"`
}
type AuditLogResponse struct {
	AuditLogs []AuditLog `json:"audit_logs"`
	Count     int64      `json:"count"`
}
type AuditLogsRequest struct {
	SearchQuery string `json:"q,omitempty"`
}
type AuthMethod struct {
	Enabled bool `json:"enabled"`
}
type AuthMethods struct {
	TermsOfServiceURL string           `json:"terms_of_service_url,omitempty"`
	Password          AuthMethod       `json:"password"`
	Github            GithubAuthMethod `json:"github"`
	OIDC              OIDCAuthMethod   `json:"oidc"`
}

AuthMethods contains authentication method information like whether they are enabled or not or custom text, etc.

type AuthorizationCheck struct {
	
	
	
	
	
	
	
	Object AuthorizationObject `json:"object"`
	Action RBACAction          `json:"action" enums:"create,read,update,delete"`
}

AuthorizationCheck is used to check if the currently authenticated user (or the specified user) can do a given action to a given set of objects.

@Description AuthorizationCheck is used to check if the currently authenticated user (or the specified user) can do a given action to a given set of objects.

type AuthorizationObject struct {
	
	
	ResourceType RBACResource `json:"resource_type"`
	
	OwnerID string `json:"owner_id,omitempty"`
	
	OrganizationID string `json:"organization_id,omitempty"`
	
	
	
	
	
	ResourceID string `json:"resource_id,omitempty"`
	
	
	AnyOrgOwner bool `json:"any_org,omitempty"`
}

AuthorizationObject can represent a "set" of objects, such as: all workspaces in an organization, all workspaces owned by me, all workspaces across the entire product.

@Description AuthorizationObject can represent a "set" of objects, such as: all workspaces in an organization, all workspaces owned by me, @Description all workspaces across the entire product.

type AuthorizationRequest struct {
	
	
	
	
	
	Checks map[string]AuthorizationCheck `json:"checks"`
}

AuthorizationRequest is a structure instead of a map because go-playground/validate can only validate structs. If you attempt to pass a map into `httpapi.Read`, you will get an invalid type error.

const (
	AutomaticUpdatesAlways AutomaticUpdates = "always"
	AutomaticUpdatesNever  AutomaticUpdates = "never"
)
type AvailableExperiments struct {
	Safe []Experiment `json:"safe"`
}

AvailableExperiments is an expandable type that returns all safe experiments available to be used with a deployment.

type BannerConfig struct {
}
type BuildInfoResponse struct {
	
	
	ExternalURL string `json:"external_url"`
	
	Version string `json:"version"`
	
	
	
	DashboardURL string `json:"dashboard_url"`
	
	Telemetry bool `json:"telemetry"`

	WorkspaceProxy bool `json:"workspace_proxy"`

	
	
	AgentAPIVersion string `json:"agent_api_version"`
	
	ProvisionerAPIVersion string `json:"provisioner_api_version"`

	
	
	UpgradeMessage string `json:"upgrade_message"`

	
	DeploymentID string `json:"deployment_id"`

	
	WebPushPublicKey string `json:"webpush_public_key,omitempty"`
}

BuildInfoResponse contains build information for this instance of Coder.

CanonicalVersion trims build information from the version. E.g. 'v0.7.4-devel+11573034' -> 'v0.7.4'.

const (
	
	
	BuildReasonInitiator BuildReason = "initiator"
	
	
	BuildReasonAutostart BuildReason = "autostart"
	
	
	BuildReasonAutostop BuildReason = "autostop"
	
	
	BuildReasonDormancy BuildReason = "dormancy"
	
	BuildReasonDashboard BuildReason = "dashboard"
	
	BuildReasonCLI BuildReason = "cli"
	
	BuildReasonSSHConnection BuildReason = "ssh_connection"
	
	BuildReasonVSCodeConnection BuildReason = "vscode_connection"
	
	BuildReasonJetbrainsConnection BuildReason = "jetbrains_connection"
	
	
	BuildReasonTaskAutoPause BuildReason = "task_auto_pause"
	
	
	BuildReasonTaskManualPause BuildReason = "task_manual_pause"
	
	
	BuildReasonTaskResume BuildReason = "task_resume"
)
const (
	CORSBehaviorSimple   CORSBehavior = "simple"
	CORSBehaviorPassthru CORSBehavior = "passthru"
)
type CancelWorkspaceBuildParams struct {
	
	ExpectStatus CancelWorkspaceBuildStatus `json:"expect_status,omitempty"`
}
type CancelWorkspaceBuildStatus string
const (
	CancelWorkspaceBuildStatusRunning CancelWorkspaceBuildStatus = "running"
	CancelWorkspaceBuildStatusPending CancelWorkspaceBuildStatus = "pending"
)
type ChangePasswordWithOneTimePasscodeRequest struct {
	Email           string `json:"email" validate:"required,email" format:"email"`
	Password        string `json:"password" validate:"required"`
	OneTimePasscode string `json:"one_time_passcode" validate:"required"`
}

ChangePasswordWithOneTimePasscodeRequest enables callers to change their password when they've forgotten it.

Client is an HTTP caller for methods to the Coder API. @typescript-ignore Client

func New(serverURL *url.URL, opts ...ClientOption) *Client

New creates a Coder client for the provided URL.

AIBridgeListInterceptions returns AI Bridge interceptions with the given filter.

APIKeyByID returns the api key by id.

APIKeyByName returns the api key by name.

AppHost returns the site-wide application wildcard hostname e.g. "*--apps.coder.com". Apps are accessible at: "<app-name>--<agent-name>--<workspace-name>--<username><app-host>", e.g. "my-app--agent--workspace--username--apps.coder.com".

If the app host is not set, the response will contain an empty string.

Appearance returns the configuration that modifies the visual display of the dashboard.

AuditLogs retrieves audit logs from the given page.

AuthCheck allows the authenticated user to check if they have the given permissions to a set of resources.

AuthMethods returns types of authentication available to the user.

BuildInfo returns build information for this instance of Coder.

CancelTemplateVersion marks a template version job as canceled.

CancelTemplateVersionDryRun marks a template version dry-run job as canceled.

CancelWorkspaceBuild marks a workspace build job as canceled.

ConvertLoginType will send a request to convert the user from password based authentication to oauth based. The response has the oauth state code to use in the oauth flow.

ConvertUserLoginType will send a request to convert the user from password based authentication to oauth based. The response has the oauth state code to use in the oauth flow.

CreateAPIKey generates an API key for the user ID provided. CreateToken should be used over CreateAPIKey. CreateToken allows better tracking of the token's usage and allows for custom expiration. Only use CreateAPIKey if you want to emulate the session created for a browser like login.

CreateFirstUser attempts to create the first user on a Coder deployment. This initial user has superadmin privileges. If >0 users exist, this request will fail.

CreateOrganization creates an organization and adds the user making the request as an owner.

CreateOrganizationRole will create a custom organization role

CreateProvisionerKey creates a new provisioner key for an organization.

CreateTask creates a new task.

CreateTemplate creates a new template inside an organization.

CreateTemplateVersion processes source-code and optionally associates the version with a template. Executing without a template is useful for validating source-code.

CreateTemplateVersionDryRun begins a dry-run provisioner job against the given template version with the given parameter values.

CreateTestAuditLog creates a fake audit log. Only owners of the organization can perform this action. It's used for testing purposes.

CreateToken generates an API key for the user ID provided with custom expiration. These tokens can be used for long-lived access, like for use with CI.

CreateUser Deprecated: Use CreateUserWithOrgs instead. This will be removed. TODO: When removing, we should rename CreateUserWithOrgs -> CreateUser with an alias of CreateUserWithOrgs.

CreateUserWithOrgs creates a new user.

CreateUserWorkspace creates a new workspace for the template specified.

CreateWorkspace creates a new workspace for the template specified.

Deprecated: Use CreateUserWorkspace instead.

CreateWorkspaceBuild queues a new build to occur for a workspace.

DeleteAPIKey deletes API key by id.

DeleteOAuth2ClientConfiguration deletes client registration (RFC 7592)

DeleteOAuth2ProviderApp deletes an application, also invalidating any tokens that were generated from it.

DeleteOAuth2ProviderAppSecret deletes a secret from an OAuth2 application, also invalidating any tokens that generated from it.

DeleteOrganization will remove the corresponding organization from the deployment, based on the UUID/name provided as `orgID`.

DeleteOrganizationMember removes a user from an organization

DeleteOrganizationRole will delete a custom organization role

DeleteProvisionerKey deletes a provisioner key.

DeleteTask deletes a task by its ID.

DeleteUser deletes a user.

DeleteWebpushSubscription deletes a push notification subscription for a given user. Think of this as an unsubscribe, but for a specific push notification subscription.

DeletedWorkspace returns a single workspace that was deleted.

DeploymentConfig returns the deployment config for the coder server.

DeploymentDAUs requires a tzOffset in hours. Use 0 for UTC, and TimezoneOffsetHour(time.Local) for the local timezone.

Download fetches a file by uploaded hash.

Download fetches a file by uploaded hash, but it forces format conversion.

ExpireAPIKey expires an API key by id, setting its expiry to now. This preserves the API key record for audit purposes rather than deleting it.

ExternalAuthByID returns the external auth for the given provider by ID.

ExchangeGitAuth exchanges a device code for an external auth token.

GetNotificationDispatchMethods the available and default notification dispatch methods.

GetNotificationsSettings retrieves the notifications settings, which currently just describes whether all notifications are paused from sending.

GetOAuth2ClientConfiguration retrieves client configuration (RFC 7592)

GetPrebuildsSettings retrieves the prebuilds settings, which currently just describes whether all prebuild reconciliation is paused.

GetProvisionerKey returns the provisioner key.

GetSystemNotificationTemplates retrieves all notification templates pertaining to internal system events.

GetTokenConfig returns deployment options related to token management

GetUserAppearanceSettings fetches the appearance settings for a user.

GetUserNotificationPreferences retrieves notification preferences for a given user.

GetUserPreferenceSettings fetches the preference settings for a user.

GitSSHKey returns the user's git SSH public key.

GroupsByOrganization Deprecated: use Groups with GroupArguments instead.

HasFirstUser returns whether the first user has been created.

InvalidateTemplatePresets invalidates all presets for the template's active version by setting last_invalidated_at timestamp. The reconciler will then mark these prebuilds as expired and create new ones.

ListExternalAuths returns the available external auth providers and the user's authenticated links if they exist.

ListOrganizationRoles lists all assignable roles for a given organization.

ListProvisionerKeyDaemons lists all provisioner keys with their associated daemons for an organization.

ListProvisionerKeys lists all provisioner keys for an organization.

ListSiteRoles lists all assignable site wide roles.

func (c *Client) LogBodies() bool

LogBodies returns whether requests and response bodies are logged.

Logger returns the logger for the client.

LoginWithPassword creates a session token authenticating with an email and password. Call `SetSessionToken()` to apply the newly acquired token to the client.

Logout calls the /logout API Call `ClearSessionToken()` to clear the session token of the client.

OAuth2ProviderApp returns an application configured to authenticate using Coder as an OAuth2 provider.

OAuth2ProviderAppSecrets returns the truncated secrets for an OAuth2 application.

OAuth2ProviderApps returns the applications configured to authenticate using Coder as an OAuth2 provider.

OrganizationMembers lists all members in an organization

OrganizationsByUser returns all organizations the user is a member of.

PatchWorkspaceSharingSettings modifies the workspace sharing settings for an organization.

PauseTask pauses a task by stopping its workspace.

PostOAuth2ClientRegistration dynamically registers a new OAuth2 client (RFC 7591)

PostOAuth2ProviderApp adds an application that can authenticate using Coder as an OAuth2 provider.

PostOAuth2ProviderAppSecret creates a new secret for an OAuth2 application. This is the only time the full secret will be revealed.

PostOrganizationMember adds a user to an organization

PostWebpushSubscription creates a push notification subscription for a given user.

PostWorkspaceUsage marks the workspace as having been used recently. Deprecated: use PostWorkspaceUsageWithBody instead

func (*Client) PostWorkspaceUsageWithBody ¶ added in v2.13.0

PostWorkspaceUsage marks the workspace as having been used recently and records an app stat.

ProvisionerDaemons returns provisioner daemons available.

PutExtendWorkspace updates the deadline for resources of the latest workspace build.

PutNotificationsSettings modifies the notifications settings, which currently just controls whether all notifications are paused from sending.

PutOAuth2ClientConfiguration updates client configuration (RFC 7592)

PutOAuth2ProviderApp updates an application that can authenticate using Coder as an OAuth2 provider.

PutPrebuildsSettings modifies the prebuilds settings, which currently just controls whether all prebuild reconciliation is paused.

RegenerateGitSSHKey will create a new SSH key pair for the user and return it.

Replicas fetches the list of replicas.

Request performs a HTTP request with the body provided. The caller is responsible for closing the response body.

RequestWithoutSessionToken performs a HTTP request. It is similar to Request, but does not set the session token in the request header, nor does it make a call to the SessionTokenProvider. This allows session token providers to call this method without causing reentrancy issues.

RevokeOAuth2ProviderApp completely revokes an app's access for the authenticated user.

RevokeOAuth2Token revokes a specific OAuth2 token using RFC 7009 token revocation.

SSHConfiguration returns information about the SSH configuration for the Coder instance.

ServeProvisionerDaemon returns the gRPC service for a provisioner daemon implementation. The context is during dial, not during the lifetime of the client. Client should be closed after use.

SessionToken returns the currently set token for the client.

func (c *Client) SetLogBodies(logBodies bool)

SetLogBodies sets whether to log request and response bodies. Deprecated: Use WithLogBodies to set this.

SetLogger sets the logger for the client. Deprecated: Use WithLogger to set this.

func (c *Client) SetSessionToken(token string)

SetSessionToken sets a fixed token for the client. Deprecated: Create a new client using WithSessionToken instead of changing the token after creation.

StarterTemplates lists example templates available in Coder.

TaskByID fetches a single task by its ID. Only tasks owned by codersdk.Me are supported.

TaskByIdentifier fetches and returns a task by an identifier, which may be either a UUID, a name (for a task owned by the current user), or a "user/task" combination, where user is either a username or UUID.

Since there is no TaskByOwnerAndName endpoint yet, this function uses the list endpoint with filtering when a name is provided.

func (*Client) TaskByOwnerAndName ¶ added in v2.29.0

TaskByOwnerAndName fetches a single task by its owner and name.

TaskLogs retrieves logs from the task app.

TaskSend submits task input to the tasks sidebar app.

Tasks lists all tasks belonging to the user or specified owner.

Template returns a single template.

TemplateACLAvailable returns available users + groups that can be assigned template perms

TemplateByName finds a template inside the organization provided with a case-insensitive name.

TemplateDAUs requires a tzOffset in hours. Use 0 for UTC, and TimezoneOffsetHour(time.Local) for the local timezone.

TemplateExamples lists example templates available in Coder.

Deprecated: Use StarterTemplates instead.

TemplateVersion returns a template version by ID.

TemplateVersionByName returns a template version by it's friendly name. This is used for path-based routing. Like: /templates/example/versions/helloworld

TemplateVersionDryRun returns the current state of a template version dry-run job.

TemplateVersionDryRunLogsAfter streams logs for a template version dry-run that occurred after a specific log ID.

TemplateVersionDryRunMatchedProvisioners returns the matched provisioners for a template version dry-run job.

TemplateVersionDryRunResources returns the resources of a finished template version dry-run job.

TemplateVersionExternalAuth returns authentication providers for the requested template version.

TemplateVersionLogsAfter streams logs for a template version that occurred after a specific log ID.

TemplateVersionPresets returns the presets associated with a template version.

TemplateVersionResources returns resources a template version declares.

TemplateVersionParameters returns parameters a template version exposes.

TemplateVersionVariables returns resources a template version variables.

TemplateVersionsByTemplate lists versions associated with a template.

Templates lists all viewable templates

TemplatesByOrganization lists all templates inside of an organization.

Tokens list machine API keys.

UnlinkExternalAuthByID deletes the external auth for the given provider by ID for the user. This does not revoke the token from the IDP.

UpdateActiveTemplateVersion updates the active template version to the ID provided. The template version must be attached to the template.

UpdateCheck returns information about the latest release version of Coder and whether or not the server is running the latest release.

UpdateNotificationTemplateMethod modifies a notification template to use a specific notification method, overriding the method set in the deployment configuration.

UpdateOrganization will update information about the corresponding organization, based on the UUID/name provided as `orgID`.

UpdateOrganizationMemberRoles grants the userID the specified roles in an org. Include ALL roles the user has.

UpdateOrganizationRole will update an existing custom organization role

UpdateTaskInput updates the task's input.

UpdateUserAppearanceSettings updates the appearance settings for a user.

UpdateUserNotificationPreferences updates notification preferences for a given user.

UpdateUserPassword updates a user password. It calls PUT /users/{user}/password

UpdateUserPreferenceSettings updates the preference settings for a user.

UpdateUserProfile updates the username of a user.

UpdateUserQuietHoursSchedule updates the quiet hours settings for the user. This endpoint only exists in enterprise editions.

UpdateUserRoles grants the userID the specified roles. Include ALL roles the user has.

UpdateUserStatus sets the user status to the given status

UpdateWorkspaceAutomaticUpdates sets the automatic updates setting for workspace by id.

UpdateWorkspaceAutostart sets the autostart schedule for workspace by id. If the provided schedule is empty, autostart is disabled for the workspace.

UpdateWorkspaceBuildState updates the provisioner state of the build without triggering a new build. This is useful for state-only migrations.

UpdateWorkspaceDormancy sets a workspace as dormant if dormant=true and activates a dormant workspace if dormant=false.

UpdateWorkspaceTTL sets the ttl for workspace by id. If the provided duration is nil, autostop is disabled for the workspace.

UpdateWorkspaceUsageContext periodically posts workspace usage for the workspace with the given id in the background. The caller is responsible for calling the returned function to stop the background process. Deprecated: use UpdateWorkspaceUsageContextWithBody instead

func (*Client) UpdateWorkspaceUsageWithBodyContext ¶ added in v2.13.0

UpdateWorkspaceUsageWithBodyContext periodically posts workspace usage for the workspace with the given id and app name in the background. The caller is responsible for calling the returned function to stop the background process.

Upload uploads an arbitrary file with the content type provided. This is used to upload a source-code archive.

User returns a user for the ID/username provided.

UserAutofillParameters returns all recently used parameters for the given user.

UserQuietHoursSchedule returns the quiet hours settings for the user. This endpoint only exists in enterprise editions.

UserRoles returns all roles the user has

Users returns all users according to the request parameters. If no parameters are set, the default behavior is to return all users in a single page.

ValidateUserPassword validates the complexity of a user password and that it is secured enough.

WatchWorkspaceAgentMetadata watches the metadata of a workspace agent. The returned channel will be closed when the context is canceled. Exactly one error will be sent on the error channel. The metadata channel is never closed.

Workspace returns a single workspace.

WorkspaceAgent returns an agent by ID.

WorkspaceAgentDeleteDevcontainer deletes the devcontainer with the given ID.

WorkspaceAgentListContainers returns a list of containers that are currently running on a Docker daemon accessible to the workspace agent.

WorkspaceAgentListeningPorts returns a list of ports that are currently being listened on inside the workspace agent's network namespace.

WorkspaceAgentRecreateDevcontainer recreates the devcontainer with the given ID.

WorkspaceAvailableUsers returns users available for workspace creation. This is used to populate the owner dropdown when creating workspaces for other users.

WorkspaceBuild returns a single workspace build for a workspace. If history is "", the latest version is returned.

WorkspaceBuildLogsAfter streams logs for a workspace build that occurred after a specific log ID.

WorkspaceBuildState returns the provisioner state of the build.

func (*Client) WorkspaceByOwnerAndName ¶

WorkspaceByOwnerAndName returns a workspace by the owner's UUID and the workspace's name.

WorkspaceSharingSettings retrieves the workspace sharing settings for an organization.

Workspaces returns all workspaces the authenticated user has access to.

type ClientOption func(*Client)
func WithDisableDirectConnections() ClientOption
func WithLogBodies() ClientOption
func WithSessionToken(token string) ClientOption
func WithTrace() ClientOption
type CoderDesktopTelemetry struct {
	DeviceID            string `json:"device_id"`
	DeviceOS            string `json:"device_os"`
	CoderDesktopVersion string `json:"coder_desktop_version"`
}

CoderDesktopTelemetry represents the telemetry data sent from Coder Desktop clients. @typescript-ignore CoderDesktopTelemetry

FromHeader parses the desktop telemetry from the provided header value. Returns nil if the header is empty or if parsing fails.

IsEmpty returns true if all fields in the telemetry data are empty.

type ConnectionLatency struct {
	P50 float64 `json:"p50" example:"31.312"`
	P95 float64 `json:"p95" example:"119.832"`
}

ConnectionLatency shows the latency for a connection.

type ConnectionLog struct {
	ID                     uuid.UUID           `json:"id" format:"uuid"`
	ConnectTime            time.Time           `json:"connect_time" format:"date-time"`
	Organization           MinimalOrganization `json:"organization"`
	WorkspaceOwnerID       uuid.UUID           `json:"workspace_owner_id" format:"uuid"`
	WorkspaceOwnerUsername string              `json:"workspace_owner_username"`
	WorkspaceID            uuid.UUID           `json:"workspace_id" format:"uuid"`
	WorkspaceName          string              `json:"workspace_name"`
	AgentName              string              `json:"agent_name"`
	IP                     *netip.Addr         `json:"ip,omitempty"`
	Type                   ConnectionType      `json:"type"`

	
	
	
	WebInfo *ConnectionLogWebInfo `json:"web_info,omitempty"`

	
	
	
	
	
	SSHInfo *ConnectionLogSSHInfo `json:"ssh_info,omitempty"`
}
type ConnectionLogResponse struct {
	ConnectionLogs []ConnectionLog `json:"connection_logs"`
	Count          int64           `json:"count"`
}
type ConnectionLogSSHInfo struct {
	ConnectionID uuid.UUID `json:"connection_id" format:"uuid"`
	
	
	DisconnectTime *time.Time `json:"disconnect_time,omitempty" format:"date-time"`
	
	
	DisconnectReason string `json:"disconnect_reason,omitempty"`
	
	
	ExitCode *int32 `json:"exit_code,omitempty"`
}
type ConnectionLogStatus string

ConnectionLogStatus is the status of a connection log entry. It's the argument to the `status` filter when fetching connection logs.

const (
	ConnectionLogStatusOngoing   ConnectionLogStatus = "ongoing"
	ConnectionLogStatusCompleted ConnectionLogStatus = "completed"
)
type ConnectionLogWebInfo struct {
	UserAgent string `json:"user_agent"`
	
	User       *User  `json:"user"`
	SlugOrPort string `json:"slug_or_port"`
	
	StatusCode int32 `json:"status_code"`
}
type ConnectionLogsRequest struct {
	SearchQuery string `json:"q,omitempty"`
}

ConnectionType is the type of connection that the agent is receiving.

const (
	ConnectionTypeSSH             ConnectionType = "ssh"
	ConnectionTypeVSCode          ConnectionType = "vscode"
	ConnectionTypeJetBrains       ConnectionType = "jetbrains"
	ConnectionTypeReconnectingPTY ConnectionType = "reconnecting_pty"
	ConnectionTypeWorkspaceApp    ConnectionType = "workspace_app"
	ConnectionTypePortForwarding  ConnectionType = "port_forwarding"
)
type ConvertLoginRequest struct {
	
	ToType   LoginType `json:"to_type" validate:"required"`
	Password string    `json:"password" validate:"required"`
}
type Country struct {
	Name string `json:"name"`
	Flag string `json:"flag"`
}

@typescript-ignore Country

type CreateFirstUserRequest struct {
	Email     string                   `json:"email" validate:"required,email"`
	Username  string                   `json:"username" validate:"required,username"`
	Name      string                   `json:"name" validate:"user_real_name"`
	Password  string                   `json:"password" validate:"required"`
	Trial     bool                     `json:"trial"`
	TrialInfo CreateFirstUserTrialInfo `json:"trial_info"`
}
type CreateFirstUserResponse struct {
	UserID         uuid.UUID `json:"user_id" format:"uuid"`
	OrganizationID uuid.UUID `json:"organization_id" format:"uuid"`
}

CreateFirstUserResponse contains IDs for newly created user info.

type CreateFirstUserTrialInfo struct {
	FirstName   string `json:"first_name"`
	LastName    string `json:"last_name"`
	PhoneNumber string `json:"phone_number"`
	JobTitle    string `json:"job_title"`
	CompanyName string `json:"company_name"`
	Country     string `json:"country"`
	Developers  string `json:"developers"`
}
type CreateGroupRequest struct {
	Name           string `json:"name" validate:"required,group_name"`
	DisplayName    string `json:"display_name" validate:"omitempty,group_display_name"`
	AvatarURL      string `json:"avatar_url"`
	QuotaAllowance int    `json:"quota_allowance"`
}
type CreateOrganizationRequest struct {
	Name string `json:"name" validate:"required,organization_name"`
	
	DisplayName string `json:"display_name,omitempty" validate:"omitempty,organization_display_name"`
	Description string `json:"description,omitempty"`
	Icon        string `json:"icon,omitempty"`
}
type CreateProvisionerKeyRequest struct {
	Name string            `json:"name"`
	Tags map[string]string `json:"tags"`
}
type CreateProvisionerKeyResponse struct {
	Key string `json:"key"`
}
type CreateTaskRequest struct {
	TemplateVersionID       uuid.UUID `json:"template_version_id" format:"uuid"`
	TemplateVersionPresetID uuid.UUID `json:"template_version_preset_id,omitempty" format:"uuid"`
	Input                   string    `json:"input"`
	Name                    string    `json:"name,omitempty"`
	DisplayName             string    `json:"display_name,omitempty"`
}

CreateTaskRequest represents the request to create a new task.

type CreateTemplateRequest struct {
	
	Name string `json:"name" validate:"template_name,required"`
	
	DisplayName string `json:"display_name,omitempty" validate:"template_display_name"`
	
	
	Description string `json:"description,omitempty" validate:"lt=128"`
	
	
	Icon string `json:"icon,omitempty"`

	
	
	
	
	
	
	VersionID uuid.UUID `json:"template_version_id" validate:"required" format:"uuid"`

	
	
	DefaultTTLMillis *int64 `json:"default_ttl_ms,omitempty"`
	
	
	
	ActivityBumpMillis *int64 `json:"activity_bump_ms,omitempty"`
	
	
	AutostopRequirement *TemplateAutostopRequirement `json:"autostop_requirement,omitempty"`
	
	
	AutostartRequirement *TemplateAutostartRequirement `json:"autostart_requirement,omitempty"`

	
	
	AllowUserCancelWorkspaceJobs *bool `json:"allow_user_cancel_workspace_jobs"`

	
	
	
	AllowUserAutostart *bool `json:"allow_user_autostart,omitempty"`

	
	
	
	
	AllowUserAutostop *bool `json:"allow_user_autostop,omitempty"`

	
	
	FailureTTLMillis *int64 `json:"failure_ttl_ms,omitempty"`
	
	
	TimeTilDormantMillis *int64 `json:"dormant_ttl_ms,omitempty"`
	
	
	TimeTilDormantAutoDeleteMillis *int64 `json:"delete_ttl_ms,omitempty"`

	
	
	
	
	
	DisableEveryoneGroupAccess bool `json:"disable_everyone_group_access"`

	
	
	RequireActiveVersion bool `json:"require_active_version"`

	
	
	MaxPortShareLevel *WorkspaceAgentPortShareLevel `json:"max_port_share_level"`

	
	
	
	
	UseClassicParameterFlow *bool `json:"template_use_classic_parameter_flow,omitempty"`

	
	CORSBehavior *CORSBehavior `json:"cors_behavior"`
}

CreateTemplateRequest provides options when creating a template.

type CreateTemplateVersionDryRunRequest struct {
	WorkspaceName       string                    `json:"workspace_name"`
	RichParameterValues []WorkspaceBuildParameter `json:"rich_parameter_values"`
	UserVariableValues  []VariableValue           `json:"user_variable_values,omitempty"`
}

CreateTemplateVersionDryRunRequest defines the request parameters for CreateTemplateVersionDryRun.

type CreateTemplateVersionRequest struct {
	Name    string `json:"name,omitempty" validate:"omitempty,template_version_name"`
	Message string `json:"message,omitempty" validate:"lt=1048577"`
	
	TemplateID      uuid.UUID                `json:"template_id,omitempty" format:"uuid"`
	StorageMethod   ProvisionerStorageMethod `json:"storage_method" validate:"oneof=file,required" enums:"file"`
	FileID          uuid.UUID                `json:"file_id,omitempty" validate:"required_without=ExampleID" format:"uuid"`
	ExampleID       string                   `json:"example_id,omitempty" validate:"required_without=FileID"`
	Provisioner     ProvisionerType          `json:"provisioner" validate:"oneof=terraform echo,required"`
	ProvisionerTags map[string]string        `json:"tags"`

	UserVariableValues []VariableValue `json:"user_variable_values,omitempty"`
}

CreateTemplateVersionRequest enables callers to create a new Template Version.

type CreateTestAuditLogRequest struct {
	Action           AuditAction     `json:"action,omitempty" enums:"create,write,delete,start,stop"`
	ResourceType     ResourceType    `json:"resource_type,omitempty" enums:"template,template_version,user,workspace,workspace_build,git_ssh_key,auditable_group"`
	ResourceID       uuid.UUID       `json:"resource_id,omitempty" format:"uuid"`
	AdditionalFields json.RawMessage `json:"additional_fields,omitempty"`
	Time             time.Time       `json:"time,omitempty" format:"date-time"`
	BuildReason      BuildReason     `json:"build_reason,omitempty" enums:"autostart,autostop,initiator"`
	OrganizationID   uuid.UUID       `json:"organization_id,omitempty" format:"uuid"`
	RequestID        uuid.UUID       `json:"request_id,omitempty" format:"uuid"`
}
type CreateTokenRequest struct {
	Lifetime  time.Duration        `json:"lifetime"`
	Scope     APIKeyScope          `json:"scope,omitempty"` 
	Scopes    []APIKeyScope        `json:"scopes,omitempty"`
	TokenName string               `json:"token_name"`
	AllowList []APIAllowListTarget `json:"allow_list,omitempty"`
}
type CreateUserRequest struct {
	Email    string `json:"email" validate:"required,email" format:"email"`
	Username string `json:"username" validate:"required,username"`
	Name     string `json:"name" validate:"user_real_name"`
	Password string `json:"password"`
	
	UserLoginType LoginType `json:"login_type"`
	
	
	
	DisableLogin   bool      `json:"disable_login"`
	OrganizationID uuid.UUID `json:"organization_id" validate:"" format:"uuid"`
}

CreateUserRequest Deprecated: Use CreateUserRequestWithOrgs instead. This will be removed. TODO: When removing, we should rename CreateUserRequestWithOrgs -> CreateUserRequest Then alias CreateUserRequestWithOrgs to CreateUserRequest. @typescript-ignore CreateUserRequest

type CreateUserRequestWithOrgs struct {
	Email    string `json:"email" validate:"required,email" format:"email"`
	Username string `json:"username" validate:"required,username"`
	Name     string `json:"name" validate:"user_real_name"`
	Password string `json:"password"`
	
	UserLoginType LoginType `json:"login_type"`
	
	UserStatus *UserStatus `json:"user_status"`
	
	OrganizationIDs []uuid.UUID `json:"organization_ids" validate:"" format:"uuid"`
}

UnmarshalJSON implements the unmarshal for the legacy param "organization_id". To accommodate multiple organizations, the field has been switched to a slice. The previous field will just be appended to the slice. Note in the previous behavior, omitting the field would result in the default org being applied, but that is no longer the case. TODO: Remove this method in it's entirety after some period of time. This will be released in v1.16.0, and is associated with the multiple orgs feature.

type CreateWorkspaceBuildReason string
const (
	CreateWorkspaceBuildReasonDashboard           CreateWorkspaceBuildReason = "dashboard"
	CreateWorkspaceBuildReasonCLI                 CreateWorkspaceBuildReason = "cli"
	CreateWorkspaceBuildReasonSSHConnection       CreateWorkspaceBuildReason = "ssh_connection"
	CreateWorkspaceBuildReasonVSCodeConnection    CreateWorkspaceBuildReason = "vscode_connection"
	CreateWorkspaceBuildReasonJetbrainsConnection CreateWorkspaceBuildReason = "jetbrains_connection"
	CreateWorkspaceBuildReasonTaskManualPause     CreateWorkspaceBuildReason = "task_manual_pause"
	CreateWorkspaceBuildReasonTaskResume          CreateWorkspaceBuildReason = "task_resume"
)
type CreateWorkspaceBuildRequest struct {
	TemplateVersionID uuid.UUID           `json:"template_version_id,omitempty" format:"uuid"`
	Transition        WorkspaceTransition `json:"transition" validate:"oneof=start stop delete,required"`
	DryRun            bool                `json:"dry_run,omitempty"`
	ProvisionerState  []byte              `json:"state,omitempty"`
	
	Orphan bool `json:"orphan,omitempty"`
	
	
	
	RichParameterValues []WorkspaceBuildParameter `json:"rich_parameter_values,omitempty"`

	
	LogLevel ProvisionerLogLevel `json:"log_level,omitempty" validate:"omitempty,oneof=debug"`
	
	TemplateVersionPresetID uuid.UUID `json:"template_version_preset_id,omitempty" format:"uuid"`
	
	Reason CreateWorkspaceBuildReason `` 
}

CreateWorkspaceBuildRequest provides options to update the latest workspace build.

type CreateWorkspaceProxyRequest struct {
	Name        string `json:"name" validate:"required"`
	DisplayName string `json:"display_name"`
	Icon        string `json:"icon"`
}
type CreateWorkspaceRequest struct {
	
	TemplateID uuid.UUID `json:"template_id,omitempty" validate:"required_without=TemplateVersionID,excluded_with=TemplateVersionID" format:"uuid"`
	
	TemplateVersionID uuid.UUID `json:"template_version_id,omitempty" validate:"required_without=TemplateID,excluded_with=TemplateID" format:"uuid"`
	Name              string    `json:"name" validate:"workspace_name,required"`
	AutostartSchedule *string   `json:"autostart_schedule,omitempty"`
	TTLMillis         *int64    `json:"ttl_ms,omitempty"`
	
	
	RichParameterValues     []WorkspaceBuildParameter `json:"rich_parameter_values,omitempty"`
	AutomaticUpdates        AutomaticUpdates          `json:"automatic_updates,omitempty"`
	TemplateVersionPresetID uuid.UUID                 `json:"template_version_preset_id,omitempty" format:"uuid"`
}

CreateWorkspaceRequest provides options for creating a new workspace. Either TemplateID or TemplateVersionID must be specified. They cannot both be present. @Description CreateWorkspaceRequest provides options for creating a new workspace. @Description Only one of TemplateID or TemplateVersionID can be specified, not both. @Description If TemplateID is specified, the active version of the template will be used. @Description Workspace names: @Description - Must start with a letter or number @Description - Can only contain letters, numbers, and hyphens @Description - Cannot contain spaces or special characters @Description - Cannot be named `new` or `create` @Description - Must be unique within your workspaces @Description - Maximum length of 32 characters

type CryptoKey struct {
	Feature   CryptoKeyFeature `json:"feature"`
	Secret    string           `json:"secret"`
	DeletesAt time.Time        `json:"deletes_at" format:"date-time"`
	Sequence  int32            `json:"sequence"`
	StartsAt  time.Time        `json:"starts_at" format:"date-time"`
}
const (
	CryptoKeyFeatureWorkspaceAppsAPIKey CryptoKeyFeature = "workspace_apps_api_key"
	
	CryptoKeyFeatureWorkspaceAppsToken CryptoKeyFeature = "workspace_apps_token"
	CryptoKeyFeatureOIDCConvert        CryptoKeyFeature = "oidc_convert"
	CryptoKeyFeatureTailnetResume      CryptoKeyFeature = "tailnet_resume"
)
type CustomNotificationRequest struct {
	Content *CustomNotificationContent `json:"content"`
}
type CustomRoleRequest struct {
	Name            string       `json:"name" table:"name,default_sort" validate:"username"`
	DisplayName     string       `json:"display_name" table:"display name"`
	SitePermissions []Permission `json:"site_permissions" table:"site permissions"`
	UserPermissions []Permission `json:"user_permissions" table:"user permissions"`
	
	OrganizationPermissions []Permission `json:"organization_permissions" table:"organization permissions"`
	
	OrganizationMemberPermissions []Permission `json:"organization_member_permissions" table:"organization member permissions"`
}

CustomRoleRequest is used to edit custom roles.

type DAUEntry struct {
	
	
	Date   string `json:"date"`
	Amount int    `json:"amount"`
}
type DAURequest struct {
	TZHourOffset int
}
type DAUsResponse struct {
	Entries      []DAUEntry `json:"entries"`
	TZHourOffset int        `json:"tz_hour_offset"`
}
type DERP struct {
	Server DERPServerConfig `json:"server" typescript:",notnull"`
	Config DERPConfig       `json:"config" typescript:",notnull"`
}
type DERPConfig struct {
	BlockDirect     serpent.Bool   `json:"block_direct" typescript:",notnull"`
	ForceWebSockets serpent.Bool   `json:"force_websockets" typescript:",notnull"`
	URL             serpent.String `json:"url" typescript:",notnull"`
	Path            serpent.String `json:"path" typescript:",notnull"`
}
type DERPRegion struct {
	Preferred           bool    `json:"preferred"`
	LatencyMilliseconds float64 `json:"latency_ms"`
}
type DERPServerConfig struct {
	Enable        serpent.Bool        `json:"enable" typescript:",notnull"`
	RegionID      serpent.Int64       `json:"region_id" typescript:",notnull"`
	RegionCode    serpent.String      `json:"region_code" typescript:",notnull"`
	RegionName    serpent.String      `json:"region_name" typescript:",notnull"`
	STUNAddresses serpent.StringArray `json:"stun_addresses" typescript:",notnull"`
	RelayURL      serpent.URL         `json:"relay_url" typescript:",notnull"`
}
type DangerousConfig struct {
	AllowPathAppSharing         serpent.Bool `json:"allow_path_app_sharing" typescript:",notnull"`
	AllowPathAppSiteOwnerAccess serpent.Bool `json:"allow_path_app_site_owner_access" typescript:",notnull"`
	AllowAllCors                serpent.Bool `json:"allow_all_cors" typescript:",notnull"`
}
type DeleteExternalAuthByIDResponse struct {
	
	TokenRevoked         bool   `json:"token_revoked"`
	TokenRevocationError string `json:"token_revocation_error,omitempty"`
}
type DeleteWebpushSubscription struct {
	Endpoint string `json:"endpoint"`
}
type DeleteWorkspaceAgentPortShareRequest struct {
	AgentName string `json:"agent_name"`
	Port      int32  `json:"port"`
}
type DeploymentConfig struct {
	Values  *DeploymentValues `json:"config,omitempty"`
	Options serpent.OptionSet `json:"options,omitempty"`
}

DeploymentConfig contains both the deployment values and how they're set.

type DeploymentStats struct {
	
	
	AggregatedFrom time.Time `json:"aggregated_from" format:"date-time"`
	
	CollectedAt time.Time `json:"collected_at" format:"date-time"`
	
	
	NextUpdateAt time.Time `json:"next_update_at" format:"date-time"`

	Workspaces   WorkspaceDeploymentStats    `json:"workspaces"`
	SessionCount SessionCountDeploymentStats `json:"session_count"`
}
type DeploymentValues struct {
	Verbose             serpent.Bool   `json:"verbose,omitempty"`
	AccessURL           serpent.URL    `json:"access_url,omitempty"`
	WildcardAccessURL   serpent.String `json:"wildcard_access_url,omitempty"`
	DocsURL             serpent.URL    `json:"docs_url,omitempty"`
	RedirectToAccessURL serpent.Bool   `json:"redirect_to_access_url,omitempty"`
	
	HTTPAddress                     serpent.String                       `json:"http_address,omitempty" typescript:",notnull"`
	AutobuildPollInterval           serpent.Duration                     `json:"autobuild_poll_interval,omitempty"`
	JobReaperDetectorInterval       serpent.Duration                     `json:"job_hang_detector_interval,omitempty"`
	DERP                            DERP                                 `json:"derp,omitempty" typescript:",notnull"`
	Prometheus                      PrometheusConfig                     `json:"prometheus,omitempty" typescript:",notnull"`
	Pprof                           PprofConfig                          `json:"pprof,omitempty" typescript:",notnull"`
	ProxyTrustedOrigins             serpent.StringArray                  `json:"proxy_trusted_origins,omitempty" typescript:",notnull"`
	CacheDir                        serpent.String                       `json:"cache_directory,omitempty" typescript:",notnull"`
	EphemeralDeployment             serpent.Bool                         `json:"ephemeral_deployment,omitempty" typescript:",notnull"`
	PostgresURL                     serpent.String                       `json:"pg_connection_url,omitempty" typescript:",notnull"`
	PostgresAuth                    string                               `json:"pg_auth,omitempty" typescript:",notnull"`
	PostgresConnMaxOpen             serpent.Int64                        `json:"pg_conn_max_open,omitempty" typescript:",notnull"`
	PostgresConnMaxIdle             serpent.String                       `json:"pg_conn_max_idle,omitempty" typescript:",notnull"`
	OAuth2                          OAuth2Config                         `json:"oauth2,omitempty" typescript:",notnull"`
	OIDC                            OIDCConfig                           `json:"oidc,omitempty" typescript:",notnull"`
	Telemetry                       TelemetryConfig                      `json:"telemetry,omitempty" typescript:",notnull"`
	TLS                             TLSConfig                            `json:"tls,omitempty" typescript:",notnull"`
	Trace                           TraceConfig                          `json:"trace,omitempty" typescript:",notnull"`
	HTTPCookies                     HTTPCookieConfig                     `json:"http_cookies,omitempty" typescript:",notnull"`
	StrictTransportSecurity         serpent.Int64                        `json:"strict_transport_security,omitempty" typescript:",notnull"`
	StrictTransportSecurityOptions  serpent.StringArray                  `json:"strict_transport_security_options,omitempty" typescript:",notnull"`
	SSHKeygenAlgorithm              serpent.String                       `json:"ssh_keygen_algorithm,omitempty" typescript:",notnull"`
	MetricsCacheRefreshInterval     serpent.Duration                     `json:"metrics_cache_refresh_interval,omitempty" typescript:",notnull"`
	AgentStatRefreshInterval        serpent.Duration                     `json:"agent_stat_refresh_interval,omitempty" typescript:",notnull"`
	AgentFallbackTroubleshootingURL serpent.URL                          `json:"agent_fallback_troubleshooting_url,omitempty" typescript:",notnull"`
	BrowserOnly                     serpent.Bool                         `json:"browser_only,omitempty" typescript:",notnull"`
	SCIMAPIKey                      serpent.String                       `json:"scim_api_key,omitempty" typescript:",notnull"`
	ExternalTokenEncryptionKeys     serpent.StringArray                  `json:"external_token_encryption_keys,omitempty" typescript:",notnull"`
	Provisioner                     ProvisionerConfig                    `json:"provisioner,omitempty" typescript:",notnull"`
	RateLimit                       RateLimitConfig                      `json:"rate_limit,omitempty" typescript:",notnull"`
	Experiments                     serpent.StringArray                  `json:"experiments,omitempty" typescript:",notnull"`
	UpdateCheck                     serpent.Bool                         `json:"update_check,omitempty" typescript:",notnull"`
	Swagger                         SwaggerConfig                        `json:"swagger,omitempty" typescript:",notnull"`
	Logging                         LoggingConfig                        `json:"logging,omitempty" typescript:",notnull"`
	Dangerous                       DangerousConfig                      `json:"dangerous,omitempty" typescript:",notnull"`
	DisablePathApps                 serpent.Bool                         `json:"disable_path_apps,omitempty" typescript:",notnull"`
	Sessions                        SessionLifetime                      `json:"session_lifetime,omitempty" typescript:",notnull"`
	DisablePasswordAuth             serpent.Bool                         `json:"disable_password_auth,omitempty" typescript:",notnull"`
	Support                         SupportConfig                        `json:"support,omitempty" typescript:",notnull"`
	EnableAuthzRecording            serpent.Bool                         `json:"enable_authz_recording,omitempty" typescript:",notnull"`
	ExternalAuthConfigs             serpent.Struct[[]ExternalAuthConfig] `json:"external_auth,omitempty" typescript:",notnull"`
	SSHConfig                       SSHConfig                            `json:"config_ssh,omitempty" typescript:",notnull"`
	WgtunnelHost                    serpent.String                       `json:"wgtunnel_host,omitempty" typescript:",notnull"`
	DisableOwnerWorkspaceExec       serpent.Bool                         `json:"disable_owner_workspace_exec,omitempty" typescript:",notnull"`
	DisableWorkspaceSharing         serpent.Bool                         `json:"disable_workspace_sharing,omitempty" typescript:",notnull"`
	ProxyHealthStatusInterval       serpent.Duration                     `json:"proxy_health_status_interval,omitempty" typescript:",notnull"`
	EnableTerraformDebugMode        serpent.Bool                         `json:"enable_terraform_debug_mode,omitempty" typescript:",notnull"`
	WebTerminalRenderer             serpent.String                       `json:"web_terminal_renderer,omitempty" typescript:",notnull"`
	AllowWorkspaceRenames           serpent.Bool                         `json:"allow_workspace_renames,omitempty" typescript:",notnull"`
	Healthcheck                     HealthcheckConfig                    `json:"healthcheck,omitempty" typescript:",notnull"`
	Retention                       RetentionConfig                      `json:"retention,omitempty" typescript:",notnull"`
	CLIUpgradeMessage               serpent.String                       `json:"cli_upgrade_message,omitempty" typescript:",notnull"`
	TermsOfServiceURL               serpent.String                       `json:"terms_of_service_url,omitempty" typescript:",notnull"`
	Notifications                   NotificationsConfig                  `json:"notifications,omitempty" typescript:",notnull"`
	AdditionalCSPPolicy             serpent.StringArray                  `json:"additional_csp_policy,omitempty" typescript:",notnull"`
	WorkspaceHostnameSuffix         serpent.String                       `json:"workspace_hostname_suffix,omitempty" typescript:",notnull"`
	Prebuilds                       PrebuildsConfig                      `json:"workspace_prebuilds,omitempty" typescript:",notnull"`
	HideAITasks                     serpent.Bool                         `json:"hide_ai_tasks,omitempty" typescript:",notnull"`
	AI                              AIConfig                             `json:"ai,omitempty"`
	StatsCollection                 StatsCollectionConfig                `json:"stats_collection,omitempty" typescript:",notnull"`

	Config      serpent.YAMLConfigPath `json:"config,omitempty" typescript:",notnull"`
	WriteConfig serpent.Bool           `json:"write_config,omitempty" typescript:",notnull"`

	
	Address serpent.HostPort `json:"address,omitempty" typescript:",notnull"`
}

DeploymentValues is the central configuration values the coder server.

Validate checks cross-field constraints for deployment values. It must be called after all values are loaded from flags/env/YAML.

WithoutSecrets returns a copy of the config without secret values.

type DiagnosticExtra struct {
}
type DiagnosticSeverityString string
const (
	DiagnosticSeverityError   DiagnosticSeverityString = "error"
	DiagnosticSeverityWarning DiagnosticSeverityString = "warning"
)
const (
	DisplayAppVSCodeDesktop  DisplayApp = "vscode"
	DisplayAppVSCodeInsiders DisplayApp = "vscode_insiders"
	DisplayAppWebTerminal    DisplayApp = "web_terminal"
	DisplayAppPortForward    DisplayApp = "port_forwarding_helper"
	DisplayAppSSH            DisplayApp = "ssh_helper"
)
type DynamicParametersRequest struct {
	
	
	ID     int               `json:"id"`
	Inputs map[string]string `json:"inputs"`
	
	OwnerID uuid.UUID `json:"owner_id,omitempty" format:"uuid"`
}
type DynamicParametersResponse struct {
	ID          int                  `json:"id"`
	Diagnostics []FriendlyDiagnostic `json:"diagnostics"`
	Parameters  []PreviewParameter   `json:"parameters"`
}
type EnhancedExternalAuthProvider string

EnhancedExternalAuthProvider is a constant that represents enhanced support for a type of external authentication. All of the Git providers are examples of enhanced, because they support intercepting "git clone".

const (
	EnhancedExternalAuthProviderAzureDevops EnhancedExternalAuthProvider = "azure-devops"
	
	EnhancedExternalAuthProviderAzureDevopsEntra EnhancedExternalAuthProvider = "azure-devops-entra"
	EnhancedExternalAuthProviderGitHub           EnhancedExternalAuthProvider = "github"
	EnhancedExternalAuthProviderGitLab           EnhancedExternalAuthProvider = "gitlab"
	
	
	EnhancedExternalAuthProviderBitBucketCloud  EnhancedExternalAuthProvider = "bitbucket-cloud"
	EnhancedExternalAuthProviderBitBucketServer EnhancedExternalAuthProvider = "bitbucket-server"
	EnhancedExternalAuthProviderSlack           EnhancedExternalAuthProvider = "slack"
	EnhancedExternalAuthProviderJFrog           EnhancedExternalAuthProvider = "jfrog"
	EnhancedExternalAuthProviderGitea           EnhancedExternalAuthProvider = "gitea"
)

Git returns whether the provider is a Git provider.

Entitlement represents whether a feature is licensed.

const (
	EntitlementEntitled    Entitlement = "entitled"
	EntitlementGracePeriod Entitlement = "grace_period"
	EntitlementNotEntitled Entitlement = "not_entitled"
)

Entitled returns if the entitlement can be used. So this is true if it is entitled or still in it's grace period.

func (e Entitlement) Weight() int

Weight converts the enum types to a numerical value for easier comparisons. Easier than sets of if statements.

type Entitlements struct {
	Features         map[FeatureName]Feature `json:"features"`
	Warnings         []string                `json:"warnings"`
	Errors           []string                `json:"errors"`
	HasLicense       bool                    `json:"has_license"`
	Trial            bool                    `json:"trial"`
	RequireTelemetry bool                    `json:"require_telemetry"`
	RefreshedAt      time.Time               `json:"refreshed_at" format:"date-time"`
}
func (e *Entitlements) AddFeature(name FeatureName, add Feature)

AddFeature will add the feature to the entitlements iff it expands the set of features granted by the entitlements. If it does not, it will be ignored and the existing feature with the same name will remain.

Features that abide by usage period constraints should have the following fields set or they will be ignored. Other features will have these fields cleared. - UsagePeriodIssuedAt - UsagePeriodStart - UsagePeriodEnd

All features should be added as atomic items, and not merged in any way. Merging entitlements could lead to unexpected behavior, like a larger user limit in grace period merging with a smaller one in an "entitled" state. This could lead to the larger limit being extended as "entitled", which is not correct.

type Error struct {
	Response

	Helper string
	
}

Error represents an unaccepted or invalid request to the API. @typescript-ignore Error

func NewError(statusCode int, response Response) *Error

NewError creates a new Error with the response and status code.

NewTestError is a helper function to create a Error, setting the internal fields. It's generally only useful for testing.

func (e *Error) StatusCode() int
const (
	
	ExperimentExample            Experiment = "example"              
	ExperimentAutoFillParameters Experiment = "auto-fill-parameters" 
	ExperimentNotifications      Experiment = "notifications"        
	ExperimentWorkspaceUsage     Experiment = "workspace-usage"      
	ExperimentWebPush            Experiment = "web-push"             
	ExperimentOAuth2             Experiment = "oauth2"               
	ExperimentMCPServerHTTP      Experiment = "mcp-server-http"      
)
type ExperimentalClient struct {
	*Client
}

ExperimentalClient is a client for the experimental API. Its interface is not guaranteed to be stable and may change at any time. @typescript-ignore ExperimentalClient

func NewExperimentalClient(client *Client) *ExperimentalClient
type Experiments []Experiment

Experiments is a list of experiments. Multiple experiments may be enabled at the same time. Experiments are not safe for production use, and are not guaranteed to be backwards compatible. They may be removed or renamed at any time. The below typescript-ignore annotation allows our typescript generator to generate an enum list, which is used in the frontend. @typescript-ignore Experiments

Enabled returns a list of experiments that are enabled for the deployment.

type ExternalAPIKeyScopes struct {
	External []APIKeyScope `json:"external"`
}
type ExternalAgentCredentials struct {
	Command    string `json:"command"`
	AgentToken string `json:"agent_token"`
}

ExternalAgentCredentials contains the credentials needed for an external agent to connect to Coder.

type ExternalAuth struct {
	Authenticated      bool   `json:"authenticated"`
	Device             bool   `json:"device"`
	DisplayName        string `json:"display_name"`
	SupportsRevocation bool   `json:"supports_revocation"`

	
	User *ExternalAuthUser `json:"user"`
	
	AppInstallable bool `json:"app_installable"`
	
	AppInstallations []ExternalAuthAppInstallation `json:"installations"`
	
	AppInstallURL string `json:"app_install_url"`
}
type ExternalAuthAppInstallation struct {
	ID           int              `json:"id"`
	Account      ExternalAuthUser `json:"account"`
	ConfigureURL string           `json:"configure_url"`
}
type ExternalAuthConfig struct {
	
	Type         string `json:"type" yaml:"type"`
	ClientID     string `json:"client_id" yaml:"client_id"`
	ClientSecret string `json:"-" yaml:"client_secret"`
	
	
	ID                  string   `json:"id" yaml:"id"`
	AuthURL             string   `json:"auth_url" yaml:"auth_url"`
	TokenURL            string   `json:"token_url" yaml:"token_url"`
	ValidateURL         string   `json:"validate_url" yaml:"validate_url"`
	RevokeURL           string   `json:"revoke_url" yaml:"revoke_url"`
	AppInstallURL       string   `json:"app_install_url" yaml:"app_install_url"`
	AppInstallationsURL string   `json:"app_installations_url" yaml:"app_installations_url"`
	NoRefresh           bool     `json:"no_refresh" yaml:"no_refresh"`
	Scopes              []string `json:"scopes" yaml:"scopes"`
	DeviceFlow          bool     `json:"device_flow" yaml:"device_flow"`
	DeviceCodeURL       string   `json:"device_code_url" yaml:"device_code_url"`
	MCPURL              string   `json:"mcp_url" yaml:"mcp_url"`
	MCPToolAllowRegex   string   `json:"mcp_tool_allow_regex" yaml:"mcp_tool_allow_regex"`
	MCPToolDenyRegex    string   `json:"mcp_tool_deny_regex" yaml:"mcp_tool_deny_regex"`
	
	
	
	
	
	
	Regex string `json:"regex" yaml:"regex"`
	
	DisplayName string `json:"display_name" yaml:"display_name"`
	
	DisplayIcon string `json:"display_icon" yaml:"display_icon"`
	
	
	CodeChallengeMethodsSupported []string `json:"code_challenge_methods_supported" yaml:"code_challenge_methods_supported"`
}
type ExternalAuthDeviceExchange struct {
	DeviceCode string `json:"device_code"`
}
type ExternalAuthLink struct {
	ProviderID      string    `json:"provider_id"`
	CreatedAt       time.Time `json:"created_at" format:"date-time"`
	UpdatedAt       time.Time `json:"updated_at" format:"date-time"`
	HasRefreshToken bool      `json:"has_refresh_token"`
	Expires         time.Time `json:"expires" format:"date-time"`
	Authenticated   bool      `json:"authenticated"`
	ValidateError   string    `json:"validate_error"`
}

ExternalAuthLink is a link between a user and an external auth provider. It excludes information that requires a token to access, so can be statically built from the database and configs.

type ExternalAuthLinkProvider struct {
	ID                            string   `json:"id"`
	Type                          string   `json:"type"`
	Device                        bool     `json:"device"`
	DisplayName                   string   `json:"display_name"`
	DisplayIcon                   string   `json:"display_icon"`
	AllowRefresh                  bool     `json:"allow_refresh"`
	AllowValidate                 bool     `json:"allow_validate"`
	SupportsRevocation            bool     `json:"supports_revocation"`
	CodeChallengeMethodsSupported []string `json:"code_challenge_methods_supported"`
}

ExternalAuthLinkProvider are the static details of a provider.

type ExternalAuthUser struct {
	ID         int64  `json:"id"`
	Login      string `json:"login"`
	AvatarURL  string `json:"avatar_url"`
	ProfileURL string `json:"profile_url"`
	Name       string `json:"name"`
}
type Feature struct {
	Entitlement Entitlement `json:"entitlement"`
	Enabled     bool        `json:"enabled"`
	Limit       *int64      `json:"limit,omitempty"`
	Actual      *int64      `json:"actual,omitempty"`

	
	
	
	
	
	
	
	
	
	UsagePeriod *UsagePeriod `json:"usage_period,omitempty"`
}
func (f Feature) Capable() bool

Capable is a helper function that returns if a given feature has a limit that is greater than or equal to the actual. If this condition is not true, then the feature is not capable of being used since the limit is not high enough.

func (f Feature) Compare(b Feature) int

Compare compares two features and returns an integer representing if the first feature (f) is greater than, equal to, or less than the second feature (b). "Greater than" means the first feature has more functionality than the second feature. It is assumed the features are for the same FeatureName.

A feature is considered greater than another feature if: 1. The usage period has a greater issued at date (note: only certain features use usage periods) 2. The usage period has a greater end date (note: only certain features use usage periods) 3. Graceful & capable > Entitled & not capable (only if both have "Actual" values) 4. The entitlement is greater 5. The limit is greater 6. Enabled is greater than disabled 7. The actual is greater

FeatureName represents the internal name of a feature. To add a new feature, add it to this set of enums as well as the FeatureNames array below.

const (
	FeatureUserLimit                  FeatureName = "user_limit"
	FeatureAuditLog                   FeatureName = "audit_log"
	FeatureConnectionLog              FeatureName = "connection_log"
	FeatureBrowserOnly                FeatureName = "browser_only"
	FeatureSCIM                       FeatureName = "scim"
	FeatureTemplateRBAC               FeatureName = "template_rbac"
	FeatureUserRoleManagement         FeatureName = "user_role_management"
	FeatureHighAvailability           FeatureName = "high_availability"
	FeatureMultipleExternalAuth       FeatureName = "multiple_external_auth"
	FeatureExternalProvisionerDaemons FeatureName = "external_provisioner_daemons"
	FeatureAppearance                 FeatureName = "appearance"
	FeatureAdvancedTemplateScheduling FeatureName = "advanced_template_scheduling"
	FeatureWorkspaceProxy             FeatureName = "workspace_proxy"
	FeatureExternalTokenEncryption    FeatureName = "external_token_encryption"
	FeatureWorkspaceBatchActions      FeatureName = "workspace_batch_actions"
	FeatureTaskBatchActions           FeatureName = "task_batch_actions"
	FeatureAccessControl              FeatureName = "access_control"
	FeatureControlSharedPorts         FeatureName = "control_shared_ports"
	FeatureCustomRoles                FeatureName = "custom_roles"
	FeatureMultipleOrganizations      FeatureName = "multiple_organizations"
	FeatureWorkspacePrebuilds         FeatureName = "workspace_prebuilds"
	
	
	
	FeatureManagedAgentLimit      FeatureName = "managed_agent_limit"
	FeatureWorkspaceExternalAgent FeatureName = "workspace_external_agent"
	FeatureAIBridge               FeatureName = "aibridge"
	FeatureBoundary               FeatureName = "boundary"
	FeatureAIGovernanceUserLimit  FeatureName = "ai_governance_user_limit"
)
func (n FeatureName) AlwaysEnable() bool

AlwaysEnable returns if the feature is always enabled if entitled. This is required because some features are only enabled if they are entitled and not required. E.g: "multiple-organizations" is disabled by default in AGPL and enterprise deployments. This feature should only be enabled for premium deployments when it is entitled.

func (n FeatureName) Enterprise() bool

Enterprise returns true if the feature is an enterprise feature.

Humanize returns the feature name in a human-readable format.

func (n FeatureName) IsAIGovernanceAddon() bool

IsAIGovernanceAddon returns true if the feature is an AI governance addon feature.

func (n FeatureName) IsAddonFeature() bool

IsAddon returns true if the feature is an addon feature.

func (n FeatureName) UsesLimit() bool

UsesLimit returns true if the feature uses a limit, and therefore should not be included in any feature sets (as they are not boolean features).

func (n FeatureName) UsesUsagePeriod() bool

UsesUsagePeriod returns true if the feature uses period-based usage limits.

FeatureSet represents a grouping of features. Rather than manually assigning features al-la-carte when making a license, a set can be specified. Sets are dynamic in the sense a feature can be added to a set, granting the feature to existing licenses out in the wild. If features were granted al-la-carte, we would need to reissue the existing old licenses to include the new feature.

const (
	FeatureSetNone       FeatureSet = ""
	FeatureSetEnterprise FeatureSet = "enterprise"
	FeatureSetPremium    FeatureSet = "premium"
)
func (set FeatureSet) Features() []FeatureName
type FixedSessionTokenProvider struct {
	SessionToken string
	
	SessionTokenHeader string
}

FixedSessionTokenProvider provides a given, fixed, session token. E.g. one read from file or environment variable at the program start. @typescript-ignore FixedSessionTokenProvider

func (f FixedSessionTokenProvider) AsRequestOption() RequestOption
type FriendlyDiagnostic struct {
	Severity DiagnosticSeverityString `json:"severity"`
	Summary  string                   `json:"summary"`
	Detail   string                   `json:"detail"`

}

FriendlyDiagnostic == previewtypes.FriendlyDiagnostic Copied to avoid import deps

type GenerateAPIKeyResponse struct {
	Key string `json:"key"`
}

GenerateAPIKeyResponse contains an API key for a user.

type GetInboxNotificationResponse struct {
	Notification InboxNotification `json:"notification"`
	UnreadCount  int               `json:"unread_count"`
}
type GetUserStatusCountsRequest struct {
	
	
	Offset int `json:"offset"`
}
type GetUserStatusCountsResponse struct {
	StatusCounts map[UserStatus][]UserStatusChangeCount `json:"status_counts"`
}
type GetUsersResponse struct {
	Users []User `json:"users"`
	Count int    `json:"count"`
}
type GitSSHKey struct {
	UserID    uuid.UUID `json:"user_id" format:"uuid"`
	CreatedAt time.Time `json:"created_at" format:"date-time"`
	UpdatedAt time.Time `json:"updated_at" format:"date-time"`
	
	
	
	PublicKey string `json:"public_key"`
}
type GithubAuthMethod struct {
	Enabled                   bool `json:"enabled"`
	DefaultProviderConfigured bool `json:"default_provider_configured"`
}
type Group struct {
	ID             uuid.UUID     `json:"id" format:"uuid"`
	Name           string        `json:"name"`
	DisplayName    string        `json:"display_name"`
	OrganizationID uuid.UUID     `json:"organization_id" format:"uuid"`
	Members        []ReducedUser `json:"members"`
	
	
	
	TotalMemberCount        int         `json:"total_member_count"`
	AvatarURL               string      `json:"avatar_url" format:"uri"`
	QuotaAllowance          int         `json:"quota_allowance"`
	Source                  GroupSource `json:"source"`
	OrganizationName        string      `json:"organization_name"`
	OrganizationDisplayName string      `json:"organization_display_name"`
}
func (g Group) IsEveryone() bool
const (
	GroupSourceUser GroupSource = "user"
	GroupSourceOIDC GroupSource = "oidc"
)
type GroupSyncSettings struct {
	
	
	Field string `json:"field"`
	
	Mapping map[string][]uuid.UUID `json:"mapping"`
	
	
	
	RegexFilter *regexp.Regexp `json:"regex_filter"`
	
	
	AutoCreateMissing bool `json:"auto_create_missing_groups"`
	
	
	
	
	
	LegacyNameMapping map[string]string `json:"legacy_group_name_mapping,omitempty"`
}
type HTTPCookieConfig struct {
	Secure           serpent.Bool `json:"secure_auth_cookie,omitempty" typescript:",notnull"`
	SameSite         string       `json:"same_site,omitempty" typescript:",notnull"`
	EnableHostPrefix bool         `json:"host_prefix,omitempty" typescript:",notnull"`
}

Middleware handles some cookie mutation the requests.

For performance of this, see 'BenchmarkHTTPCookieConfigMiddleware' This code is executed on every request, so efficiency is important. If making changes, please consider the performance implications and run benchmarks.

type HeaderTransport struct {
}

HeaderTransport is a http.RoundTripper that adds some headers to all requests. @typescript-ignore HeaderTransport

func (h *HeaderTransport) CloseIdleConnections()
type Healthcheck struct {
	
	URL string `json:"url"`
	
	Interval int32 `json:"interval"`
	
	Threshold int32 `json:"threshold"`
}
type HealthcheckConfig struct {
	Refresh           serpent.Duration `json:"refresh" typescript:",notnull"`
	ThresholdDatabase serpent.Duration `json:"threshold_database" typescript:",notnull"`
}

HealthcheckConfig contains configuration for healthchecks.

type InboxNotification struct {
	ID         uuid.UUID                 `json:"id" format:"uuid"`
	UserID     uuid.UUID                 `json:"user_id" format:"uuid"`
	TemplateID uuid.UUID                 `json:"template_id" format:"uuid"`
	Targets    []uuid.UUID               `json:"targets" format:"uuid"`
	Title      string                    `json:"title"`
	Content    string                    `json:"content"`
	Icon       string                    `json:"icon"`
	Actions    []InboxNotificationAction `json:"actions"`
	ReadAt     *time.Time                `json:"read_at"`
	CreatedAt  time.Time                 `json:"created_at" format:"date-time"`
}
type InboxNotificationAction struct {
	Label string `json:"label"`
	URL   string `json:"url"`
}
type InsightsReportInterval string

InsightsReportInterval is the interval of time over which to generate a smaller insights report within a time range.

const (
	InsightsReportIntervalDay  InsightsReportInterval = "day"
	InsightsReportIntervalWeek InsightsReportInterval = "week"
)

InsightsReportInterval enums.

Days returns the duration of the interval in days.

type InvalidatePresetsResponse struct {
	Invalidated []InvalidatedPreset `json:"invalidated"`
}
type InvalidatedPreset struct {
	TemplateName        string `json:"template_name"`
	TemplateVersionName string `json:"template_version_name"`
	PresetName          string `json:"preset_name"`
}
type IssueReconnectingPTYSignedTokenRequest struct {
	
	URL     string    `json:"url" validate:"required"`
	AgentID uuid.UUID `json:"agentID" format:"uuid" validate:"required"`
}
type IssueReconnectingPTYSignedTokenResponse struct {
	SignedToken string `json:"signed_token"`
}

JobErrorCode defines the error code returned by job runner.

const (
	RequiredTemplateVariables JobErrorCode = "REQUIRED_TEMPLATE_VARIABLES"
)
type License struct {
	ID         int32     `json:"id"`
	UUID       uuid.UUID `json:"uuid" format:"uuid"`
	UploadedAt time.Time `json:"uploaded_at" format:"date-time"`
	
	
	
	
	Claims map[string]interface{} `json:"claims" table:"claims"`
}
func (l *License) AllFeaturesClaim() bool

ExpiresAt returns the expiration time of the license. If the claim is missing or has an unexpected type, an error is returned.

FeaturesClaims provides the feature claims in license. This only returns the explicit claims. If checking for actual usage, also check `AllFeaturesClaim`.

type LicensorTrialRequest struct {
	DeploymentID string `json:"deployment_id"`
	Email        string `json:"email"`
	Source       string `json:"source"`

	
	FirstName   string `json:"first_name"`
	LastName    string `json:"last_name"`
	PhoneNumber string `json:"phone_number"`
	JobTitle    string `json:"job_title"`
	CompanyName string `json:"company_name"`
	Country     string `json:"country"`
	Developers  string `json:"developers"`
}

@typescript-ignore LicensorTrialRequest

type LinkConfig struct {
	Name   string `json:"name" yaml:"name"`
	Target string `json:"target" yaml:"target"`
	Icon   string `json:"icon" yaml:"icon" enums:"bug,chat,docs,star"`

	Location string `json:"location,omitempty" yaml:"location,omitempty" enums:"navbar,dropdown"`
}
func DefaultSupportLinks(docsURL string) []LinkConfig
type ListInboxNotificationsRequest struct {
	Targets        string `json:"targets,omitempty"`
	Templates      string `json:"templates,omitempty"`
	ReadStatus     string `json:"read_status,omitempty"`
	StartingBefore string `json:"starting_before,omitempty"`
}
type ListInboxNotificationsResponse struct {
	Notifications []InboxNotification `json:"notifications"`
	UnreadCount   int                 `json:"unread_count"`
}
type ListUserExternalAuthResponse struct {
	Providers []ExternalAuthLinkProvider `json:"providers"`
	
	
	
	
	Links []ExternalAuthLink `json:"links"`
}

LoginType is the type of login used to create the API key.

const (
	LoginTypeUnknown  LoginType = ""
	LoginTypePassword LoginType = "password"
	LoginTypeGithub   LoginType = "github"
	LoginTypeOIDC     LoginType = "oidc"
	LoginTypeToken    LoginType = "token"
	
	
	
	
	LoginTypeNone LoginType = "none"
)
type LoginWithPasswordRequest struct {
	Email    string `json:"email" validate:"required,email" format:"email"`
	Password string `json:"password" validate:"required"`
}

LoginWithPasswordRequest enables callers to authenticate with email and password.

type LoginWithPasswordResponse struct {
	SessionToken string `json:"session_token" validate:"required"`
}

LoginWithPasswordResponse contains a session token for the newly authenticated user.

type MatchedProvisioners struct {
	
	
	
	Count int `json:"count"`
	
	
	
	Available int `json:"available"`
	
	
	MostRecentlySeen NullTime `json:"most_recently_seen,omitempty" format:"date-time"`
}

MatchedProvisioners represents the number of provisioner daemons available to take a job at a specific point in time. Introduced in Coder version 2.18.0.

type MinimalOrganization struct {
	ID          uuid.UUID `table:"id" json:"id" validate:"required" format:"uuid"`
	Name        string    `table:"name,default_sort" json:"name"`
	DisplayName string    `table:"display name" json:"display_name"`
	Icon        string    `table:"icon" json:"icon"`
}
type MinimalUser struct {
	ID        uuid.UUID `json:"id" validate:"required" table:"id" format:"uuid"`
	Username  string    `json:"username" validate:"required" table:"username,default_sort"`
	Name      string    `json:"name,omitempty" table:"name"`
	AvatarURL string    `json:"avatar_url,omitempty" format:"uri"`
}

MinimalUser is the minimal information needed to identify a user and show them on the UI.

type NotificationMethodsResponse struct {
	AvailableNotificationMethods []string `json:"available"`
	DefaultNotificationMethod    string   `json:"default"`
}
type NotificationPreference struct {
	NotificationTemplateID uuid.UUID `json:"id" format:"uuid"`
	Disabled               bool      `json:"disabled"`
	UpdatedAt              time.Time `json:"updated_at" format:"date-time"`
}
type NotificationTemplate struct {
	ID               uuid.UUID `json:"id" format:"uuid"`
	Name             string    `json:"name"`
	TitleTemplate    string    `json:"title_template"`
	BodyTemplate     string    `json:"body_template"`
	Actions          string    `json:"actions" format:""`
	Group            string    `json:"group"`
	Method           string    `json:"method"`
	Kind             string    `json:"kind"`
	EnabledByDefault bool      `json:"enabled_by_default"`
}
type NotificationsConfig struct {
	
	MaxSendAttempts serpent.Int64 `json:"max_send_attempts" typescript:",notnull"`
	
	RetryInterval serpent.Duration `json:"retry_interval" typescript:",notnull"`

	
	
	
	
	StoreSyncInterval serpent.Duration `json:"sync_interval" typescript:",notnull"`
	
	
	
	
	StoreSyncBufferSize serpent.Int64 `json:"sync_buffer_size" typescript:",notnull"`

	
	
	
	
	
	LeasePeriod serpent.Duration `json:"lease_period"`
	
	LeaseCount serpent.Int64 `json:"lease_count"`
	
	FetchInterval serpent.Duration `json:"fetch_interval"`

	
	Method serpent.String `json:"method"`
	
	DispatchTimeout serpent.Duration `json:"dispatch_timeout"`
	
	SMTP NotificationsEmailConfig `json:"email" typescript:",notnull"`
	
	Webhook NotificationsWebhookConfig `json:"webhook" typescript:",notnull"`
	
	Inbox NotificationsInboxConfig `json:"inbox" typescript:",notnull"`
}

Are either of the notification methods enabled?

type NotificationsEmailAuthConfig struct {
	
	Identity serpent.String `json:"identity" typescript:",notnull"`
	
	Username serpent.String `json:"username" typescript:",notnull"`
	
	Password serpent.String `json:"password" typescript:",notnull"`
	
	PasswordFile serpent.String `json:"password_file" typescript:",notnull"`
}
type NotificationsEmailConfig struct {
	
	From serpent.String `json:"from" typescript:",notnull"`
	
	Smarthost serpent.String `json:"smarthost" typescript:",notnull"`
	
	Hello serpent.String `json:"hello" typescript:",notnull"`

	
	Auth NotificationsEmailAuthConfig `json:"auth" typescript:",notnull"`
	
	TLS NotificationsEmailTLSConfig `json:"tls" typescript:",notnull"`
	
	ForceTLS serpent.Bool `json:"force_tls" typescript:",notnull"`
}
type NotificationsEmailTLSConfig struct {
	
	StartTLS serpent.Bool `json:"start_tls" typescript:",notnull"`
	
	ServerName serpent.String `json:"server_name" typescript:",notnull"`
	
	InsecureSkipVerify serpent.Bool `json:"insecure_skip_verify" typescript:",notnull"`
	
	CAFile serpent.String `json:"ca_file" typescript:",notnull"`
	
	CertFile serpent.String `json:"cert_file" typescript:",notnull"`
	
	KeyFile serpent.String `json:"key_file" typescript:",notnull"`
}
type NotificationsInboxConfig struct {
	Enabled serpent.Bool `json:"enabled" typescript:",notnull"`
}
type NotificationsSettings struct {
	NotifierPaused bool `json:"notifier_paused"`
}
type NotificationsWebhookConfig struct {
	
	Endpoint serpent.URL `json:"endpoint" typescript:",notnull"`
}
type NullHCLString struct {
	Value string `json:"value"`
	Valid bool   `json:"valid"`
}

NullHCLString == `previewtypes.NullHCLString`.

NullTime represents a nullable time.Time. @typescript-ignore NullTime

NewNullTime returns a new NullTime with the given time.Time.

IsZero return true if the time is null or zero.

MarshalJSON implements json.Marshaler.

UnmarshalJSON implements json.Unmarshaler.

type OAuth2AppEndpoints struct {
	Authorization string `json:"authorization"`
	Token         string `json:"token"`
	TokenRevoke   string `json:"token_revoke"`
	
	DeviceAuth string `json:"device_authorization"`
}
type OAuth2AuthorizationServerMetadata struct {
	Issuer                            string                          `json:"issuer"`
	AuthorizationEndpoint             string                          `json:"authorization_endpoint"`
	TokenEndpoint                     string                          `json:"token_endpoint"`
	RegistrationEndpoint              string                          `json:"registration_endpoint,omitempty"`
	RevocationEndpoint                string                          `json:"revocation_endpoint,omitempty"`
	ResponseTypesSupported            []OAuth2ProviderResponseType    `json:"response_types_supported"`
	GrantTypesSupported               []OAuth2ProviderGrantType       `json:"grant_types_supported,omitempty"`
	CodeChallengeMethodsSupported     []OAuth2PKCECodeChallengeMethod `json:"code_challenge_methods_supported,omitempty"`
	ScopesSupported                   []string                        `json:"scopes_supported,omitempty"`
	TokenEndpointAuthMethodsSupported []OAuth2TokenEndpointAuthMethod `json:"token_endpoint_auth_methods_supported,omitempty"`
}

OAuth2AuthorizationServerMetadata represents RFC 8414 OAuth 2.0 Authorization Server Metadata.

type OAuth2ClientConfiguration struct {
	ClientID                string                        `json:"client_id"`
	ClientIDIssuedAt        int64                         `json:"client_id_issued_at"`
	ClientSecretExpiresAt   int64                         `json:"client_secret_expires_at,omitempty"`
	RedirectURIs            []string                      `json:"redirect_uris,omitempty"`
	ClientName              string                        `json:"client_name,omitempty"`
	ClientURI               string                        `json:"client_uri,omitempty"`
	LogoURI                 string                        `json:"logo_uri,omitempty"`
	TOSURI                  string                        `json:"tos_uri,omitempty"`
	PolicyURI               string                        `json:"policy_uri,omitempty"`
	JWKSURI                 string                        `json:"jwks_uri,omitempty"`
	JWKS                    json.RawMessage               `json:"jwks,omitempty" swaggertype:"object"`
	SoftwareID              string                        `json:"software_id,omitempty"`
	SoftwareVersion         string                        `json:"software_version,omitempty"`
	GrantTypes              []OAuth2ProviderGrantType     `json:"grant_types"`
	ResponseTypes           []OAuth2ProviderResponseType  `json:"response_types"`
	TokenEndpointAuthMethod OAuth2TokenEndpointAuthMethod `json:"token_endpoint_auth_method"`
	Scope                   string                        `json:"scope,omitempty"`
	Contacts                []string                      `json:"contacts,omitempty"`
	RegistrationAccessToken string                        `json:"registration_access_token,omitempty"`
	RegistrationClientURI   string                        `json:"registration_client_uri"`
}

OAuth2ClientConfiguration represents RFC 7592 Client Read Response.

type OAuth2ClientRegistrationRequest struct {
	RedirectURIs            []string                      `json:"redirect_uris,omitempty"`
	ClientName              string                        `json:"client_name,omitempty"`
	ClientURI               string                        `json:"client_uri,omitempty"`
	LogoURI                 string                        `json:"logo_uri,omitempty"`
	TOSURI                  string                        `json:"tos_uri,omitempty"`
	PolicyURI               string                        `json:"policy_uri,omitempty"`
	JWKSURI                 string                        `json:"jwks_uri,omitempty"`
	JWKS                    json.RawMessage               `json:"jwks,omitempty" swaggertype:"object"`
	SoftwareID              string                        `json:"software_id,omitempty"`
	SoftwareVersion         string                        `json:"software_version,omitempty"`
	SoftwareStatement       string                        `json:"software_statement,omitempty"`
	GrantTypes              []OAuth2ProviderGrantType     `json:"grant_types,omitempty"`
	ResponseTypes           []OAuth2ProviderResponseType  `json:"response_types,omitempty"`
	TokenEndpointAuthMethod OAuth2TokenEndpointAuthMethod `json:"token_endpoint_auth_method,omitempty"`
	Scope                   string                        `json:"scope,omitempty"`
	Contacts                []string                      `json:"contacts,omitempty"`
}

OAuth2ClientRegistrationRequest represents RFC 7591 Dynamic Client Registration Request.

DetermineClientType determines if client is public or confidential

GenerateClientName generates a client name if not provided

type OAuth2ClientRegistrationResponse struct {
	ClientID                string                        `json:"client_id"`
	ClientSecret            string                        `json:"client_secret,omitempty"`
	ClientIDIssuedAt        int64                         `json:"client_id_issued_at,omitempty"`
	ClientSecretExpiresAt   int64                         `json:"client_secret_expires_at,omitempty"`
	RedirectURIs            []string                      `json:"redirect_uris,omitempty"`
	ClientName              string                        `json:"client_name,omitempty"`
	ClientURI               string                        `json:"client_uri,omitempty"`
	LogoURI                 string                        `json:"logo_uri,omitempty"`
	TOSURI                  string                        `json:"tos_uri,omitempty"`
	PolicyURI               string                        `json:"policy_uri,omitempty"`
	JWKSURI                 string                        `json:"jwks_uri,omitempty"`
	JWKS                    json.RawMessage               `json:"jwks,omitempty" swaggertype:"object"`
	SoftwareID              string                        `json:"software_id,omitempty"`
	SoftwareVersion         string                        `json:"software_version,omitempty"`
	GrantTypes              []OAuth2ProviderGrantType     `json:"grant_types"`
	ResponseTypes           []OAuth2ProviderResponseType  `json:"response_types"`
	TokenEndpointAuthMethod OAuth2TokenEndpointAuthMethod `json:"token_endpoint_auth_method"`
	Scope                   string                        `json:"scope,omitempty"`
	Contacts                []string                      `json:"contacts,omitempty"`
	RegistrationAccessToken string                        `json:"registration_access_token"`
	RegistrationClientURI   string                        `json:"registration_client_uri"`
}

OAuth2ClientRegistrationResponse represents RFC 7591 Dynamic Client Registration Response.

type OAuth2Config struct {
	Github OAuth2GithubConfig `json:"github" typescript:",notnull"`
}
type OAuth2DeviceFlowCallbackResponse struct {
	RedirectURL string `json:"redirect_url"`
}
type OAuth2Error struct {
	Error            OAuth2ErrorCode `json:"error"`
	ErrorDescription string          `json:"error_description,omitempty"`
	ErrorURI         string          `json:"error_uri,omitempty"`
}

OAuth2Error represents an OAuth2-compliant error response per RFC 6749.

const (
	
	OAuth2ErrorCodeInvalidRequest       OAuth2ErrorCode = "invalid_request"
	OAuth2ErrorCodeInvalidClient        OAuth2ErrorCode = "invalid_client"
	OAuth2ErrorCodeInvalidGrant         OAuth2ErrorCode = "invalid_grant"
	OAuth2ErrorCodeUnauthorizedClient   OAuth2ErrorCode = "unauthorized_client"
	OAuth2ErrorCodeUnsupportedGrantType OAuth2ErrorCode = "unsupported_grant_type"
	OAuth2ErrorCodeInvalidScope         OAuth2ErrorCode = "invalid_scope"

	
	OAuth2ErrorCodeAccessDenied            OAuth2ErrorCode = "access_denied"
	OAuth2ErrorCodeUnsupportedResponseType OAuth2ErrorCode = "unsupported_response_type"
	OAuth2ErrorCodeServerError             OAuth2ErrorCode = "server_error"
	OAuth2ErrorCodeTemporarilyUnavailable  OAuth2ErrorCode = "temporarily_unavailable"

	
	OAuth2ErrorCodeUnsupportedTokenType OAuth2ErrorCode = "unsupported_token_type"

	
	OAuth2ErrorCodeInvalidTarget OAuth2ErrorCode = "invalid_target"
)

OAuth2 error codes per RFC 6749, RFC 7009, RFC 8707. This is not comprehensive; it includes only codes relevant to this implementation.

type OAuth2GithubConfig struct {
	ClientID              serpent.String      `json:"client_id" typescript:",notnull"`
	ClientSecret          serpent.String      `json:"client_secret" typescript:",notnull"`
	DeviceFlow            serpent.Bool        `json:"device_flow" typescript:",notnull"`
	DefaultProviderEnable serpent.Bool        `json:"default_provider_enable" typescript:",notnull"`
	AllowedOrgs           serpent.StringArray `json:"allowed_orgs" typescript:",notnull"`
	AllowedTeams          serpent.StringArray `json:"allowed_teams" typescript:",notnull"`
	AllowSignups          serpent.Bool        `json:"allow_signups" typescript:",notnull"`
	AllowEveryone         serpent.Bool        `json:"allow_everyone" typescript:",notnull"`
	EnterpriseBaseURL     serpent.String      `json:"enterprise_base_url" typescript:",notnull"`
}
type OAuth2PKCECodeChallengeMethod string
const (
	OAuth2PKCECodeChallengeMethodS256  OAuth2PKCECodeChallengeMethod = "S256"
	OAuth2PKCECodeChallengeMethodPlain OAuth2PKCECodeChallengeMethod = "plain"
)

OAuth2PKCECodeChallengeMethod values (RFC 7636).

type OAuth2ProtectedResourceMetadata struct {
	Resource               string   `json:"resource"`
	AuthorizationServers   []string `json:"authorization_servers"`
	ScopesSupported        []string `json:"scopes_supported,omitempty"`
	BearerMethodsSupported []string `json:"bearer_methods_supported,omitempty"`
}

OAuth2ProtectedResourceMetadata represents RFC 9728 OAuth 2.0 Protected Resource Metadata

type OAuth2ProviderApp struct {
	ID          uuid.UUID `json:"id" format:"uuid"`
	Name        string    `json:"name"`
	CallbackURL string    `json:"callback_url"`
	Icon        string    `json:"icon"`

	
	
	
	Endpoints OAuth2AppEndpoints `json:"endpoints"`
}
type OAuth2ProviderAppFilter struct {
	UserID uuid.UUID `json:"user_id,omitempty" format:"uuid"`
}
type OAuth2ProviderAppSecret struct {
	ID                    uuid.UUID `json:"id" format:"uuid"`
	LastUsedAt            NullTime  `json:"last_used_at"`
	ClientSecretTruncated string    `json:"client_secret_truncated"`
}
type OAuth2ProviderAppSecretFull struct {
	ID               uuid.UUID `json:"id" format:"uuid"`
	ClientSecretFull string    `json:"client_secret_full"`
}
type OAuth2ProviderGrantType string
const (
	OAuth2ProviderGrantTypeAuthorizationCode OAuth2ProviderGrantType = "authorization_code"
	OAuth2ProviderGrantTypeRefreshToken      OAuth2ProviderGrantType = "refresh_token"
	OAuth2ProviderGrantTypePassword          OAuth2ProviderGrantType = "password"
	OAuth2ProviderGrantTypeClientCredentials OAuth2ProviderGrantType = "client_credentials"
	OAuth2ProviderGrantTypeImplicit          OAuth2ProviderGrantType = "implicit"
)

OAuth2ProviderGrantType values (RFC 6749).

type OAuth2ProviderResponseType string
const (
	OAuth2ProviderResponseTypeCode  OAuth2ProviderResponseType = "code"
	OAuth2ProviderResponseTypeToken OAuth2ProviderResponseType = "token"
)

OAuth2ProviderResponseType values (RFC 6749).

type OAuth2RevocationTokenTypeHint string
const (
	OAuth2RevocationTokenTypeHintAccessToken  OAuth2RevocationTokenTypeHint = "access_token"
	OAuth2RevocationTokenTypeHintRefreshToken OAuth2RevocationTokenTypeHint = "refresh_token"
)
type OAuth2TokenEndpointAuthMethod string
const (
	OAuth2TokenEndpointAuthMethodClientSecretBasic OAuth2TokenEndpointAuthMethod = "client_secret_basic"
	OAuth2TokenEndpointAuthMethodClientSecretPost  OAuth2TokenEndpointAuthMethod = "client_secret_post"
	OAuth2TokenEndpointAuthMethodNone              OAuth2TokenEndpointAuthMethod = "none"
)
type OAuth2TokenRequest struct {
	GrantType    OAuth2ProviderGrantType `json:"grant_type"`
	Code         string                  `json:"code,omitempty"`
	RedirectURI  string                  `json:"redirect_uri,omitempty"`
	ClientID     string                  `json:"client_id,omitempty"`
	ClientSecret string                  `json:"client_secret,omitempty"`
	CodeVerifier string                  `json:"code_verifier,omitempty"`
	RefreshToken string                  `json:"refresh_token,omitempty"`
	Resource     string                  `json:"resource,omitempty"`
	Scope        string                  `json:"scope,omitempty"`
}

OAuth2TokenRequest represents a token request per RFC 6749. The actual wire format is application/x-www-form-urlencoded; this struct is for SDK docs.

type OAuth2TokenResponse struct {
	AccessToken  string          `json:"access_token"`
	TokenType    OAuth2TokenType `json:"token_type"`
	ExpiresIn    int64           `json:"expires_in,omitempty"`
	RefreshToken string          `json:"refresh_token,omitempty"`
	Scope        string          `json:"scope,omitempty"`
	
	
	Expiry *time.Time `json:"expiry,omitempty" format:"date-time"`
}

OAuth2TokenResponse represents a successful token response per RFC 6749.

type OAuth2TokenRevocationRequest struct {
	Token         string                        `json:"token"`
	TokenTypeHint OAuth2RevocationTokenTypeHint `json:"token_type_hint,omitempty"`
	ClientID      string                        `json:"client_id,omitempty"`
	ClientSecret  string                        `json:"client_secret,omitempty"`
}

OAuth2TokenRevocationRequest represents a token revocation request per RFC 7009.

const (
	OAuth2TokenTypeBearer OAuth2TokenType = "Bearer"
	OAuth2TokenTypeDPoP   OAuth2TokenType = "DPoP"
)

OAuth2TokenType values (RFC 6749, RFC 9449).

type OAuthConversionResponse struct {
	StateString string    `json:"state_string"`
	ExpiresAt   time.Time `json:"expires_at" format:"date-time"`
	ToType      LoginType `json:"to_type"`
	UserID      uuid.UUID `json:"user_id" format:"uuid"`
}
type OIDCAuthMethod struct {
	AuthMethod
	SignInText string `json:"signInText"`
	IconURL    string `json:"iconUrl"`
}
type OIDCConfig struct {
	AllowSignups serpent.Bool   `json:"allow_signups" typescript:",notnull"`
	ClientID     serpent.String `json:"client_id" typescript:",notnull"`
	ClientSecret serpent.String `json:"client_secret" typescript:",notnull"`
	
	ClientKeyFile       serpent.String                    `json:"client_key_file" typescript:",notnull"`
	ClientCertFile      serpent.String                    `json:"client_cert_file" typescript:",notnull"`
	EmailDomain         serpent.StringArray               `json:"email_domain" typescript:",notnull"`
	IssuerURL           serpent.String                    `json:"issuer_url" typescript:",notnull"`
	Scopes              serpent.StringArray               `json:"scopes" typescript:",notnull"`
	IgnoreEmailVerified serpent.Bool                      `json:"ignore_email_verified" typescript:",notnull"`
	UsernameField       serpent.String                    `json:"username_field" typescript:",notnull"`
	NameField           serpent.String                    `json:"name_field" typescript:",notnull"`
	EmailField          serpent.String                    `json:"email_field" typescript:",notnull"`
	AuthURLParams       serpent.Struct[map[string]string] `json:"auth_url_params" typescript:",notnull"`
	
	
	
	
	
	IgnoreUserInfo serpent.Bool `json:"ignore_user_info" typescript:",notnull"`
	
	
	
	
	UserInfoFromAccessToken   serpent.Bool                           `json:"source_user_info_from_access_token" typescript:",notnull"`
	OrganizationField         serpent.String                         `json:"organization_field" typescript:",notnull"`
	OrganizationMapping       serpent.Struct[map[string][]uuid.UUID] `json:"organization_mapping" typescript:",notnull"`
	OrganizationAssignDefault serpent.Bool                           `json:"organization_assign_default" typescript:",notnull"`
	GroupAutoCreate           serpent.Bool                           `json:"group_auto_create" typescript:",notnull"`
	GroupRegexFilter          serpent.Regexp                         `json:"group_regex_filter" typescript:",notnull"`
	GroupAllowList            serpent.StringArray                    `json:"group_allow_list" typescript:",notnull"`
	GroupField                serpent.String                         `json:"groups_field" typescript:",notnull"`
	GroupMapping              serpent.Struct[map[string]string]      `json:"group_mapping" typescript:",notnull"`
	UserRoleField             serpent.String                         `json:"user_role_field" typescript:",notnull"`
	UserRoleMapping           serpent.Struct[map[string][]string]    `json:"user_role_mapping" typescript:",notnull"`
	UserRolesDefault          serpent.StringArray                    `json:"user_roles_default" typescript:",notnull"`
	SignInText                serpent.String                         `json:"sign_in_text" typescript:",notnull"`
	IconURL                   serpent.URL                            `json:"icon_url" typescript:",notnull"`
	SignupsDisabledText       serpent.String                         `json:"signups_disabled_text" typescript:",notnull"`
	SkipIssuerChecks          serpent.Bool                           `json:"skip_issuer_checks" typescript:",notnull"`

	
	
	
	RedirectURL serpent.URL `json:"redirect_url" typescript:",notnull"`
}
const (
	OptionTypeString     OptionType = "string"
	OptionTypeNumber     OptionType = "number"
	OptionTypeBoolean    OptionType = "bool"
	OptionTypeListString OptionType = "list(string)"
)
type Organization struct {
	MinimalOrganization `table:"m,recursive_inline"`
	Description         string    `table:"description" json:"description"`
	CreatedAt           time.Time `table:"created at" json:"created_at" validate:"required" format:"date-time"`
	UpdatedAt           time.Time `table:"updated at" json:"updated_at" validate:"required" format:"date-time"`
	IsDefault           bool      `table:"default" json:"is_default" validate:"required"`
}

Organization is the JSON representation of a Coder organization.

type OrganizationMember struct {
	UserID         uuid.UUID  `table:"user id" json:"user_id" format:"uuid"`
	OrganizationID uuid.UUID  `table:"organization id" json:"organization_id" format:"uuid"`
	CreatedAt      time.Time  `table:"created at" json:"created_at" format:"date-time"`
	UpdatedAt      time.Time  `table:"updated at" json:"updated_at" format:"date-time"`
	Roles          []SlimRole `table:"organization roles" json:"roles"`
}
type OrganizationMemberWithUserData struct {
	Username           string     `table:"username,default_sort" json:"username"`
	Name               string     `table:"name" json:"name,omitempty"`
	AvatarURL          string     `json:"avatar_url,omitempty"`
	Email              string     `json:"email"`
	GlobalRoles        []SlimRole `json:"global_roles"`
	OrganizationMember `table:"m,recursive_inline"`
}
type OrganizationMembersQuery struct {
	UserID        uuid.UUID
	IncludeSystem bool
	GithubUserID  int64
}
func (omq OrganizationMembersQuery) AsRequestOption() RequestOption
type OrganizationMembersQueryOption func(*OrganizationMembersQuery)
func OrganizationMembersQueryOptionGithubUserID(githubUserID int64) OrganizationMembersQueryOption
func OrganizationMembersQueryOptionIncludeSystem() OrganizationMembersQueryOption
func OrganizationMembersQueryOptionUserID(userID uuid.UUID) OrganizationMembersQueryOption
type OrganizationSyncSettings struct {
	
	
	
	Field string `json:"field"`
	
	Mapping map[string][]uuid.UUID `json:"mapping"`
	
	
	AssignDefault bool `json:"organization_assign_default"`
}
type PaginatedMembersRequest struct {
	Limit  int `json:"limit,omitempty"`
	Offset int `json:"offset,omitempty"`
}
type PaginatedMembersResponse struct {
	Members []OrganizationMemberWithUserData `json:"members"`
	Count   int                              `json:"count"`
}
type Pagination struct {
	
	
	
	
	AfterID uuid.UUID `json:"after_id,omitempty" format:"uuid"`
	
	
	Limit int `json:"limit,omitempty"`
	
	
	
	Offset int `json:"offset,omitempty"`
}

Pagination sets pagination options for the endpoints that support it.

const (
	ParameterFormTypeDefault     ParameterFormType = ""
	ParameterFormTypeRadio       ParameterFormType = "radio"
	ParameterFormTypeSlider      ParameterFormType = "slider"
	ParameterFormTypeInput       ParameterFormType = "input"
	ParameterFormTypeDropdown    ParameterFormType = "dropdown"
	ParameterFormTypeCheckbox    ParameterFormType = "checkbox"
	ParameterFormTypeSwitch      ParameterFormType = "switch"
	ParameterFormTypeMultiSelect ParameterFormType = "multi-select"
	ParameterFormTypeTagSelect   ParameterFormType = "tag-select"
	ParameterFormTypeTextArea    ParameterFormType = "textarea"
	ParameterFormTypeError       ParameterFormType = "error"
)
type ParameterResolver struct {
	Rich []WorkspaceBuildParameter
}

ParameterResolver should be populated with legacy workload and rich parameter values from the previous build. It then supports queries against a current TemplateVersionParameter to determine whether a new value is required, or a value correctly validates. @typescript-ignore ParameterResolver

Resolve returns the value of the parameter. It does not do any validation, and is meant for use with the new dynamic parameters code path.

ValidateResolve checks the provided value, v, against the parameter, p, and the previous build. If v is nil, it also resolves the correct value. It returns the value of the parameter, if valid, and an error if invalid.

type PatchGroupIDPSyncConfigRequest struct {
	Field             string         `json:"field"`
	RegexFilter       *regexp.Regexp `json:"regex_filter"`
	AutoCreateMissing bool           `json:"auto_create_missing_groups"`
}

If the same mapping is present in both Add and Remove, Remove will take presidence.

type PatchGroupRequest struct {
	AddUsers       []string `json:"add_users"`
	RemoveUsers    []string `json:"remove_users"`
	Name           string   `json:"name" validate:"omitempty,group_name"`
	DisplayName    *string  `json:"display_name" validate:"omitempty,group_display_name"`
	AvatarURL      *string  `json:"avatar_url"`
	QuotaAllowance *int     `json:"quota_allowance"`
}
type PatchOrganizationIDPSyncConfigRequest struct {
	Field         string `json:"field"`
	AssignDefault bool   `json:"assign_default"`
}

If the same mapping is present in both Add and Remove, Remove will take presidence.

type PatchRoleIDPSyncConfigRequest struct {
	Field string `json:"field"`
}
type PatchRoleIDPSyncMappingRequest struct {
	Add    []IDPSyncMapping[string]
	Remove []IDPSyncMapping[string]
}

If the same mapping is present in both Add and Remove, Remove will take presidence.

type PatchTemplateVersionRequest struct {
	Name    string  `json:"name" validate:"omitempty,template_version_name"`
	Message *string `json:"message,omitempty" validate:"omitempty,lt=1048577"`
}
type PatchWorkspaceProxy struct {
	ID              uuid.UUID `json:"id" format:"uuid" validate:"required"`
	Name            string    `json:"name" validate:"required"`
	DisplayName     string    `json:"display_name" validate:"required"`
	Icon            string    `json:"icon" validate:"required"`
	RegenerateToken bool      `json:"regenerate_token"`
}
type PauseTaskResponse struct {
	WorkspaceBuild *WorkspaceBuild `json:"workspace_build"`
}

PauseTaskResponse represents the response from pausing a task.

type Permission struct {
	
	Negate       bool         `json:"negate"`
	ResourceType RBACResource `json:"resource_type"`
	Action       RBACAction   `json:"action"`
}

Permission is the format passed into the rego.

func CreatePermissions(mapping map[RBACResource][]RBACAction) []Permission

CreatePermissions is a helper function to quickly build permissions.

type PostOAuth2ProviderAppRequest struct {
	Name        string `json:"name" validate:"required,oauth2_app_name"`
	CallbackURL string `json:"callback_url" validate:"required,http_url"`
	Icon        string `json:"icon" validate:"omitempty"`
}
type PostWorkspaceUsageRequest struct {
	AgentID uuid.UUID    `json:"agent_id" format:"uuid"`
	AppName UsageAppName `json:"app_name"`
}
const (
	PostgresAuthPassword  PostgresAuth = "password"
	PostgresAuthAWSIAMRDS PostgresAuth = "awsiamrds"
)
type PprofConfig struct {
	Enable  serpent.Bool     `json:"enable" typescript:",notnull"`
	Address serpent.HostPort `json:"address" typescript:",notnull"`
}
type PrebuildsConfig struct {
	
	ReconciliationInterval serpent.Duration `json:"reconciliation_interval" typescript:",notnull"`

	
	
	ReconciliationBackoffInterval serpent.Duration `json:"reconciliation_backoff_interval" typescript:",notnull"`

	
	
	ReconciliationBackoffLookback serpent.Duration `json:"reconciliation_backoff_lookback" typescript:",notnull"`

	
	
	
	
	FailureHardLimit serpent.Int64 `json:"failure_hard_limit" typescript:"failure_hard_limit"`
}
type PrebuildsSettings struct {
	ReconciliationPaused bool `json:"reconciliation_paused"`
}
type PreviewParameter struct {
	PreviewParameterData
	Value       NullHCLString        `json:"value"`
	Diagnostics []FriendlyDiagnostic `json:"diagnostics"`
}
func (p PreviewParameter) TemplateVersionParameter() TemplateVersionParameter
type PreviewParameterData struct {
	Name         string                       `json:"name"`
	DisplayName  string                       `json:"display_name"`
	Description  string                       `json:"description"`
	Type         OptionType                   `json:"type"`
	FormType     ParameterFormType            `json:"form_type"`
	Styling      PreviewParameterStyling      `json:"styling"`
	Mutable      bool                         `json:"mutable"`
	DefaultValue NullHCLString                `json:"default_value"`
	Icon         string                       `json:"icon"`
	Options      []PreviewParameterOption     `json:"options"`
	Validations  []PreviewParameterValidation `json:"validations"`
	Required     bool                         `json:"required"`
	
	Order     int64 `json:"order"`
	Ephemeral bool  `json:"ephemeral"`
}
type PreviewParameterOption struct {
	Name        string        `json:"name"`
	Description string        `json:"description"`
	Value       NullHCLString `json:"value"`
	Icon        string        `json:"icon"`
}
func (o PreviewParameterOption) TemplateVersionParameterOption() TemplateVersionParameterOption
type PreviewParameterStyling struct {
	Placeholder *string `json:"placeholder,omitempty"`
	Disabled    *bool   `json:"disabled,omitempty"`
	Label       *string `json:"label,omitempty"`
	MaskInput   *bool   `json:"mask_input,omitempty"`
}
type PreviewParameterValidation struct {
	Error string `json:"validation_error"`

	
	Regex     *string `json:"validation_regex"`
	Min       *int64  `json:"validation_min"`
	Max       *int64  `json:"validation_max"`
	Monotonic *string `json:"validation_monotonic"`
}
type PrometheusConfig struct {
	Enable                serpent.Bool        `json:"enable" typescript:",notnull"`
	Address               serpent.HostPort    `json:"address" typescript:",notnull"`
	CollectAgentStats     serpent.Bool        `json:"collect_agent_stats" typescript:",notnull"`
	CollectDBMetrics      serpent.Bool        `json:"collect_db_metrics" typescript:",notnull"`
	AggregateAgentStatsBy serpent.StringArray `json:"aggregate_agent_stats_by" typescript:",notnull"`
}
type ProvisionerConfig struct {
	
	Daemons             serpent.Int64       `json:"daemons" typescript:",notnull"`
	DaemonTypes         serpent.StringArray `json:"daemon_types" typescript:",notnull"`
	DaemonPollInterval  serpent.Duration    `json:"daemon_poll_interval" typescript:",notnull"`
	DaemonPollJitter    serpent.Duration    `json:"daemon_poll_jitter" typescript:",notnull"`
	ForceCancelInterval serpent.Duration    `json:"force_cancel_interval" typescript:",notnull"`
	DaemonPSK           serpent.String      `json:"daemon_psk" typescript:",notnull"`
}
type ProvisionerDaemon struct {
	ID             uuid.UUID         `json:"id" format:"uuid" table:"id"`
	OrganizationID uuid.UUID         `json:"organization_id" format:"uuid" table:"organization id"`
	KeyID          uuid.UUID         `json:"key_id" format:"uuid" table:"-"`
	CreatedAt      time.Time         `json:"created_at" format:"date-time" table:"created at"`
	LastSeenAt     NullTime          `json:"last_seen_at,omitempty" format:"date-time" table:"last seen at"`
	Name           string            `json:"name" table:"name,default_sort"`
	Version        string            `json:"version" table:"version"`
	APIVersion     string            `json:"api_version" table:"api version"`
	Provisioners   []ProvisionerType `json:"provisioners" table:"-"`
	Tags           map[string]string `json:"tags" table:"tags"`

	
	KeyName     *string                  `json:"key_name" table:"key name"`
	Status      *ProvisionerDaemonStatus `json:"status" enums:"offline,idle,busy" table:"status"`
	CurrentJob  *ProvisionerDaemonJob    `json:"current_job" table:"current job,recursive"`
	PreviousJob *ProvisionerDaemonJob    `json:"previous_job" table:"previous job,recursive"`
}
type ProvisionerDaemonJob struct {
	ID                  uuid.UUID            `json:"id" format:"uuid" table:"id"`
	Status              ProvisionerJobStatus `json:"status" enums:"pending,running,succeeded,canceling,canceled,failed" table:"status"`
	TemplateName        string               `json:"template_name" table:"template name"`
	TemplateIcon        string               `json:"template_icon" table:"template icon"`
	TemplateDisplayName string               `json:"template_display_name" table:"template display name"`
}
type ProvisionerDaemonStatus string

ProvisionerDaemonStatus represents the status of a provisioner daemon.

const (
	ProvisionerDaemonOffline ProvisionerDaemonStatus = "offline"
	ProvisionerDaemonIdle    ProvisionerDaemonStatus = "idle"
	ProvisionerDaemonBusy    ProvisionerDaemonStatus = "busy"
)

ProvisionerDaemonStatus enums.

func ProvisionerDaemonStatusEnums() []ProvisionerDaemonStatus
type ProvisionerJob struct {
	ID               uuid.UUID              `json:"id" format:"uuid" table:"id"`
	CreatedAt        time.Time              `json:"created_at" format:"date-time" table:"created at"`
	StartedAt        *time.Time             `json:"started_at,omitempty" format:"date-time" table:"started at"`
	CompletedAt      *time.Time             `json:"completed_at,omitempty" format:"date-time" table:"completed at"`
	CanceledAt       *time.Time             `json:"canceled_at,omitempty" format:"date-time" table:"canceled at"`
	Error            string                 `json:"error,omitempty" table:"error"`
	ErrorCode        JobErrorCode           `json:"error_code,omitempty" enums:"REQUIRED_TEMPLATE_VARIABLES" table:"error code"`
	Status           ProvisionerJobStatus   `json:"status" enums:"pending,running,succeeded,canceling,canceled,failed" table:"status"`
	WorkerID         *uuid.UUID             `json:"worker_id,omitempty" format:"uuid" table:"worker id"`
	WorkerName       string                 `json:"worker_name,omitempty" table:"worker name"`
	FileID           uuid.UUID              `json:"file_id" format:"uuid" table:"file id"`
	Tags             map[string]string      `json:"tags" table:"tags"`
	QueuePosition    int                    `json:"queue_position" table:"queue position"`
	QueueSize        int                    `json:"queue_size" table:"queue size"`
	OrganizationID   uuid.UUID              `json:"organization_id" format:"uuid" table:"organization id"`
	InitiatorID      uuid.UUID              `json:"initiator_id" format:"uuid" table:"initiator id"`
	Input            ProvisionerJobInput    `json:"input" table:"input,recursive_inline"`
	Type             ProvisionerJobType     `json:"type" table:"type"`
	AvailableWorkers []uuid.UUID            `json:"available_workers,omitempty" format:"uuid" table:"available workers"`
	Metadata         ProvisionerJobMetadata `json:"metadata" table:"metadata,recursive_inline"`
	LogsOverflowed   bool                   `json:"logs_overflowed" table:"logs overflowed"`
}

ProvisionerJob describes the job executed by the provisioning daemon.

type ProvisionerJobInput struct {
	TemplateVersionID *uuid.UUID `json:"template_version_id,omitempty" format:"uuid" table:"template version id"`
	WorkspaceBuildID  *uuid.UUID `json:"workspace_build_id,omitempty" format:"uuid" table:"workspace build id"`
	Error             string     `json:"error,omitempty" table:"-"`
}

ProvisionerJobInput represents the input for the job.

type ProvisionerJobLog struct {
	ID        int64     `json:"id"`
	CreatedAt time.Time `json:"created_at" format:"date-time"`
	Source    LogSource `json:"log_source"`
	Level     LogLevel  `json:"log_level" enums:"trace,debug,info,warn,error"`
	Stage     string    `json:"stage"`
	Output    string    `json:"output"`
}

ProvisionerJobLog represents the provisioner log entry annotated with source and level.

Text formats the log entry as human-readable text.

type ProvisionerJobMetadata struct {
	TemplateVersionName string     `json:"template_version_name" table:"template version name"`
	TemplateID          uuid.UUID  `json:"template_id" format:"uuid" table:"template id"`
	TemplateName        string     `json:"template_name" table:"template name"`
	TemplateDisplayName string     `json:"template_display_name" table:"template display name"`
	TemplateIcon        string     `json:"template_icon" table:"template icon"`
	WorkspaceID         *uuid.UUID `json:"workspace_id,omitempty" format:"uuid" table:"workspace id"`
	WorkspaceName       string     `json:"workspace_name,omitempty" table:"workspace name"`
}

ProvisionerJobMetadata contains metadata for the job.

type ProvisionerJobStatus string

ProvisionerJobStatus represents the at-time state of a job.

const (
	ProvisionerJobPending   ProvisionerJobStatus = "pending"
	ProvisionerJobRunning   ProvisionerJobStatus = "running"
	ProvisionerJobSucceeded ProvisionerJobStatus = "succeeded"
	ProvisionerJobCanceling ProvisionerJobStatus = "canceling"
	ProvisionerJobCanceled  ProvisionerJobStatus = "canceled"
	ProvisionerJobFailed    ProvisionerJobStatus = "failed"
	ProvisionerJobUnknown   ProvisionerJobStatus = "unknown"
)
func ProvisionerJobStatusEnums() []ProvisionerJobStatus

Active returns whether the job is still active or not. It returns true if canceling as well, since the job isn't in an entirely inactive state yet.

type ProvisionerJobType string

ProvisionerJobType represents the type of job.

const (
	ProvisionerJobTypeTemplateVersionImport ProvisionerJobType = "template_version_import"
	ProvisionerJobTypeWorkspaceBuild        ProvisionerJobType = "workspace_build"
	ProvisionerJobTypeTemplateVersionDryRun ProvisionerJobType = "template_version_dry_run"
)
type ProvisionerKey struct {
	ID             uuid.UUID          `json:"id" table:"-" format:"uuid"`
	CreatedAt      time.Time          `json:"created_at" table:"created at" format:"date-time"`
	OrganizationID uuid.UUID          `json:"organization" table:"-" format:"uuid"`
	Name           string             `json:"name" table:"name,default_sort"`
	Tags           ProvisionerKeyTags `json:"tags" table:"tags"`
}
type ProvisionerKeyDaemons struct {
	Key     ProvisionerKey      `json:"key"`
	Daemons []ProvisionerDaemon `json:"daemons"`
}
type ProvisionerLogLevel string
const (
	ProvisionerLogLevelDebug ProvisionerLogLevel = "debug"
)
type ProvisionerStorageMethod string
const (
	ProvisionerStorageMethodFile ProvisionerStorageMethod = "file"
)
type ProvisionerTiming struct {
	JobID     uuid.UUID   `json:"job_id" format:"uuid"`
	StartedAt time.Time   `json:"started_at" format:"date-time"`
	EndedAt   time.Time   `json:"ended_at" format:"date-time"`
	Stage     TimingStage `json:"stage"`
	Source    string      `json:"source"`
	Action    string      `json:"action"`
	Resource  string      `json:"resource"`
}
const (
	ProvisionerTypeEcho      ProvisionerType = "echo"
	ProvisionerTypeTerraform ProvisionerType = "terraform"
)
type ProxyHealthReport struct {
	
	Errors []string `json:"errors"`
	
	
	Warnings []string `json:"warnings"`
}

ProxyHealthReport is a report of the health of the workspace proxy. A healthy report will have no errors. Warnings are not fatal.

const (
	
	
	ProxyHealthy ProxyHealthStatus = "ok"
	
	ProxyUnreachable ProxyHealthStatus = "unreachable"
	
	
	ProxyUnhealthy ProxyHealthStatus = "unhealthy"
	
	
	ProxyUnregistered ProxyHealthStatus = "unregistered"
)
type PutExtendWorkspaceRequest struct {
	Deadline time.Time `json:"deadline" validate:"required" format:"date-time"`
}

PutExtendWorkspaceRequest is a request to extend the deadline of the active workspace build.

type PutOAuth2ProviderAppRequest struct {
	Name        string `json:"name" validate:"required,oauth2_app_name"`
	CallbackURL string `json:"callback_url" validate:"required,http_url"`
	Icon        string `json:"icon" validate:"omitempty"`
}
const (
	ActionApplicationConnect RBACAction = "application_connect"
	ActionAssign             RBACAction = "assign"
	ActionCreate             RBACAction = "create"
	ActionCreateAgent        RBACAction = "create_agent"
	ActionDelete             RBACAction = "delete"
	ActionDeleteAgent        RBACAction = "delete_agent"
	ActionRead               RBACAction = "read"
	ActionReadPersonal       RBACAction = "read_personal"
	ActionSSH                RBACAction = "ssh"
	ActionShare              RBACAction = "share"
	ActionUnassign           RBACAction = "unassign"
	ActionUpdate             RBACAction = "update"
	ActionUpdateAgent        RBACAction = "update_agent"
	ActionUpdatePersonal     RBACAction = "update_personal"
	ActionUse                RBACAction = "use"
	ActionViewInsights       RBACAction = "view_insights"
	ActionWorkspaceStart     RBACAction = "start"
	ActionWorkspaceStop      RBACAction = "stop"
)
const (
	ResourceWildcard                      RBACResource = "*"
	ResourceAibridgeInterception          RBACResource = "aibridge_interception"
	ResourceApiKey                        RBACResource = "api_key"
	ResourceAssignOrgRole                 RBACResource = "assign_org_role"
	ResourceAssignRole                    RBACResource = "assign_role"
	ResourceAuditLog                      RBACResource = "audit_log"
	ResourceBoundaryUsage                 RBACResource = "boundary_usage"
	ResourceConnectionLog                 RBACResource = "connection_log"
	ResourceCryptoKey                     RBACResource = "crypto_key"
	ResourceDebugInfo                     RBACResource = "debug_info"
	ResourceDeploymentConfig              RBACResource = "deployment_config"
	ResourceDeploymentStats               RBACResource = "deployment_stats"
	ResourceFile                          RBACResource = "file"
	ResourceGroup                         RBACResource = "group"
	ResourceGroupMember                   RBACResource = "group_member"
	ResourceIdpsyncSettings               RBACResource = "idpsync_settings"
	ResourceInboxNotification             RBACResource = "inbox_notification"
	ResourceLicense                       RBACResource = "license"
	ResourceNotificationMessage           RBACResource = "notification_message"
	ResourceNotificationPreference        RBACResource = "notification_preference"
	ResourceNotificationTemplate          RBACResource = "notification_template"
	ResourceOauth2App                     RBACResource = "oauth2_app"
	ResourceOauth2AppCodeToken            RBACResource = "oauth2_app_code_token"
	ResourceOauth2AppSecret               RBACResource = "oauth2_app_secret"
	ResourceOrganization                  RBACResource = "organization"
	ResourceOrganizationMember            RBACResource = "organization_member"
	ResourcePrebuiltWorkspace             RBACResource = "prebuilt_workspace"
	ResourceProvisionerDaemon             RBACResource = "provisioner_daemon"
	ResourceProvisionerJobs               RBACResource = "provisioner_jobs"
	ResourceReplicas                      RBACResource = "replicas"
	ResourceSystem                        RBACResource = "system"
	ResourceTailnetCoordinator            RBACResource = "tailnet_coordinator"
	ResourceTask                          RBACResource = "task"
	ResourceTemplate                      RBACResource = "template"
	ResourceUsageEvent                    RBACResource = "usage_event"
	ResourceUser                          RBACResource = "user"
	ResourceUserSecret                    RBACResource = "user_secret"
	ResourceWebpushSubscription           RBACResource = "webpush_subscription"
	ResourceWorkspace                     RBACResource = "workspace"
	ResourceWorkspaceAgentDevcontainers   RBACResource = "workspace_agent_devcontainers"
	ResourceWorkspaceAgentResourceMonitor RBACResource = "workspace_agent_resource_monitor"
	ResourceWorkspaceDormant              RBACResource = "workspace_dormant"
	ResourceWorkspaceProxy                RBACResource = "workspace_proxy"
)
type RateLimitConfig struct {
	DisableAll serpent.Bool  `json:"disable_all" typescript:",notnull"`
	API        serpent.Int64 `json:"api" typescript:",notnull"`
}
type ReducedUser struct {
	MinimalUser `table:"m,recursive_inline"`
	Email       string    `json:"email" validate:"required" table:"email" format:"email"`
	CreatedAt   time.Time `json:"created_at" validate:"required" table:"created at" format:"date-time"`
	UpdatedAt   time.Time `json:"updated_at" table:"updated at" format:"date-time"`
	LastSeenAt  time.Time `json:"last_seen_at,omitempty" format:"date-time"`

	Status    UserStatus `json:"status" table:"status" enums:"active,suspended"`
	LoginType LoginType  `json:"login_type"`
	
	
	ThemePreference string `json:"theme_preference,omitempty"`
}

ReducedUser omits role and organization information. Roles are deduced from the user's site and organization roles. This requires fetching the user's organizational memberships. Fetching that is more expensive, and not usually required by the frontend.

type Region struct {
	ID          uuid.UUID `json:"id" format:"uuid" table:"id"`
	Name        string    `json:"name" table:"name,default_sort"`
	DisplayName string    `json:"display_name" table:"display name"`
	IconURL     string    `json:"icon_url" table:"icon url"`
	Healthy     bool      `json:"healthy" table:"healthy"`

	
	
	
	PathAppURL string `json:"path_app_url" table:"url"`

	
	
	
	
	WildcardHostname string `json:"wildcard_hostname" table:"wildcard hostname"`
}
type RegionTypes interface {
	Region | WorkspaceProxy
}
type RegionsResponse[R RegionTypes] struct {
	Regions []R `json:"regions"`
}
type Replica struct {
	
	ID uuid.UUID `json:"id" format:"uuid"`
	
	Hostname string `json:"hostname"`
	
	CreatedAt time.Time `json:"created_at" format:"date-time"`
	
	RelayAddress string `json:"relay_address"`
	
	RegionID int32 `json:"region_id"`
	
	Error string `json:"error"`
	
	DatabaseLatency int32 `json:"database_latency"`
}
type RequestOneTimePasscodeRequest struct {
	Email string `json:"email" validate:"required,email" format:"email"`
}

RequestOneTimePasscodeRequest enables callers to request a one-time-passcode to change their password.

RequestOption is a function that can be used to modify an http.Request.

func ListInboxNotificationsRequestToQueryParams(req ListInboxNotificationsRequest) []RequestOption
func WithQueryParam(key, value string) RequestOption

WithQueryParam adds a query parameter to the request.

type ResolveAutostartResponse struct {
	ParameterMismatch bool `json:"parameter_mismatch"`
}
const (
	ResourceTypeTemplate              ResourceType = "template"
	ResourceTypeTemplateVersion       ResourceType = "template_version"
	ResourceTypeUser                  ResourceType = "user"
	ResourceTypeWorkspace             ResourceType = "workspace"
	ResourceTypeWorkspaceBuild        ResourceType = "workspace_build"
	ResourceTypeGitSSHKey             ResourceType = "git_ssh_key"
	ResourceTypeAPIKey                ResourceType = "api_key"
	ResourceTypeGroup                 ResourceType = "group"
	ResourceTypeLicense               ResourceType = "license"
	ResourceTypeConvertLogin          ResourceType = "convert_login"
	ResourceTypeHealthSettings        ResourceType = "health_settings"
	ResourceTypeNotificationsSettings ResourceType = "notifications_settings"
	ResourceTypePrebuildsSettings     ResourceType = "prebuilds_settings"
	ResourceTypeWorkspaceProxy        ResourceType = "workspace_proxy"
	ResourceTypeOrganization          ResourceType = "organization"
	ResourceTypeOAuth2ProviderApp     ResourceType = "oauth2_provider_app"
	
	ResourceTypeOAuth2ProviderAppSecret     ResourceType = "oauth2_provider_app_secret"
	ResourceTypeCustomRole                  ResourceType = "custom_role"
	ResourceTypeOrganizationMember          ResourceType = "organization_member"
	ResourceTypeNotificationTemplate        ResourceType = "notification_template"
	ResourceTypeIdpSyncSettingsOrganization ResourceType = "idp_sync_settings_organization"
	ResourceTypeIdpSyncSettingsGroup        ResourceType = "idp_sync_settings_group"
	ResourceTypeIdpSyncSettingsRole         ResourceType = "idp_sync_settings_role"
	
	
	ResourceTypeWorkspaceAgent ResourceType = "workspace_agent"
	
	
	ResourceTypeWorkspaceApp ResourceType = "workspace_app"
	ResourceTypeTask         ResourceType = "task"
)
type Response struct {
	
	
	
	
	
	Message string `json:"message"`
	
	
	
	
	
	Detail string `json:"detail,omitempty"`
	
	
	
	Validations []ValidationError `json:"validations,omitempty"`
}

Response represents a generic HTTP response.

type ResumeTaskResponse struct {
	WorkspaceBuild *WorkspaceBuild `json:"workspace_build"`
}

ResumeTaskResponse represents the response from resuming a task.

type RetentionConfig struct {
	
	
	AuditLogs serpent.Duration `json:"audit_logs" typescript:",notnull"`
	
	
	ConnectionLogs serpent.Duration `json:"connection_logs" typescript:",notnull"`
	
	
	
	APIKeys serpent.Duration `json:"api_keys" typescript:",notnull"`
	
	
	
	
	WorkspaceAgentLogs serpent.Duration `json:"workspace_agent_logs" typescript:",notnull"`
}

RetentionConfig contains configuration for data retention policies. These settings control how long various types of data are retained in the database before being automatically purged. Setting a value to 0 disables retention for that data type (data is kept indefinitely).

type Role struct {
	Name            string       `json:"name" table:"name,default_sort" validate:"username"`
	OrganizationID  string       `json:"organization_id,omitempty" table:"organization id" format:"uuid"`
	DisplayName     string       `json:"display_name" table:"display name"`
	SitePermissions []Permission `json:"site_permissions" table:"site permissions"`
	UserPermissions []Permission `json:"user_permissions" table:"user permissions"`
	
	OrganizationPermissions []Permission `json:"organization_permissions" table:"organization permissions"`
	
	OrganizationMemberPermissions []Permission `json:"organization_member_permissions" table:"organization member permissions"`
}

Role is a longer form of SlimRole that includes permissions details.

FullName returns the role name scoped to the organization ID. This is useful if printing a set of roles from different scopes, as duplicated names across multiple scopes will become unique. In practice, this is primarily used in testing.

type RoleSyncSettings struct {
	
	
	Field string `json:"field"`
	
	Mapping map[string][]string `json:"mapping"`
}

SSHConfig is configuration the cli & vscode extension use for configuring ssh connections.

type SSHConfigResponse struct {
	
	
	HostnamePrefix string `json:"hostname_prefix"`

	
	HostnameSuffix   string            `json:"hostname_suffix"`
	SSHConfigOptions map[string]string `json:"ssh_config_options"`
}
type ServeProvisionerDaemonRequest struct {
	
	
	ID uuid.UUID `json:"id" format:"uuid"`
	
	Name string `json:"name" example:"my-cool-provisioner-daemon"`
	
	
	Organization uuid.UUID `json:"organization" format:"uuid"`
	
	Provisioners []ProvisionerType `json:"provisioners"`
	
	Tags map[string]string `json:"tags"`
	
	PreSharedKey string `json:"pre_shared_key"`
	
	ProvisionerKey string `json:"provisioner_key"`
}

ServeProvisionerDaemonRequest are the parameters to call ServeProvisionerDaemon with @typescript-ignore ServeProvisionerDaemonRequest

type ServerSentEvent struct {
	Type ServerSentEventType `json:"type"`
	Data interface{}         `json:"data"`
}
type ServerSentEventType string
const (
	ServerSentEventTypePing  ServerSentEventType = "ping"
	ServerSentEventTypeData  ServerSentEventType = "data"
	ServerSentEventTypeError ServerSentEventType = "error"
)
type ServiceBannerConfig = BannerConfig

Deprecated: ServiceBannerConfig has been renamed to BannerConfig.

type SessionCountDeploymentStats struct {
	VSCode          int64 `json:"vscode"`
	SSH             int64 `json:"ssh"`
	JetBrains       int64 `json:"jetbrains"`
	ReconnectingPTY int64 `json:"reconnecting_pty"`
}
type SessionLifetime struct {
	
	
	
	DisableExpiryRefresh serpent.Bool `json:"disable_expiry_refresh,omitempty" typescript:",notnull"`

	
	DefaultDuration serpent.Duration `json:"default_duration" typescript:",notnull"`

	
	
	
	RefreshDefaultDuration serpent.Duration `json:"refresh_default_duration,omitempty" typescript:",notnull"`

	DefaultTokenDuration serpent.Duration `json:"default_token_lifetime,omitempty" typescript:",notnull"`

	MaximumTokenDuration serpent.Duration `json:"max_token_lifetime,omitempty" typescript:",notnull"`

	MaximumAdminTokenDuration serpent.Duration `json:"max_admin_token_lifetime,omitempty" typescript:",notnull"`
}

SessionLifetime refers to "sessions" authenticating into Coderd. Coder has multiple different session types: api keys, tokens, workspace app tokens, agent tokens, etc. This configuration struct should be used to group all settings referring to any of these session lifetime controls. TODO: These config options were created back when coder only had api keys. Today, the config is ambigously used for all of them. For example: - cli based api keys ignore all settings - login uses the default lifetime, not the MaximumTokenDuration - Tokens use the Default & MaximumTokenDuration - ... etc ... The rational behind each decision is undocumented. The naming behind these config options is also confusing without any clear documentation. 'CreateAPIKey' is used to make all sessions, and it's parameters are just 'LifetimeSeconds' and 'DefaultLifetime'. Which does not directly correlate to the config options here.

SessionTokenProvider provides the session token to access the Coder service (coderd). @typescript-ignore SessionTokenProvider

type SharedWorkspaceActor struct {
	ID        uuid.UUID                `json:"id" format:"uuid"`
	ActorType SharedWorkspaceActorType `json:"actor_type" enums:"group,user"`
	Name      string                   `json:"name"`
	AvatarURL string                   `json:"avatar_url,omitempty" format:"uri"`
	Roles     []WorkspaceRole          `json:"roles"`
}
type SharedWorkspaceActorType string
const (
	SharedWorkspaceActorTypeGroup SharedWorkspaceActorType = "group"
	SharedWorkspaceActorTypeUser  SharedWorkspaceActorType = "user"
)
type SlimRole struct {
	Name           string `json:"name"`
	DisplayName    string `json:"display_name"`
	OrganizationID string `json:"organization_id,omitempty"`
}

SlimRole omits permission information from a role. At present, this is because our apis do not return permission information, and it would require extra db calls to fetch this information. The UI does not need it, so most api calls will use this structure that omits information.

UniqueName concatenates the organization ID to create a globally unique string name for the role.

type StatsCollectionConfig struct {
	UsageStats UsageStatsConfig `json:"usage_stats" tyescript:",notnull"`
}
type SupportConfig struct {
	Links serpent.Struct[[]LinkConfig] `json:"links" typescript:",notnull"`
}
type SwaggerConfig struct {
	Enable serpent.Bool `json:"enable" typescript:",notnull"`
}
type TLSConfig struct {
	Enable               serpent.Bool        `json:"enable" typescript:",notnull"`
	Address              serpent.HostPort    `json:"address" typescript:",notnull"`
	RedirectHTTP         serpent.Bool        `json:"redirect_http" typescript:",notnull"`
	CertFiles            serpent.StringArray `json:"cert_file" typescript:",notnull"`
	ClientAuth           serpent.String      `json:"client_auth" typescript:",notnull"`
	ClientCAFile         serpent.String      `json:"client_ca_file" typescript:",notnull"`
	KeyFiles             serpent.StringArray `json:"key_file" typescript:",notnull"`
	MinVersion           serpent.String      `json:"min_version" typescript:",notnull"`
	ClientCertFile       serpent.String      `json:"client_cert_file" typescript:",notnull"`
	ClientKeyFile        serpent.String      `json:"client_key_file" typescript:",notnull"`
	SupportedCiphers     serpent.StringArray `json:"supported_ciphers" typescript:",notnull"`
	AllowInsecureCiphers serpent.Bool        `json:"allow_insecure_ciphers" typescript:",notnull"`
}
type Task struct {
	ID                      uuid.UUID                `json:"id" format:"uuid" table:"id"`
	OrganizationID          uuid.UUID                `json:"organization_id" format:"uuid" table:"organization id"`
	OwnerID                 uuid.UUID                `json:"owner_id" format:"uuid" table:"owner id"`
	OwnerName               string                   `json:"owner_name" table:"owner name"`
	OwnerAvatarURL          string                   `json:"owner_avatar_url,omitempty" table:"owner avatar url"`
	Name                    string                   `json:"name" table:"name,default_sort"`
	DisplayName             string                   `json:"display_name" table:"display_name"`
	TemplateID              uuid.UUID                `json:"template_id" format:"uuid" table:"template id"`
	TemplateVersionID       uuid.UUID                `json:"template_version_id" format:"uuid" table:"template version id"`
	TemplateName            string                   `json:"template_name" table:"template name"`
	TemplateDisplayName     string                   `json:"template_display_name" table:"template display name"`
	TemplateIcon            string                   `json:"template_icon" table:"template icon"`
	WorkspaceID             uuid.NullUUID            `json:"workspace_id" format:"uuid" table:"workspace id"`
	WorkspaceName           string                   `json:"workspace_name" table:"workspace name"`
	WorkspaceStatus         WorkspaceStatus          `` 
	WorkspaceBuildNumber    int32                    `json:"workspace_build_number,omitempty" table:"workspace build number"`
	WorkspaceAgentID        uuid.NullUUID            `json:"workspace_agent_id" format:"uuid" table:"workspace agent id"`
	WorkspaceAgentLifecycle *WorkspaceAgentLifecycle `json:"workspace_agent_lifecycle" table:"workspace agent lifecycle"`
	WorkspaceAgentHealth    *WorkspaceAgentHealth    `json:"workspace_agent_health" table:"workspace agent health"`
	WorkspaceAppID          uuid.NullUUID            `json:"workspace_app_id" format:"uuid" table:"workspace app id"`
	InitialPrompt           string                   `json:"initial_prompt" table:"initial prompt"`
	Status                  TaskStatus               `json:"status" enums:"pending,initializing,active,paused,unknown,error" table:"status"`
	CurrentState            *TaskStateEntry          `json:"current_state" table:"cs,recursive_inline,empty_nil"`
	CreatedAt               time.Time                `json:"created_at" format:"date-time" table:"created at"`
	UpdatedAt               time.Time                `json:"updated_at" format:"date-time" table:"updated at"`
}

Task represents a task.

type TaskLogEntry struct {
	ID      int         `json:"id" table:"id"`
	Content string      `json:"content" table:"content"`
	Type    TaskLogType `json:"type" enum:"input,output" table:"type"`
	Time    time.Time   `json:"time" format:"date-time" table:"time,default_sort"`
}

TaskLogEntry represents a single log entry for a task.

TaskLogType indicates the source of a task log entry.

const (
	TaskLogTypeInput  TaskLogType = "input"
	TaskLogTypeOutput TaskLogType = "output"
)

TaskLogType enums.

type TaskLogsResponse struct {
	Logs       []TaskLogEntry `json:"logs"`
	Snapshot   bool           `json:"snapshot,omitempty"`
	SnapshotAt *time.Time     `json:"snapshot_at,omitempty"`
}

TaskLogsResponse contains task logs and metadata. When snapshot is false, logs are fetched live from the task app. When snapshot is true, logs are fetched from a stored snapshot captured during pause.

type TaskSendRequest struct {
	Input string `json:"input"`
}

TaskSendRequest is used to send task input to the tasks sidebar app.

TaskState represents the high-level lifecycle of a task.

const (
	
	
	TaskStateWorking TaskState = "working"
	
	
	TaskStateIdle TaskState = "idle"
	
	
	TaskStateComplete TaskState = "complete"
	
	
	TaskStateFailed TaskState = "failed"
)

TaskState enums.

type TaskStateEntry struct {
	Timestamp time.Time `json:"timestamp" format:"date-time" table:"-"`
	State     TaskState `json:"state" enum:"working,idle,completed,failed" table:"state"`
	Message   string    `json:"message" table:"message"`
	URI       string    `json:"uri" table:"-"`
}

TaskStateEntry represents a single entry in the task's state history.

TaskStatus represents the status of a task.

const (
	
	
	TaskStatusPending TaskStatus = "pending"
	
	
	TaskStatusInitializing TaskStatus = "initializing"
	
	
	
	TaskStatusActive TaskStatus = "active"
	
	
	TaskStatusPaused TaskStatus = "paused"
	
	
	TaskStatusUnknown TaskStatus = "unknown"
	
	
	TaskStatusError TaskStatus = "error"
)
func AllTaskStatuses() []TaskStatus
type TasksFilter struct {
	
	Owner string `json:"owner,omitempty"`
	
	Organization string `json:"organization,omitempty"`
	
	Status TaskStatus `json:"status,omitempty"`
	
	FilterQuery string `json:"filter_query,omitempty"`
}

TasksFilter filters the list of tasks.

type TasksListResponse struct {
	Tasks []Task `json:"tasks"`
	Count int    `json:"count"`
}

TaskListResponse is the response shape for tasks list.

type TelemetryConfig struct {
	Enable serpent.Bool `json:"enable" typescript:",notnull"`
	Trace  serpent.Bool `json:"trace" typescript:",notnull"`
	URL    serpent.URL  `json:"url" typescript:",notnull"`
}
type Template struct {
	ID                      uuid.UUID       `json:"id" format:"uuid"`
	CreatedAt               time.Time       `json:"created_at" format:"date-time"`
	UpdatedAt               time.Time       `json:"updated_at" format:"date-time"`
	OrganizationID          uuid.UUID       `json:"organization_id" format:"uuid"`
	OrganizationName        string          `json:"organization_name" format:"url"`
	OrganizationDisplayName string          `json:"organization_display_name"`
	OrganizationIcon        string          `json:"organization_icon"`
	Name                    string          `json:"name"`
	DisplayName             string          `json:"display_name"`
	Provisioner             ProvisionerType `json:"provisioner" enums:"terraform"`
	ActiveVersionID         uuid.UUID       `json:"active_version_id" format:"uuid"`
	
	ActiveUserCount    int                    `json:"active_user_count"`
	BuildTimeStats     TemplateBuildTimeStats `json:"build_time_stats"`
	Description        string                 `json:"description"`
	Deprecated         bool                   `json:"deprecated"`
	DeprecationMessage string                 `json:"deprecation_message"`
	Deleted            bool                   `json:"deleted"`
	Icon               string                 `json:"icon"`
	DefaultTTLMillis   int64                  `json:"default_ttl_ms"`
	ActivityBumpMillis int64                  `json:"activity_bump_ms"`
	
	
	
	AutostopRequirement  TemplateAutostopRequirement  `json:"autostop_requirement"`
	AutostartRequirement TemplateAutostartRequirement `json:"autostart_requirement"`
	CreatedByID          uuid.UUID                    `json:"created_by_id" format:"uuid"`
	CreatedByName        string                       `json:"created_by_name"`

	
	
	
	AllowUserAutostart           bool `json:"allow_user_autostart"`
	AllowUserAutostop            bool `json:"allow_user_autostop"`
	AllowUserCancelWorkspaceJobs bool `json:"allow_user_cancel_workspace_jobs"`

	
	
	
	FailureTTLMillis               int64 `json:"failure_ttl_ms"`
	TimeTilDormantMillis           int64 `json:"time_til_dormant_ms"`
	TimeTilDormantAutoDeleteMillis int64 `json:"time_til_dormant_autodelete_ms"`

	
	
	RequireActiveVersion bool                         `json:"require_active_version"`
	MaxPortShareLevel    WorkspaceAgentPortShareLevel `json:"max_port_share_level"`
	CORSBehavior         CORSBehavior                 `json:"cors_behavior"`

	UseClassicParameterFlow bool `json:"use_classic_parameter_flow"`

	
	
	DisableModuleCache bool `json:"disable_module_cache"`
}

Template is the JSON representation of a Coder template. This type matches the database object for now, but is abstracted for ease of change later on.

type TemplateACL struct {
	Users  []TemplateUser  `json:"users"`
	Groups []TemplateGroup `json:"group"`
}
type TemplateAppUsage struct {
	TemplateIDs []uuid.UUID      `json:"template_ids" format:"uuid"`
	Type        TemplateAppsType `json:"type" example:"builtin"`
	DisplayName string           `json:"display_name" example:"Visual Studio Code"`
	Slug        string           `json:"slug" example:"vscode"`
	Icon        string           `json:"icon"`
	Seconds     int64            `json:"seconds" example:"80500"`
	TimesUsed   int64            `json:"times_used" example:"2"`
}

TemplateAppUsage shows the usage of an app for one or more templates.

TemplateAppsType defines the type of app reported.

const (
	TemplateAppsTypeBuiltin TemplateAppsType = "builtin"
	TemplateAppsTypeApp     TemplateAppsType = "app"
)

TemplateAppsType enums.

type TemplateAutostartRequirement struct {
	
	
	DaysOfWeek []string `json:"days_of_week" enums:"monday,tuesday,wednesday,thursday,friday,saturday,sunday"`
}
type TemplateAutostopRequirement struct {
	
	
	
	
	
	
	
	DaysOfWeek []string `json:"days_of_week" enums:"monday,tuesday,wednesday,thursday,friday,saturday,sunday"`
	
	
	
	
	
	Weeks int64 `json:"weeks"`
}
type TemplateBuildTimeStats map[WorkspaceTransition]TransitionStats
type TemplateExample struct {
	ID          string   `json:"id" format:"uuid"`
	URL         string   `json:"url"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Icon        string   `json:"icon"`
	Tags        []string `json:"tags"`
	Markdown    string   `json:"markdown"`
}
type TemplateFilter struct {
	OrganizationID uuid.UUID `typescript:"-"`
	ExactName      string    `typescript:"-"`
	FuzzyName      string    `typescript:"-"`
	AuthorUsername string    `typescript:"-"`
	SearchQuery    string    `json:"q,omitempty"`
}
type TemplateGroup struct {
	Group
	Role TemplateRole `json:"role" enums:"admin,use"`
}
type TemplateInsightsIntervalReport struct {
	StartTime   time.Time              `json:"start_time" format:"date-time"`
	EndTime     time.Time              `json:"end_time" format:"date-time"`
	TemplateIDs []uuid.UUID            `json:"template_ids" format:"uuid"`
	Interval    InsightsReportInterval `json:"interval" example:"week"`
	ActiveUsers int64                  `json:"active_users" example:"14"`
}

TemplateInsightsIntervalReport is the report from the template insights endpoint for a specific interval.

type TemplateInsightsReport struct {
	StartTime       time.Time                `json:"start_time" format:"date-time"`
	EndTime         time.Time                `json:"end_time" format:"date-time"`
	TemplateIDs     []uuid.UUID              `json:"template_ids" format:"uuid"`
	ActiveUsers     int64                    `json:"active_users" example:"22"`
	AppsUsage       []TemplateAppUsage       `json:"apps_usage"`
	ParametersUsage []TemplateParameterUsage `json:"parameters_usage"`
}

TemplateInsightsReport is the report from the template insights endpoint.

type TemplateInsightsRequest struct {
	StartTime   time.Time                 `json:"start_time" format:"date-time"`
	EndTime     time.Time                 `json:"end_time" format:"date-time"`
	TemplateIDs []uuid.UUID               `json:"template_ids" format:"uuid"`
	Interval    InsightsReportInterval    `json:"interval" example:"day"`
	Sections    []TemplateInsightsSection `json:"sections" example:"report"`
}
type TemplateInsightsResponse struct {
	Report          *TemplateInsightsReport          `json:"report,omitempty"`
	IntervalReports []TemplateInsightsIntervalReport `json:"interval_reports,omitempty"`
}

TemplateInsightsResponse is the response from the template insights endpoint.

type TemplateInsightsSection string

TemplateInsightsSection defines the section to be included in the template insights response.

const (
	TemplateInsightsSectionIntervalReports TemplateInsightsSection = "interval_reports"
	TemplateInsightsSectionReport          TemplateInsightsSection = "report"
)

TemplateInsightsSection enums.

type TemplateParameterUsage struct {
	TemplateIDs []uuid.UUID                      `json:"template_ids" format:"uuid"`
	DisplayName string                           `json:"display_name"`
	Name        string                           `json:"name"`
	Type        string                           `json:"type"`
	Description string                           `json:"description"`
	Options     []TemplateVersionParameterOption `json:"options,omitempty"`
	Values      []TemplateParameterValue         `json:"values"`
}

TemplateParameterUsage shows the usage of a parameter for one or more templates.

type TemplateParameterValue struct {
	Value string `json:"value"`
	Count int64  `json:"count"`
}

TemplateParameterValue shows the usage of a parameter value for one or more templates.

const (
	TemplateRoleAdmin   TemplateRole = "admin"
	TemplateRoleUse     TemplateRole = "use"
	TemplateRoleDeleted TemplateRole = ""
)
type TemplateUser struct {
	User
	Role TemplateRole `json:"role" enums:"admin,use"`
}
type TemplateVersion struct {
	ID             uuid.UUID      `json:"id" format:"uuid"`
	TemplateID     *uuid.UUID     `json:"template_id,omitempty" format:"uuid"`
	OrganizationID uuid.UUID      `json:"organization_id,omitempty" format:"uuid"`
	CreatedAt      time.Time      `json:"created_at" format:"date-time"`
	UpdatedAt      time.Time      `json:"updated_at" format:"date-time"`
	Name           string         `json:"name"`
	Message        string         `json:"message"`
	Job            ProvisionerJob `json:"job"`
	Readme         string         `json:"readme"`
	CreatedBy      MinimalUser    `json:"created_by"`
	Archived       bool           `json:"archived"`

	Warnings            []TemplateVersionWarning `json:"warnings,omitempty" enums:"DEPRECATED_PARAMETERS"`
	MatchedProvisioners *MatchedProvisioners     `json:"matched_provisioners,omitempty"`

	HasExternalAgent bool `json:"has_external_agent"`
}

TemplateVersion represents a single version of a template.

type TemplateVersionExternalAuth struct {
	ID              string `json:"id"`
	Type            string `json:"type"`
	DisplayName     string `json:"display_name"`
	DisplayIcon     string `json:"display_icon"`
	AuthenticateURL string `json:"authenticate_url"`
	Authenticated   bool   `json:"authenticated"`
	Optional        bool   `json:"optional,omitempty"`
}
type TemplateVersionParameter struct {
	Name                 string `json:"name"`
	DisplayName          string `json:"display_name,omitempty"`
	Description          string `json:"description"`
	DescriptionPlaintext string `json:"description_plaintext"`
	Type                 string `json:"type" enums:"string,number,bool,list(string)"`
	
	
	FormType            string                           `json:"form_type" enums:",radio,dropdown,input,textarea,slider,checkbox,switch,tag-select,multi-select,error"`
	Mutable             bool                             `json:"mutable"`
	DefaultValue        string                           `json:"default_value"`
	Icon                string                           `json:"icon"`
	Options             []TemplateVersionParameterOption `json:"options"`
	ValidationError     string                           `json:"validation_error,omitempty"`
	ValidationRegex     string                           `json:"validation_regex,omitempty"`
	ValidationMin       *int32                           `json:"validation_min,omitempty"`
	ValidationMax       *int32                           `json:"validation_max,omitempty"`
	ValidationMonotonic ValidationMonotonicOrder         `json:"validation_monotonic,omitempty" enums:"increasing,decreasing"`
	Required            bool                             `json:"required"`
	Ephemeral           bool                             `json:"ephemeral"`
}

TemplateVersionParameter represents a parameter for a template version.

type TemplateVersionParameterOption struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Value       string `json:"value"`
	Icon        string `json:"icon"`
}

TemplateVersionParameterOption represents a selectable option for a template parameter.

type TemplateVersionVariable struct {
	Name         string `json:"name"`
	Description  string `json:"description"`
	Type         string `json:"type" enums:"string,number,bool"`
	Value        string `json:"value"`
	DefaultValue string `json:"default_value"`
	Required     bool   `json:"required"`
	Sensitive    bool   `json:"sensitive"`
}

TemplateVersionVariable represents a managed template variable.

type TemplateVersionWarning string
const (
	TemplateVersionWarningUnsupportedWorkspaces TemplateVersionWarning = "UNSUPPORTED_WORKSPACES"
)
type TemplateVersionsByTemplateRequest struct {
	TemplateID      uuid.UUID `json:"template_id" validate:"required" format:"uuid"`
	IncludeArchived bool      `json:"include_archived"`
}

TemplateVersionsByTemplateRequest defines the request parameters for TemplateVersionsByTemplate.

TerminalFontName is the name of supported terminal font

const (
	TerminalFontUnknown       TerminalFontName = ""
	TerminalFontIBMPlexMono   TerminalFontName = "ibm-plex-mono"
	TerminalFontFiraCode      TerminalFontName = "fira-code"
	TerminalFontSourceCodePro TerminalFontName = "source-code-pro"
	TerminalFontJetBrainsMono TerminalFontName = "jetbrains-mono"
)
const (
	
	TimingStageInit  TimingStage = "init"
	TimingStagePlan  TimingStage = "plan"
	TimingStageGraph TimingStage = "graph"
	TimingStageApply TimingStage = "apply"
	
	TimingStageStart TimingStage = "start"
	TimingStageStop  TimingStage = "stop"
	TimingStageCron  TimingStage = "cron"
	
	TimingStageConnect TimingStage = "connect"
)
type TokenConfig struct {
	MaxTokenLifetime time.Duration `json:"max_token_lifetime"`
}
type TokensFilter struct {
	IncludeAll     bool `json:"include_all"`
	IncludeExpired bool `json:"include_expired"`
}
type TraceConfig struct {
	Enable          serpent.Bool   `json:"enable" typescript:",notnull"`
	HoneycombAPIKey serpent.String `json:"honeycomb_api_key" typescript:",notnull"`
	CaptureLogs     serpent.Bool   `json:"capture_logs" typescript:",notnull"`
	DataDog         serpent.Bool   `json:"data_dog" typescript:",notnull"`
}
type TransitionStats struct {
	P50 *int64 `example:"123"`
	P95 *int64 `example:"146"`
}
type UpdateActiveTemplateVersion struct {
	ID uuid.UUID `json:"id" validate:"required" format:"uuid"`
}
type UpdateAppearanceConfig struct {
	ApplicationName string `json:"application_name"`
	LogoURL         string `json:"logo_url"`
	
}
type UpdateCheckResponse struct {
	
	Current bool `json:"current"`
	
	Version string `json:"version"`
	
	URL string `json:"url"`
}

UpdateCheckResponse contains information on the latest release of Coder.

type UpdateInboxNotificationReadStatusRequest struct {
	IsRead bool `json:"is_read"`
}
type UpdateInboxNotificationReadStatusResponse struct {
	Notification InboxNotification `json:"notification"`
	UnreadCount  int               `json:"unread_count"`
}
type UpdateNotificationTemplateMethod struct {
	Method string `json:"method,omitempty" example:"webhook"`
}
type UpdateOrganizationRequest struct {
	Name        string  `json:"name,omitempty" validate:"omitempty,organization_name"`
	DisplayName string  `json:"display_name,omitempty" validate:"omitempty,organization_display_name"`
	Description *string `json:"description,omitempty"`
	Icon        *string `json:"icon,omitempty"`
}
type UpdateRoles struct {
	Roles []string `json:"roles" validate:""`
}
type UpdateTaskInputRequest struct {
	Input string `json:"input"`
}

UpdateTaskInputRequest is used to update a task's input.

type UpdateTemplateACL struct {
	
	
	
	UserPerms map[string]TemplateRole `json:"user_perms,omitempty" example:"<user_id>:admin,4df59e74-c027-470b-ab4d-cbba8963a5e9:use"`
	
	
	
	GroupPerms map[string]TemplateRole `json:"group_perms,omitempty" example:"<group_id>:admin,8bd26b20-f3e8-48be-a903-46bb920cf671:use"`
}
type UpdateTemplateMeta struct {
	Name             string  `json:"name,omitempty" validate:"omitempty,template_name"`
	DisplayName      *string `json:"display_name,omitempty" validate:"omitempty,template_display_name"`
	Description      *string `json:"description,omitempty"`
	Icon             *string `json:"icon,omitempty"`
	DefaultTTLMillis int64   `json:"default_ttl_ms,omitempty"`
	
	
	
	ActivityBumpMillis int64 `json:"activity_bump_ms,omitempty"`
	
	
	
	AutostopRequirement            *TemplateAutostopRequirement  `json:"autostop_requirement,omitempty"`
	AutostartRequirement           *TemplateAutostartRequirement `json:"autostart_requirement,omitempty"`
	AllowUserAutostart             bool                          `json:"allow_user_autostart,omitempty"`
	AllowUserAutostop              bool                          `json:"allow_user_autostop,omitempty"`
	AllowUserCancelWorkspaceJobs   bool                          `json:"allow_user_cancel_workspace_jobs,omitempty"`
	FailureTTLMillis               int64                         `json:"failure_ttl_ms,omitempty"`
	TimeTilDormantMillis           int64                         `json:"time_til_dormant_ms,omitempty"`
	TimeTilDormantAutoDeleteMillis int64                         `json:"time_til_dormant_autodelete_ms,omitempty"`
	
	
	
	
	UpdateWorkspaceLastUsedAt bool `json:"update_workspace_last_used_at"`
	
	
	
	UpdateWorkspaceDormantAt bool `json:"update_workspace_dormant_at"`
	
	
	
	RequireActiveVersion bool `json:"require_active_version,omitempty"`
	
	
	
	
	DeprecationMessage *string `json:"deprecation_message,omitempty"`
	
	
	
	
	
	DisableEveryoneGroupAccess bool                          `json:"disable_everyone_group_access"`
	MaxPortShareLevel          *WorkspaceAgentPortShareLevel `json:"max_port_share_level,omitempty"`
	CORSBehavior               *CORSBehavior                 `json:"cors_behavior,omitempty"`
	
	
	
	
	
	UseClassicParameterFlow *bool `json:"use_classic_parameter_flow,omitempty"`
	
	
	DisableModuleCache *bool `json:"disable_module_cache,omitempty"`
}
type UpdateUserAppearanceSettingsRequest struct {
	ThemePreference string           `json:"theme_preference" validate:"required"`
	TerminalFont    TerminalFontName `json:"terminal_font" validate:"required"`
}
type UpdateUserNotificationPreferences struct {
	TemplateDisabledMap map[string]bool `json:"template_disabled_map"`
}
type UpdateUserPasswordRequest struct {
	OldPassword string `json:"old_password" validate:""`
	Password    string `json:"password" validate:"required"`
}
type UpdateUserPreferenceSettingsRequest struct {
	TaskNotificationAlertDismissed bool `json:"task_notification_alert_dismissed"`
}
type UpdateUserProfileRequest struct {
	Username string `json:"username" validate:"required,username"`
	Name     string `json:"name" validate:"user_real_name"`
}
type UpdateUserQuietHoursScheduleRequest struct {
	
	
	
	
	
	
	
	
	
	
	Schedule string `json:"schedule" validate:"required"`
}
type UpdateWorkspaceACL struct {
	
	
	
	UserRoles map[string]WorkspaceRole `json:"user_roles,omitempty"`
	
	
	
	GroupRoles map[string]WorkspaceRole `json:"group_roles,omitempty"`
}
type UpdateWorkspaceAutomaticUpdatesRequest struct {
	AutomaticUpdates AutomaticUpdates `json:"automatic_updates"`
}

UpdateWorkspaceAutomaticUpdatesRequest is a request to updates a workspace's automatic updates setting.

type UpdateWorkspaceAutostartRequest struct {
	
	
	
	Schedule *string `json:"schedule,omitempty"`
}

UpdateWorkspaceAutostartRequest is a request to update a workspace's autostart schedule.

type UpdateWorkspaceBuildStateRequest struct {
	State []byte `json:"state"`
}

UpdateWorkspaceBuildStateRequest is the request body for updating the provisioner state of a workspace build.

type UpdateWorkspaceDormancy struct {
	Dormant bool `json:"dormant"`
}

UpdateWorkspaceDormancy is a request to activate or make a workspace dormant. A value of false will activate a dormant workspace.

type UpdateWorkspaceProxyResponse struct {
	Proxy      WorkspaceProxy `json:"proxy" table:"p,recursive_inline"`
	ProxyToken string         `json:"proxy_token" table:"proxy token"`
}
type UpdateWorkspaceRequest struct {
	Name string `json:"name,omitempty" validate:"username"`
}
type UpdateWorkspaceTTLRequest struct {
	TTLMillis *int64 `json:"ttl_ms"`
}

UpdateWorkspaceTTLRequest is a request to update a workspace's TTL.

type UploadResponse struct {
	ID uuid.UUID `json:"hash" format:"uuid"`
}

UploadResponse contains the hash to reference the uploaded file.

type UpsertWorkspaceAgentPortShareRequest struct {
	AgentName  string                          `json:"agent_name"`
	Port       int32                           `json:"port"`
	ShareLevel WorkspaceAgentPortShareLevel    `json:"share_level" enums:"owner,authenticated,organization,public"`
	Protocol   WorkspaceAgentPortShareProtocol `json:"protocol" enums:"http,https"`
}
const (
	UsageAppNameVscode          UsageAppName = "vscode"
	UsageAppNameJetbrains       UsageAppName = "jetbrains"
	UsageAppNameReconnectingPty UsageAppName = "reconnecting-pty"
	UsageAppNameSSH             UsageAppName = "ssh"
)
type UsagePeriod struct {
	IssuedAt time.Time `json:"issued_at" format:"date-time"`
	Start    time.Time `json:"start" format:"date-time"`
	End      time.Time `json:"end" format:"date-time"`
}
type UsageStatsConfig struct {
	Enable serpent.Bool `json:"enable" typescript:",notnull"`
}
type User struct {
	ReducedUser `table:"r,recursive_inline"`

	OrganizationIDs []uuid.UUID `json:"organization_ids" format:"uuid"`
	Roles           []SlimRole  `json:"roles"`
}

User represents a user in Coder.

type UserActivity struct {
	TemplateIDs []uuid.UUID `json:"template_ids" format:"uuid"`
	UserID      uuid.UUID   `json:"user_id" format:"uuid"`
	Username    string      `json:"username"`
	AvatarURL   string      `json:"avatar_url" format:"uri"`
	Seconds     int64       `json:"seconds" example:"80500"`
}

UserActivity shows the session time for a user.

type UserActivityInsightsReport struct {
	StartTime   time.Time      `json:"start_time" format:"date-time"`
	EndTime     time.Time      `json:"end_time" format:"date-time"`
	TemplateIDs []uuid.UUID    `json:"template_ids" format:"uuid"`
	Users       []UserActivity `json:"users"`
}

UserActivityInsightsReport is the report from the user activity insights endpoint.

type UserActivityInsightsRequest struct {
	StartTime   time.Time   `json:"start_time" format:"date-time"`
	EndTime     time.Time   `json:"end_time" format:"date-time"`
	TemplateIDs []uuid.UUID `json:"template_ids" format:"uuid"`
}
type UserActivityInsightsResponse struct {
	Report UserActivityInsightsReport `json:"report"`
}

UserActivityInsightsResponse is the response from the user activity insights endpoint.

type UserAppearanceSettings struct {
	ThemePreference string           `json:"theme_preference"`
	TerminalFont    TerminalFontName `json:"terminal_font"`
}
type UserLatency struct {
	TemplateIDs []uuid.UUID       `json:"template_ids" format:"uuid"`
	UserID      uuid.UUID         `json:"user_id" format:"uuid"`
	Username    string            `json:"username"`
	AvatarURL   string            `json:"avatar_url" format:"uri"`
	LatencyMS   ConnectionLatency `json:"latency_ms"`
}

UserLatency shows the connection latency for a user.

type UserLatencyInsightsReport struct {
	StartTime   time.Time     `json:"start_time" format:"date-time"`
	EndTime     time.Time     `json:"end_time" format:"date-time"`
	TemplateIDs []uuid.UUID   `json:"template_ids" format:"uuid"`
	Users       []UserLatency `json:"users"`
}

UserLatencyInsightsReport is the report from the user latency insights endpoint.

type UserLatencyInsightsRequest struct {
	StartTime   time.Time   `json:"start_time" format:"date-time"`
	EndTime     time.Time   `json:"end_time" format:"date-time"`
	TemplateIDs []uuid.UUID `json:"template_ids" format:"uuid"`
}
type UserLatencyInsightsResponse struct {
	Report UserLatencyInsightsReport `json:"report"`
}

UserLatencyInsightsResponse is the response from the user latency insights endpoint.

type UserLoginType struct {
	LoginType LoginType `json:"login_type"`
}
type UserParameter struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}
type UserPreferenceSettings struct {
	TaskNotificationAlertDismissed bool `json:"task_notification_alert_dismissed"`
}
type UserQuietHoursScheduleConfig struct {
}
type UserQuietHoursScheduleResponse struct {
	
	UserSet bool `json:"user_set"`
	
	
	UserCanSet bool `json:"user_can_set"`
	
	
	Next time.Time `json:"next" format:"date-time"`
}
type UserRoles struct {
	Roles             []string               `json:"roles"`
	OrganizationRoles map[uuid.UUID][]string `json:"organization_roles"`
}
const (
	UserStatusActive    UserStatus = "active"
	UserStatusDormant   UserStatus = "dormant"
	UserStatusSuspended UserStatus = "suspended"
)
type UserStatusChangeCount struct {
	Date  time.Time `json:"date" format:"date-time"`
	Count int64     `json:"count" example:"10"`
}
type UsersRequest struct {
	Search string `json:"search,omitempty" typescript:"-"`
	Name   string `json:"name,omitempty" typescript:"-"`
	
	Status UserStatus `json:"status,omitempty" typescript:"-"`
	
	Role      string      `json:"role,omitempty" typescript:"-"`
	LoginType []LoginType `json:"login_type,omitempty" typescript:"-"`

	SearchQuery string `json:"q,omitempty"`
}
type ValidateUserPasswordRequest struct {
	Password string `json:"password" validate:"required"`
}
type ValidateUserPasswordResponse struct {
	Valid   bool   `json:"valid"`
	Details string `json:"details"`
}
type ValidationError struct {
	Field  string `json:"field" validate:"required"`
	Detail string `json:"detail" validate:"required"`
}

ValidationError represents a scoped error to a user input.

type ValidationMonotonicOrder string
const (
	MonotonicOrderIncreasing ValidationMonotonicOrder = "increasing"
	MonotonicOrderDecreasing ValidationMonotonicOrder = "decreasing"
)
type VariableValue struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}
func CombineVariableValues(valuesSets ...[]VariableValue) []VariableValue
type WebpushMessage struct {
	Icon    string                 `json:"icon"`
	Title   string                 `json:"title"`
	Body    string                 `json:"body"`
	Actions []WebpushMessageAction `json:"actions"`
}
type WebpushMessageAction struct {
	Label string `json:"label"`
	URL   string `json:"url"`
}
type WebpushSubscription struct {
	Endpoint  string `json:"endpoint"`
	AuthKey   string `json:"auth_key"`
	P256DHKey string `json:"p256dh_key"`
}
type Workspace struct {
	ID        uuid.UUID `json:"id" format:"uuid"`
	CreatedAt time.Time `json:"created_at" format:"date-time"`
	UpdatedAt time.Time `json:"updated_at" format:"date-time"`
	OwnerID   uuid.UUID `json:"owner_id" format:"uuid"`
	
	OwnerName                            string              `json:"owner_name"`
	OwnerAvatarURL                       string              `json:"owner_avatar_url"`
	OrganizationID                       uuid.UUID           `json:"organization_id" format:"uuid"`
	OrganizationName                     string              `json:"organization_name"`
	TemplateID                           uuid.UUID           `json:"template_id" format:"uuid"`
	TemplateName                         string              `json:"template_name"`
	TemplateDisplayName                  string              `json:"template_display_name"`
	TemplateIcon                         string              `json:"template_icon"`
	TemplateAllowUserCancelWorkspaceJobs bool                `json:"template_allow_user_cancel_workspace_jobs"`
	TemplateActiveVersionID              uuid.UUID           `json:"template_active_version_id" format:"uuid"`
	TemplateRequireActiveVersion         bool                `json:"template_require_active_version"`
	TemplateUseClassicParameterFlow      bool                `json:"template_use_classic_parameter_flow"`
	LatestBuild                          WorkspaceBuild      `json:"latest_build"`
	LatestAppStatus                      *WorkspaceAppStatus `json:"latest_app_status"`
	Outdated                             bool                `json:"outdated"`
	Name                                 string              `json:"name"`
	AutostartSchedule                    *string             `json:"autostart_schedule,omitempty"`
	TTLMillis                            *int64              `json:"ttl_ms,omitempty"`
	LastUsedAt                           time.Time           `json:"last_used_at" format:"date-time"`
	
	
	
	DeletingAt *time.Time `json:"deleting_at" format:"date-time"`
	
	
	
	
	DormantAt *time.Time `json:"dormant_at" format:"date-time"`
	
	
	Health           WorkspaceHealth  `json:"health"`
	AutomaticUpdates AutomaticUpdates `json:"automatic_updates" enums:"always,never"`
	AllowRenames     bool             `json:"allow_renames"`
	Favorite         bool             `json:"favorite"`
	NextStartAt      *time.Time       `json:"next_start_at" format:"date-time"`
	
	
	
	
	
	IsPrebuild bool `json:"is_prebuild"`
	
	TaskID     uuid.NullUUID          `json:"task_id,omitempty"`
	SharedWith []SharedWorkspaceActor `json:"shared_with,omitempty"`
}

Workspace is a deployment of a template. It references a specific version and can be updated.

type WorkspaceACL struct {
	Users  []WorkspaceUser  `json:"users"`
	Groups []WorkspaceGroup `json:"group"`
}
type WorkspaceAgent struct {
	ID                   uuid.UUID               `json:"id" format:"uuid"`
	ParentID             uuid.NullUUID           `json:"parent_id" format:"uuid"`
	CreatedAt            time.Time               `json:"created_at" format:"date-time"`
	UpdatedAt            time.Time               `json:"updated_at" format:"date-time"`
	FirstConnectedAt     *time.Time              `json:"first_connected_at,omitempty" format:"date-time"`
	LastConnectedAt      *time.Time              `json:"last_connected_at,omitempty" format:"date-time"`
	DisconnectedAt       *time.Time              `json:"disconnected_at,omitempty" format:"date-time"`
	StartedAt            *time.Time              `json:"started_at,omitempty" format:"date-time"`
	ReadyAt              *time.Time              `json:"ready_at,omitempty" format:"date-time"`
	Status               WorkspaceAgentStatus    `json:"status"`
	LifecycleState       WorkspaceAgentLifecycle `json:"lifecycle_state"`
	Name                 string                  `json:"name"`
	ResourceID           uuid.UUID               `json:"resource_id" format:"uuid"`
	InstanceID           string                  `json:"instance_id,omitempty"`
	Architecture         string                  `json:"architecture"`
	EnvironmentVariables map[string]string       `json:"environment_variables"`
	OperatingSystem      string                  `json:"operating_system"`
	LogsLength           int32                   `json:"logs_length"`
	LogsOverflowed       bool                    `json:"logs_overflowed"`
	Directory            string                  `json:"directory,omitempty"`
	ExpandedDirectory    string                  `json:"expanded_directory,omitempty"`
	Version              string                  `json:"version"`
	APIVersion           string                  `json:"api_version"`
	Apps                 []WorkspaceApp          `json:"apps"`
	
	DERPLatency              map[string]DERPRegion     `json:"latency,omitempty"`
	ConnectionTimeoutSeconds int32                     `json:"connection_timeout_seconds"`
	TroubleshootingURL       string                    `json:"troubleshooting_url"`
	Subsystems               []AgentSubsystem          `json:"subsystems"`
	Health                   WorkspaceAgentHealth      `json:"health"` 
	DisplayApps              []DisplayApp              `json:"display_apps"`
	LogSources               []WorkspaceAgentLogSource `json:"log_sources"`
	Scripts                  []WorkspaceAgentScript    `json:"scripts"`

	
	
	
	StartupScriptBehavior WorkspaceAgentStartupScriptBehavior `json:"startup_script_behavior"`
}
type WorkspaceAgentContainer struct {
	
	CreatedAt time.Time `json:"created_at" format:"date-time"`
	
	ID string `json:"id"`
	
	FriendlyName string `json:"name"`
	
	Image string `json:"image"`
	
	Labels map[string]string `json:"labels"`
	
	Running bool `json:"running"`
	
	Ports []WorkspaceAgentContainerPort `json:"ports"`
	
	
	
	Status string `json:"status"`
	
	
	Volumes map[string]string `json:"volumes"`
}

WorkspaceAgentContainer describes a devcontainer of some sort that is visible to the workspace agent. This struct is an abstraction of potentially multiple implementations, and the fields will be somewhat implementation-dependent.

type WorkspaceAgentContainerPort struct {
	
	Port uint16 `json:"port"`
	
	Network string `json:"network"`
	
	
	HostIP string `json:"host_ip,omitempty"`
	
	HostPort uint16 `json:"host_port,omitempty"`
}

WorkspaceAgentContainerPort describes a port as exposed by a container.

type WorkspaceAgentDevcontainer struct {
	ID              uuid.UUID     `json:"id" format:"uuid"`
	Name            string        `json:"name"`
	WorkspaceFolder string        `json:"workspace_folder"`
	ConfigPath      string        `json:"config_path,omitempty"`
	SubagentID      uuid.NullUUID `json:"subagent_id,omitempty" format:"uuid"`

	
	Status    WorkspaceAgentDevcontainerStatus `json:"status"`
	Dirty     bool                             `json:"dirty"`
	Container *WorkspaceAgentContainer         `json:"container,omitempty"`
	Agent     *WorkspaceAgentDevcontainerAgent `json:"agent,omitempty"`

	Error string `json:"error,omitempty"`
}

WorkspaceAgentDevcontainer defines the location of a devcontainer configuration in a workspace that is visible to the workspace agent.

func (d WorkspaceAgentDevcontainer) IsTerraformDefined() bool

IsTerraformDefined returns true if this devcontainer has resources defined in Terraform.

type WorkspaceAgentDevcontainerAgent struct {
	ID        uuid.UUID `json:"id" format:"uuid"`
	Name      string    `json:"name"`
	Directory string    `json:"directory"`
}

WorkspaceAgentDevcontainerAgent represents the sub agent for a devcontainer.

type WorkspaceAgentDevcontainerStatus string

WorkspaceAgentDevcontainerStatus is the status of a devcontainer.

const (
	WorkspaceAgentDevcontainerStatusRunning  WorkspaceAgentDevcontainerStatus = "running"
	WorkspaceAgentDevcontainerStatusStopped  WorkspaceAgentDevcontainerStatus = "stopped"
	WorkspaceAgentDevcontainerStatusStarting WorkspaceAgentDevcontainerStatus = "starting"
	WorkspaceAgentDevcontainerStatusStopping WorkspaceAgentDevcontainerStatus = "stopping"
	WorkspaceAgentDevcontainerStatusDeleting WorkspaceAgentDevcontainerStatus = "deleting"
	WorkspaceAgentDevcontainerStatusError    WorkspaceAgentDevcontainerStatus = "error"
)

WorkspaceAgentDevcontainerStatus enums.

type WorkspaceAgentHealth struct {
	Healthy bool   `json:"healthy" example:"false"`                              
	Reason  string `json:"reason,omitempty" example:"agent has lost connection"` 
}
type WorkspaceAgentLifecycle string

WorkspaceAgentLifecycle represents the lifecycle state of a workspace agent.

The agent lifecycle starts in the "created" state, and transitions to "starting" when the agent reports it has begun preparing (e.g. started executing the startup script).

const (
	WorkspaceAgentLifecycleCreated         WorkspaceAgentLifecycle = "created"
	WorkspaceAgentLifecycleStarting        WorkspaceAgentLifecycle = "starting"
	WorkspaceAgentLifecycleStartTimeout    WorkspaceAgentLifecycle = "start_timeout"
	WorkspaceAgentLifecycleStartError      WorkspaceAgentLifecycle = "start_error"
	WorkspaceAgentLifecycleReady           WorkspaceAgentLifecycle = "ready"
	WorkspaceAgentLifecycleShuttingDown    WorkspaceAgentLifecycle = "shutting_down"
	WorkspaceAgentLifecycleShutdownTimeout WorkspaceAgentLifecycle = "shutdown_timeout"
	WorkspaceAgentLifecycleShutdownError   WorkspaceAgentLifecycle = "shutdown_error"
	WorkspaceAgentLifecycleOff             WorkspaceAgentLifecycle = "off"
)

WorkspaceAgentLifecycle enums.

ShuttingDown returns true if the agent is in the process of shutting down or has shut down.

Starting returns true if the agent is in the process of starting.

type WorkspaceAgentListContainersResponse struct {
	
	Devcontainers []WorkspaceAgentDevcontainer `json:"devcontainers"`
	
	Containers []WorkspaceAgentContainer `json:"containers"`
	
	
	Warnings []string `json:"warnings,omitempty"`
}

WorkspaceAgentListContainersResponse is the response to the list containers request.

type WorkspaceAgentListeningPort struct {
	ProcessName string `json:"process_name"` 
	Network     string `json:"network"`      
	Port        uint16 `json:"port"`
}
type WorkspaceAgentListeningPortsResponse struct {
	
	
	
	
	Ports []WorkspaceAgentListeningPort `json:"ports"`
}
type WorkspaceAgentLog struct {
	ID        int64     `json:"id"`
	CreatedAt time.Time `json:"created_at" format:"date-time"`
	Output    string    `json:"output"`
	Level     LogLevel  `json:"level"`
	SourceID  uuid.UUID `json:"source_id" format:"uuid"`
}

Text formats the log entry as human-readable text.

type WorkspaceAgentLogSource struct {
	WorkspaceAgentID uuid.UUID `json:"workspace_agent_id" format:"uuid"`
	ID               uuid.UUID `json:"id" format:"uuid"`
	CreatedAt        time.Time `json:"created_at" format:"date-time"`
	DisplayName      string    `json:"display_name"`
	Icon             string    `json:"icon"`
}
type WorkspaceAgentMetadata struct {
	Result      WorkspaceAgentMetadataResult      `json:"result"`
	Description WorkspaceAgentMetadataDescription `json:"description"`
}
type WorkspaceAgentMetadataDescription struct {
	DisplayName string `json:"display_name"`
	Key         string `json:"key"`
	Script      string `json:"script"`
	Interval    int64  `json:"interval"`
	Timeout     int64  `json:"timeout"`
}

WorkspaceAgentMetadataDescription is a description of dynamic metadata the agent should report back to coderd. It is provided via the `metadata` list in the `coder_agent` block.

type WorkspaceAgentMetadataResult struct {
	CollectedAt time.Time `json:"collected_at" format:"date-time"`
	
	
	Age   int64  `json:"age"`
	Value string `json:"value"`
	Error string `json:"error"`
}
type WorkspaceAgentPortShare struct {
	WorkspaceID uuid.UUID                       `json:"workspace_id" format:"uuid"`
	AgentName   string                          `json:"agent_name"`
	Port        int32                           `json:"port"`
	ShareLevel  WorkspaceAgentPortShareLevel    `json:"share_level" enums:"owner,authenticated,organization,public"`
	Protocol    WorkspaceAgentPortShareProtocol `json:"protocol" enums:"http,https"`
}
type WorkspaceAgentPortShareLevel string

IsCompatibleWithMaxLevel determines whether the sharing level is valid under the specified maxLevel. The values are fully ordered, from "highest" to "lowest" as 1. Public 2. Authenticated 3. Organization 4. Owner Returns an error if either level is invalid.

func (l WorkspaceAgentPortShareLevel) ValidPortShareLevel() bool
type WorkspaceAgentPortShareProtocol string
type WorkspaceAgentPortShares struct {
	Shares []WorkspaceAgentPortShare `json:"shares"`
}
type WorkspaceAgentScript struct {
	ID               uuid.UUID     `json:"id" format:"uuid"`
	LogSourceID      uuid.UUID     `json:"log_source_id" format:"uuid"`
	LogPath          string        `json:"log_path"`
	Script           string        `json:"script"`
	Cron             string        `json:"cron"`
	RunOnStart       bool          `json:"run_on_start"`
	RunOnStop        bool          `json:"run_on_stop"`
	StartBlocksLogin bool          `json:"start_blocks_login"`
	Timeout          time.Duration `json:"timeout"`
	DisplayName      string        `json:"display_name"`
}
type WorkspaceAgentStartupScriptBehavior string

WorkspaceAgentStartupScriptBehavior defines whether or not the startup script should be considered blocking or non-blocking. The blocking behavior means that the agent will not be considered ready until the startup script has completed and, for example, SSH connections will wait for the agent to be ready (can be overridden).

Presently, non-blocking is the default, but this may change in the future. Deprecated: `coder_script` allows configuration on a per-script basis.

const (
	WorkspaceAgentStartupScriptBehaviorBlocking    WorkspaceAgentStartupScriptBehavior = "blocking"
	WorkspaceAgentStartupScriptBehaviorNonBlocking WorkspaceAgentStartupScriptBehavior = "non-blocking"
)
type WorkspaceAgentStatus string
const (
	WorkspaceAgentConnecting   WorkspaceAgentStatus = "connecting"
	WorkspaceAgentConnected    WorkspaceAgentStatus = "connected"
	WorkspaceAgentDisconnected WorkspaceAgentStatus = "disconnected"
	WorkspaceAgentTimeout      WorkspaceAgentStatus = "timeout"
)

This is also in database/modelmethods.go and should be kept in sync.

type WorkspaceApp struct {
	ID uuid.UUID `json:"id" format:"uuid"`
	
	
	URL string `json:"url,omitempty"`
	
	
	External bool `json:"external"`
	
	Slug string `json:"slug"`
	
	DisplayName string `json:"display_name,omitempty"`
	Command     string `json:"command,omitempty"`
	
	
	Icon string `json:"icon,omitempty"`
	
	
	
	
	Subdomain bool `json:"subdomain"`
	
	SubdomainName string                   `json:"subdomain_name,omitempty"`
	SharingLevel  WorkspaceAppSharingLevel `json:"sharing_level" enums:"owner,authenticated,organization,public"`
	
	Healthcheck Healthcheck        `json:"healthcheck,omitempty"`
	Health      WorkspaceAppHealth `json:"health"`
	Group       string             `json:"group,omitempty"`
	Hidden      bool               `json:"hidden"`
	OpenIn      WorkspaceAppOpenIn `json:"open_in"`
	
	
	Tooltip string `json:"tooltip,omitempty"`

	
	Statuses []WorkspaceAppStatus `json:"statuses"`
}
type WorkspaceAppHealth string
const (
	WorkspaceAppHealthDisabled     WorkspaceAppHealth = "disabled"
	WorkspaceAppHealthInitializing WorkspaceAppHealth = "initializing"
	WorkspaceAppHealthHealthy      WorkspaceAppHealth = "healthy"
	WorkspaceAppHealthUnhealthy    WorkspaceAppHealth = "unhealthy"
)
type WorkspaceAppOpenIn string
const (
	WorkspaceAppOpenInSlimWindow WorkspaceAppOpenIn = "slim-window"
	WorkspaceAppOpenInTab        WorkspaceAppOpenIn = "tab"
)
type WorkspaceAppSharingLevel string
const (
	WorkspaceAppSharingLevelOwner         WorkspaceAppSharingLevel = "owner"
	WorkspaceAppSharingLevelAuthenticated WorkspaceAppSharingLevel = "authenticated"
	WorkspaceAppSharingLevelOrganization  WorkspaceAppSharingLevel = "organization"
	WorkspaceAppSharingLevelPublic        WorkspaceAppSharingLevel = "public"
)
type WorkspaceAppStatus struct {
	ID          uuid.UUID               `json:"id" format:"uuid"`
	CreatedAt   time.Time               `json:"created_at" format:"date-time"`
	WorkspaceID uuid.UUID               `json:"workspace_id" format:"uuid"`
	AgentID     uuid.UUID               `json:"agent_id" format:"uuid"`
	AppID       uuid.UUID               `json:"app_id" format:"uuid"`
	State       WorkspaceAppStatusState `json:"state"`
	Message     string                  `json:"message"`
	
	
	
	URI string `json:"uri"`

	
	
	Icon string `json:"icon"`
	
	
	NeedsUserAttention bool `json:"needs_user_attention"`
}
type WorkspaceAppStatusState string
const (
	WorkspaceAppStatusStateWorking  WorkspaceAppStatusState = "working"
	WorkspaceAppStatusStateIdle     WorkspaceAppStatusState = "idle"
	WorkspaceAppStatusStateComplete WorkspaceAppStatusState = "complete"
	WorkspaceAppStatusStateFailure  WorkspaceAppStatusState = "failure"
)
type WorkspaceBuild struct {
	ID               uuid.UUID `json:"id" format:"uuid"`
	CreatedAt        time.Time `json:"created_at" format:"date-time"`
	UpdatedAt        time.Time `json:"updated_at" format:"date-time"`
	WorkspaceID      uuid.UUID `json:"workspace_id" format:"uuid"`
	WorkspaceName    string    `json:"workspace_name"`
	WorkspaceOwnerID uuid.UUID `json:"workspace_owner_id" format:"uuid"`
	
	WorkspaceOwnerName      string               `json:"workspace_owner_name"`
	WorkspaceOwnerAvatarURL string               `json:"workspace_owner_avatar_url,omitempty"`
	TemplateVersionID       uuid.UUID            `json:"template_version_id" format:"uuid"`
	TemplateVersionName     string               `json:"template_version_name"`
	BuildNumber             int32                `json:"build_number"`
	Transition              WorkspaceTransition  `json:"transition" enums:"start,stop,delete"`
	InitiatorID             uuid.UUID            `json:"initiator_id" format:"uuid"`
	InitiatorUsername       string               `json:"initiator_name"`
	Job                     ProvisionerJob       `json:"job"`
	Reason                  BuildReason          `db:"reason" json:"reason" enums:"initiator,autostart,autostop"`
	Resources               []WorkspaceResource  `json:"resources"`
	Deadline                NullTime             `json:"deadline,omitempty" format:"date-time"`
	MaxDeadline             NullTime             `json:"max_deadline,omitempty" format:"date-time"`
	Status                  WorkspaceStatus      `json:"status" enums:"pending,starting,running,stopping,stopped,failed,canceling,canceled,deleting,deleted"`
	DailyCost               int32                `json:"daily_cost"`
	MatchedProvisioners     *MatchedProvisioners `json:"matched_provisioners,omitempty"`
	TemplateVersionPresetID *uuid.UUID           `json:"template_version_preset_id" format:"uuid"`
	
	HasAITask        *bool `json:"has_ai_task,omitempty"`
	HasExternalAgent *bool `json:"has_external_agent,omitempty"`
}

WorkspaceBuild is an at-point representation of a workspace state. BuildNumbers start at 1 and increase by 1 for each subsequent build

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

WorkspaceBuildParameter represents a parameter specific for a workspace build.

type WorkspaceBuildTimings struct {
	ProvisionerTimings []ProvisionerTiming `json:"provisioner_timings"`
	
	
	AgentScriptTimings     []AgentScriptTiming     `json:"agent_script_timings"`
	AgentConnectionTimings []AgentConnectionTiming `json:"agent_connection_timings"`
}
type WorkspaceBuildsRequest struct {
	WorkspaceID uuid.UUID `json:"workspace_id" format:"uuid" typescript:"-"`
	Since time.Time `json:"since,omitempty" format:"date-time"`
}
type WorkspaceDeploymentStats struct {
	Pending  int64 `json:"pending"`
	Building int64 `json:"building"`
	Running  int64 `json:"running"`
	Failed   int64 `json:"failed"`
	Stopped  int64 `json:"stopped"`

	ConnectionLatencyMS WorkspaceConnectionLatencyMS `json:"connection_latency_ms"`
	RxBytes             int64                        `json:"rx_bytes"`
	TxBytes             int64                        `json:"tx_bytes"`
}
type WorkspaceFilter struct {
	
	Owner string `json:"owner,omitempty" typescript:"-"`
	
	Template string `json:"template,omitempty" typescript:"-"`
	
	Name string `json:"name,omitempty" typescript:"-"`
	
	Status string `json:"status,omitempty" typescript:"-"`
	
	Offset int `json:"offset,omitempty" typescript:"-"`
	
	Limit int `json:"limit,omitempty" typescript:"-"`
	
	Shared *bool `json:"shared,omitempty" typescript:"-"`
	
	SharedWithUser string `json:"shared_with_user,omitempty" typescript:"-"`
	
	SharedWithGroup string `json:"shared_with_group,omitempty" typescript:"-"`
	
	FilterQuery string `json:"q,omitempty"`
}
type WorkspaceGroup struct {
	Group
	Role WorkspaceRole `json:"role" enums:"admin,use"`
}
type WorkspaceHealth struct {
	Healthy       bool        `json:"healthy" example:"false"`      
	FailingAgents []uuid.UUID `json:"failing_agents" format:"uuid"` 
}
type WorkspaceOptions struct {
	IncludeDeleted bool `json:"include_deleted,omitempty"`
}
type WorkspaceProxy struct {
	
	Region      `table:"region,recursive_inline"`
	DerpEnabled bool `json:"derp_enabled" table:"derp enabled"`
	DerpOnly    bool `json:"derp_only" table:"derp only"`

	
	
	
	Status WorkspaceProxyStatus `json:"status,omitempty" table:"proxy,recursive"`

	CreatedAt time.Time `json:"created_at" format:"date-time" table:"created at"`
	UpdatedAt time.Time `json:"updated_at" format:"date-time" table:"updated at"`
	Deleted   bool      `json:"deleted" table:"deleted"`
	Version   string    `json:"version" table:"version"`
}
type WorkspaceProxyBuildInfo struct {
	
	WorkspaceProxy bool `json:"workspace_proxy"`
	
	DashboardURL string `json:"dashboard_url"`
}
type WorkspaceProxyStatus struct {
	Status ProxyHealthStatus `json:"status" table:"status,default_sort"`
	
	Report    ProxyHealthReport `json:"report,omitempty" table:"report"`
	CheckedAt time.Time         `json:"checked_at" table:"checked at" format:"date-time"`
}
type WorkspaceQuota struct {
	CreditsConsumed int `json:"credits_consumed"`
	Budget          int `json:"budget"`
}
type WorkspaceResource struct {
	ID         uuid.UUID                   `json:"id" format:"uuid"`
	CreatedAt  time.Time                   `json:"created_at" format:"date-time"`
	JobID      uuid.UUID                   `json:"job_id" format:"uuid"`
	Transition WorkspaceTransition         `json:"workspace_transition" enums:"start,stop,delete"`
	Type       string                      `json:"type"`
	Name       string                      `json:"name"`
	Hide       bool                        `json:"hide"`
	Icon       string                      `json:"icon"`
	Agents     []WorkspaceAgent            `json:"agents,omitempty"`
	Metadata   []WorkspaceResourceMetadata `json:"metadata,omitempty"`
	DailyCost  int32                       `json:"daily_cost"`
}

WorkspaceResource describes resources used to create a workspace, for instance: containers, images, volumes.

type WorkspaceResourceMetadata struct {
	Key       string `json:"key"`
	Value     string `json:"value"`
	Sensitive bool   `json:"sensitive"`
}

WorkspaceResourceMetadata annotates the workspace resource with custom key-value pairs.

const (
	WorkspaceRoleAdmin   WorkspaceRole = "admin"
	WorkspaceRoleUse     WorkspaceRole = "use"
	WorkspaceRoleDeleted WorkspaceRole = ""
)
type WorkspaceSharingSettings struct {
	SharingDisabled bool `json:"sharing_disabled"`
}

WorkspaceSharingSettings represents workspace sharing settings for an organization.

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 ConvertWorkspaceStatus(jobStatus ProvisionerJobStatus, transition WorkspaceTransition) WorkspaceStatus
type WorkspaceTransition string
const (
	WorkspaceTransitionStart  WorkspaceTransition = "start"
	WorkspaceTransitionStop   WorkspaceTransition = "stop"
	WorkspaceTransitionDelete WorkspaceTransition = "delete"
)
type WorkspaceUser struct {
	MinimalUser
	Role WorkspaceRole `json:"role" enums:"admin,use"`
}
type WorkspacesRequest struct {
	SearchQuery string `json:"q,omitempty"`
}
type WorkspacesResponse struct {
	Workspaces []Workspace `json:"workspaces"`
	Count      int         `json:"count"`
}