Documentation ¶
Index ¶
- Constants
- Variables
- func IsConnectionError(err error) bool
- func ReadBodyAsError(res *http.Response) error
- func ServerSentEventReader(ctx context.Context, rc io.ReadCloser) func() (*ServerSentEvent, error)
- func ValidateNewWorkspaceParameters(richParameters []TemplateVersionParameter, ...) error
- func ValidateWorkspaceBuildParameter(richParameter TemplateVersionParameter, buildParameter WorkspaceBuildParameter, ...) error
- func ValidateWorkspaceBuildParameters(richParameters []TemplateVersionParameter, ...) error
- func WorkspaceDisplayStatus(jobStatus ProvisionerJobStatus, transition WorkspaceTransition) string
- func WorkspaceNotifyChannel(id uuid.UUID) string
- type APIKey
- type APIKeyScope
- type AddLicenseRequest
- type AgentStatsReportRequest
- type AgentStatsReportResponse
- type AppHostResponse
- type AppearanceConfig
- type AssignableRoles
- type AuditAction
- type AuditDiff
- type AuditDiffField
- type AuditLog
- type AuditLogResponse
- type AuditLogsRequest
- type AuthMethod
- type AuthMethods
- type AuthorizationCheck
- type AuthorizationObject
- type AuthorizationRequest
- type AuthorizationResponse
- type BuildInfoResponse
- type BuildReason
- type Client
- func (c *Client) APIKey(ctx context.Context, userID string, id string) (*APIKey, error)
- func (c *Client) AddLicense(ctx context.Context, r AddLicenseRequest) (License, error)
- func (c *Client) AppHost(ctx context.Context) (AppHostResponse, error)
- func (c *Client) Appearance(ctx context.Context) (AppearanceConfig, error)
- func (c *Client) AuditLogs(ctx context.Context, req AuditLogsRequest) (AuditLogResponse, error)
- func (c *Client) AuthCheck(ctx context.Context, req AuthorizationRequest) (AuthorizationResponse, error)
- func (c *Client) AuthMethods(ctx context.Context) (AuthMethods, error)
- func (c *Client) BuildInfo(ctx context.Context) (BuildInfoResponse, error)
- func (c *Client) CancelTemplateVersion(ctx context.Context, version uuid.UUID) error
- func (c *Client) CancelTemplateVersionDryRun(ctx context.Context, version, job uuid.UUID) error
- func (c *Client) CancelWorkspaceBuild(ctx context.Context, id uuid.UUID) error
- func (c *Client) CreateAPIKey(ctx context.Context, user string) (GenerateAPIKeyResponse, error)
- func (c *Client) CreateFirstUser(ctx context.Context, req CreateFirstUserRequest) (CreateFirstUserResponse, error)
- func (c *Client) CreateGroup(ctx context.Context, orgID uuid.UUID, req CreateGroupRequest) (Group, error)
- func (c *Client) CreateOrganization(ctx context.Context, req CreateOrganizationRequest) (Organization, error)
- func (c *Client) CreateParameter(ctx context.Context, scope ParameterScope, id uuid.UUID, ...) (Parameter, error)
- func (c *Client) CreateTemplate(ctx context.Context, organizationID uuid.UUID, request CreateTemplateRequest) (Template, error)
- func (c *Client) CreateTemplateVersion(ctx context.Context, organizationID uuid.UUID, ...) (TemplateVersion, error)
- func (c *Client) CreateTemplateVersionDryRun(ctx context.Context, version uuid.UUID, req CreateTemplateVersionDryRunRequest) (ProvisionerJob, error)
- func (c *Client) CreateTestAuditLog(ctx context.Context, req CreateTestAuditLogRequest) error
- func (c *Client) CreateToken(ctx context.Context, userID string, req CreateTokenRequest) (GenerateAPIKeyResponse, error)
- func (c *Client) CreateUser(ctx context.Context, req CreateUserRequest) (User, error)
- func (c *Client) CreateWorkspace(ctx context.Context, organizationID uuid.UUID, user string, ...) (Workspace, error)
- func (c *Client) CreateWorkspaceBuild(ctx context.Context, workspace uuid.UUID, request CreateWorkspaceBuildRequest) (WorkspaceBuild, error)
- func (c *Client) DeleteAPIKey(ctx context.Context, userID string, id string) error
- func (c *Client) DeleteGroup(ctx context.Context, group uuid.UUID) error
- func (c *Client) DeleteLicense(ctx context.Context, id int32) error
- func (c *Client) DeleteParameter(ctx context.Context, scope ParameterScope, id uuid.UUID, name string) error
- func (c *Client) DeleteTemplate(ctx context.Context, template uuid.UUID) error
- func (c *Client) DeleteUser(ctx context.Context, id uuid.UUID) error
- func (c *Client) DeletedWorkspace(ctx context.Context, id uuid.UUID) (Workspace, error)
- func (c *Client) DeploymentConfig(ctx context.Context) (DeploymentConfig, error)
- func (c *Client) DeploymentDAUs(ctx context.Context) (*DeploymentDAUsResponse, error)
- func (c *Client) DialWorkspaceAgent(ctx context.Context, agentID uuid.UUID, options *DialWorkspaceAgentOptions) (*WorkspaceAgentConn, error)
- func (c *Client) Download(ctx context.Context, id uuid.UUID) ([]byte, string, error)
- func (c *Client) Entitlements(ctx context.Context) (Entitlements, error)
- func (c *Client) Experiments(ctx context.Context) (Experiments, error)
- func (c *Client) GitSSHKey(ctx context.Context, user string) (GitSSHKey, error)
- func (c *Client) Group(ctx context.Context, group uuid.UUID) (Group, error)
- func (c *Client) GroupByOrgAndName(ctx context.Context, orgID uuid.UUID, name string) (Group, error)
- func (c *Client) GroupsByOrganization(ctx context.Context, orgID uuid.UUID) ([]Group, error)
- func (c *Client) HasFirstUser(ctx context.Context) (bool, error)
- func (c *Client) Licenses(ctx context.Context) ([]License, error)
- func (c *Client) ListOrganizationRoles(ctx context.Context, org uuid.UUID) ([]AssignableRoles, error)
- func (c *Client) ListSiteRoles(ctx context.Context) ([]AssignableRoles, error)
- func (c *Client) LoginWithPassword(ctx context.Context, req LoginWithPasswordRequest) (LoginWithPasswordResponse, error)
- func (c *Client) Logout(ctx context.Context) error
- func (c *Client) Organization(ctx context.Context, id uuid.UUID) (Organization, error)
- func (c *Client) OrganizationByName(ctx context.Context, user string, name string) (Organization, error)
- func (c *Client) OrganizationsByUser(ctx context.Context, user string) ([]Organization, error)
- func (c *Client) Parameters(ctx context.Context, scope ParameterScope, id uuid.UUID) ([]Parameter, error)
- func (c *Client) PatchGroup(ctx context.Context, group uuid.UUID, req PatchGroupRequest) (Group, error)
- func (c *Client) PreviousTemplateVersion(ctx context.Context, organization uuid.UUID, templateName, versionName string) (TemplateVersion, error)
- func (c *Client) ProvisionerDaemons(ctx context.Context) ([]ProvisionerDaemon, error)
- func (c *Client) PutExtendWorkspace(ctx context.Context, id uuid.UUID, req PutExtendWorkspaceRequest) error
- func (c *Client) RegenerateGitSSHKey(ctx context.Context, user string) (GitSSHKey, error)
- func (c *Client) Replicas(ctx context.Context) ([]Replica, error)
- func (c *Client) Request(ctx context.Context, method, path string, body interface{}, ...) (*http.Response, error)
- func (c *Client) ServeProvisionerDaemon(ctx context.Context, organization uuid.UUID, provisioners []ProvisionerType, ...) (proto.DRPCProvisionerDaemonClient, error)
- func (c *Client) SessionToken() string
- func (c *Client) SetSessionToken(token string)
- func (c *Client) Template(ctx context.Context, template uuid.UUID) (Template, error)
- func (c *Client) TemplateACL(ctx context.Context, templateID uuid.UUID) (TemplateACL, error)
- func (c *Client) TemplateByName(ctx context.Context, organizationID uuid.UUID, name string) (Template, error)
- func (c *Client) TemplateDAUs(ctx context.Context, templateID uuid.UUID) (*TemplateDAUsResponse, error)
- func (c *Client) TemplateExamples(ctx context.Context, organizationID uuid.UUID) ([]TemplateExample, error)
- func (c *Client) TemplateVersion(ctx context.Context, id uuid.UUID) (TemplateVersion, error)
- func (c *Client) TemplateVersionByName(ctx context.Context, template uuid.UUID, name string) (TemplateVersion, error)
- func (c *Client) TemplateVersionByOrganizationAndName(ctx context.Context, organizationID uuid.UUID, ...) (TemplateVersion, error)
- func (c *Client) TemplateVersionDryRun(ctx context.Context, version, job uuid.UUID) (ProvisionerJob, error)
- func (c *Client) TemplateVersionDryRunLogsAfter(ctx context.Context, version, job uuid.UUID, after int64) (<-chan ProvisionerJobLog, io.Closer, error)
- func (c *Client) TemplateVersionDryRunLogsBefore(ctx context.Context, version, job uuid.UUID, before int64) ([]ProvisionerJobLog, error)
- func (c *Client) TemplateVersionDryRunResources(ctx context.Context, version, job uuid.UUID) ([]WorkspaceResource, error)
- func (c *Client) TemplateVersionLogsAfter(ctx context.Context, version uuid.UUID, after int64) (<-chan ProvisionerJobLog, io.Closer, error)
- func (c *Client) TemplateVersionLogsBefore(ctx context.Context, version uuid.UUID, before int64) ([]ProvisionerJobLog, error)
- func (c *Client) TemplateVersionParameters(ctx context.Context, version uuid.UUID) ([]ComputedParameter, error)
- func (c *Client) TemplateVersionResources(ctx context.Context, version uuid.UUID) ([]WorkspaceResource, error)
- func (c *Client) TemplateVersionRichParameters(ctx context.Context, version uuid.UUID) ([]TemplateVersionParameter, error)
- func (c *Client) TemplateVersionSchema(ctx context.Context, version uuid.UUID) ([]ParameterSchema, error)
- func (c *Client) TemplateVersionsByTemplate(ctx context.Context, req TemplateVersionsByTemplateRequest) ([]TemplateVersion, error)
- func (c *Client) TemplatesByOrganization(ctx context.Context, organizationID uuid.UUID) ([]Template, error)
- func (c *Client) Tokens(ctx context.Context, userID string) ([]APIKey, error)
- func (c *Client) UpdateActiveTemplateVersion(ctx context.Context, template uuid.UUID, req UpdateActiveTemplateVersion) error
- func (c *Client) UpdateAppearance(ctx context.Context, appearance AppearanceConfig) error
- func (c *Client) UpdateCheck(ctx context.Context) (UpdateCheckResponse, error)
- func (c *Client) UpdateOrganizationMemberRoles(ctx context.Context, organizationID uuid.UUID, user string, req UpdateRoles) (OrganizationMember, error)
- func (c *Client) UpdateTemplateACL(ctx context.Context, templateID uuid.UUID, req UpdateTemplateACL) error
- func (c *Client) UpdateTemplateMeta(ctx context.Context, templateID uuid.UUID, req UpdateTemplateMeta) (Template, error)
- func (c *Client) UpdateUserPassword(ctx context.Context, user string, req UpdateUserPasswordRequest) error
- func (c *Client) UpdateUserProfile(ctx context.Context, user string, req UpdateUserProfileRequest) (User, error)
- func (c *Client) UpdateUserRoles(ctx context.Context, user string, req UpdateRoles) (User, error)
- func (c *Client) UpdateUserStatus(ctx context.Context, user string, status UserStatus) (User, error)
- func (c *Client) UpdateWorkspace(ctx context.Context, id uuid.UUID, req UpdateWorkspaceRequest) error
- func (c *Client) UpdateWorkspaceAutostart(ctx context.Context, id uuid.UUID, req UpdateWorkspaceAutostartRequest) error
- func (c *Client) UpdateWorkspaceTTL(ctx context.Context, id uuid.UUID, req UpdateWorkspaceTTLRequest) error
- func (c *Client) Upload(ctx context.Context, contentType string, rd io.Reader) (UploadResponse, error)
- func (c *Client) User(ctx context.Context, userIdent string) (User, error)
- func (c *Client) UserRoles(ctx context.Context, user string) (UserRoles, error)
- func (c *Client) Users(ctx context.Context, req UsersRequest) (GetUsersResponse, error)
- func (c *Client) WatchWorkspace(ctx context.Context, id uuid.UUID) (<-chan Workspace, error)
- func (c *Client) Workspace(ctx context.Context, id uuid.UUID) (Workspace, error)
- func (c *Client) WorkspaceAgent(ctx context.Context, id uuid.UUID) (WorkspaceAgent, error)
- func (c *Client) WorkspaceAgentListeningPorts(ctx context.Context, agentID uuid.UUID) (WorkspaceAgentListeningPortsResponse, error)
- func (c *Client) WorkspaceAgentReconnectingPTY(ctx context.Context, agentID, reconnect uuid.UUID, height, width uint16, ...) (net.Conn, error)
- func (c *Client) WorkspaceBuild(ctx context.Context, id uuid.UUID) (WorkspaceBuild, error)
- func (c *Client) WorkspaceBuildByUsernameAndWorkspaceNameAndBuildNumber(ctx context.Context, username string, workspaceName string, buildNumber string) (WorkspaceBuild, error)
- func (c *Client) WorkspaceBuildLogsAfter(ctx context.Context, build uuid.UUID, after int64) (<-chan ProvisionerJobLog, io.Closer, error)
- func (c *Client) WorkspaceBuildLogsBefore(ctx context.Context, build uuid.UUID, before int64) ([]ProvisionerJobLog, error)
- func (c *Client) WorkspaceBuildParameters(ctx context.Context, build uuid.UUID) ([]WorkspaceBuildParameter, error)
- func (c *Client) WorkspaceBuildState(ctx context.Context, build uuid.UUID) ([]byte, error)
- func (c *Client) WorkspaceBuilds(ctx context.Context, req WorkspaceBuildsRequest) ([]WorkspaceBuild, error)
- func (c *Client) WorkspaceByOwnerAndName(ctx context.Context, owner string, name string, params WorkspaceOptions) (Workspace, error)
- func (c *Client) WorkspaceQuota(ctx context.Context, userID string) (WorkspaceQuota, error)
- func (c *Client) Workspaces(ctx context.Context, filter WorkspaceFilter) (WorkspacesResponse, error)
- type ComputedParameter
- type CreateFirstUserRequest
- type CreateFirstUserResponse
- type CreateGroupRequest
- type CreateOrganizationRequest
- type CreateParameterRequest
- type CreateTemplateRequest
- type CreateTemplateVersionDryRunRequest
- type CreateTemplateVersionRequest
- type CreateTestAuditLogRequest
- type CreateTokenRequest
- type CreateUserRequest
- type CreateWorkspaceBuildRequest
- type CreateWorkspaceRequest
- type DAUEntry
- type DERP
- type DERPConfig
- type DERPRegion
- type DERPServerConfig
- type DangerousConfig
- type DeploymentConfig
- type DeploymentConfigField
- type DeploymentDAUsResponse
- type DialWorkspaceAgentOptions
- type Entitlement
- type Entitlements
- type Error
- type Experiment
- type Experiments
- type Feature
- type FeatureName
- type Flaggable
- type GenerateAPIKeyResponse
- type GetUsersResponse
- type GitAuthConfig
- type GitProvider
- type GitSSHKey
- type Group
- type Healthcheck
- type License
- type LogLevel
- type LogSource
- type LoggingConfig
- type LoginType
- type LoginWithPasswordRequest
- type LoginWithPasswordResponse
- type NullTime
- type OAuth2Config
- type OAuth2GithubConfig
- type OIDCAuthMethod
- type OIDCConfig
- type Organization
- type OrganizationMember
- type Pagination
- type Parameter
- type ParameterDestinationScheme
- type ParameterSchema
- type ParameterScope
- type ParameterSourceScheme
- type ParameterTypeSystem
- type PatchGroupRequest
- type PprofConfig
- type PrometheusConfig
- type ProvisionerConfig
- type ProvisionerDaemon
- type ProvisionerJob
- type ProvisionerJobLog
- type ProvisionerJobStatus
- type ProvisionerStorageMethod
- type ProvisionerType
- type PutExtendWorkspaceRequest
- type RateLimitConfig
- type ReconnectingPTYRequest
- type Replica
- type RequestOption
- type ResourceType
- type Response
- type Role
- type ServerSentEvent
- type ServerSentEventType
- type ServiceBannerConfig
- type SwaggerConfig
- type TLSConfig
- type TelemetryConfig
- type Template
- type TemplateACL
- type TemplateBuildTimeStats
- type TemplateDAUsResponse
- type TemplateExample
- type TemplateGroup
- type TemplateRole
- type TemplateUser
- type TemplateVersion
- type TemplateVersionParameter
- type TemplateVersionParameterOption
- type TemplateVersionsByTemplateRequest
- type TraceConfig
- type TransitionStats
- type UpdateActiveTemplateVersion
- type UpdateCheckResponse
- type UpdateRoles
- type UpdateTemplateACL
- type UpdateTemplateMeta
- type UpdateUserPasswordRequest
- type UpdateUserProfileRequest
- type UpdateWorkspaceAutostartRequest
- type UpdateWorkspaceRequest
- type UpdateWorkspaceTTLRequest
- type UploadResponse
- type User
- type UserRoles
- type UserStatus
- type UsersRequest
- type ValidationError
- type ValidationMonotonicOrder
- type Workspace
- type WorkspaceAgent
- type WorkspaceAgentConn
- func (c *WorkspaceAgentConn) AwaitReachable(ctx context.Context) bool
- func (c *WorkspaceAgentConn) Close() error
- func (c *WorkspaceAgentConn) DialContext(ctx context.Context, network string, addr string) (net.Conn, error)
- func (c *WorkspaceAgentConn) ListeningPorts(ctx context.Context) (WorkspaceAgentListeningPortsResponse, error)
- func (c *WorkspaceAgentConn) Ping(ctx context.Context) (time.Duration, bool, error)
- func (c *WorkspaceAgentConn) ReconnectingPTY(ctx context.Context, id uuid.UUID, height, width uint16, command string) (net.Conn, error)
- func (c *WorkspaceAgentConn) SSH(ctx context.Context) (net.Conn, error)
- func (c *WorkspaceAgentConn) SSHClient(ctx context.Context) (*ssh.Client, error)
- func (c *WorkspaceAgentConn) Speedtest(ctx context.Context, direction speedtest.Direction, duration time.Duration) ([]speedtest.Result, error)
- type WorkspaceAgentConnectionInfo
- type WorkspaceAgentLifecycle
- type WorkspaceAgentListeningPort
- type WorkspaceAgentListeningPortsResponse
- type WorkspaceAgentReconnectingPTYInit
- type WorkspaceAgentStatus
- type WorkspaceApp
- type WorkspaceAppHealth
- type WorkspaceAppSharingLevel
- type WorkspaceBuild
- type WorkspaceBuildParameter
- type WorkspaceBuildsRequest
- type WorkspaceFilter
- type WorkspaceOptions
- type WorkspaceQuota
- type WorkspaceResource
- type WorkspaceResourceMetadata
- type WorkspaceStatus
- type WorkspaceTransition
- type WorkspacesRequest
- type WorkspacesResponse
Constants ¶
const ( // SessionTokenCookie represents the name of the cookie or query parameter the API key is stored in. SessionTokenCookie = "coder_session_token" // SessionTokenHeader is the custom header to use for authentication. SessionTokenHeader = "Coder-Session-Token" // OAuth2StateCookie is the name of the cookie that stores the oauth2 state. OAuth2StateCookie = "oauth_state" // OAuth2RedirectCookie is the name of the cookie that stores the oauth2 redirect. OAuth2RedirectCookie = "oauth_redirect" // BypassRatelimitHeader is the custom header to use to bypass ratelimits. // Only owners can bypass rate limits. This is typically used for scale testing. // nolint: gosec BypassRatelimitHeader = "X-Coder-Bypass-Ratelimit" )
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!
const ( LogSourceProvisionerDaemon LogSource = "provisioner_daemon" LogSourceProvisioner LogSource = "provisioner" LogLevelTrace LogLevel = "trace" LogLevelDebug LogLevel = "debug" LogLevelInfo LogLevel = "info" LogLevelWarn LogLevel = "warn" LogLevelError LogLevel = "error" )
const ( WorkspaceAgentSSHPort = 1 WorkspaceAgentReconnectingPTYPort = 2 WorkspaceAgentSpeedtestPort = 3 // WorkspaceAgentHTTPAPIServerPort serves a HTTP server with endpoints for e.g. // gathering agent statistics. WorkspaceAgentHTTPAPIServerPort = 4 // WorkspaceAgentMinimumListeningPort is the minimum port that the listening-ports // endpoint will return to the client, and the minimum port that is accepted // by the proxy applications endpoint. Coder consumes ports 1-4 at the // moment, and we reserve some extra ports for future use. Port 9 and up are // available for the user. // // This is not enforced in the CLI intentionally as we don't really care // *that* much. The user could bypass this in the CLI by using SSH instead // anyways. WorkspaceAgentMinimumListeningPort = 9 )
const ( GitProviderAzureDevops = "azure-devops" GitProviderGitHub = "github" GitProviderGitLab = "gitlab" GitProviderBitBucket = "bitbucket" )
const (
ContentTypeTar = "application/x-tar"
)
Variables ¶
var ( // ExperimentsAll 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. ExperimentsAll = Experiments{ExperimentTemplateEditor} )
var FeatureNames = []FeatureName{ FeatureUserLimit, FeatureAuditLog, FeatureBrowserOnly, FeatureSCIM, FeatureTemplateRBAC, FeatureHighAvailability, FeatureMultipleGitAuth, FeatureExternalProvisionerDaemons, FeatureAppearance, }
FeatureNames must be kept in-sync with the Feature enum above.
var Me = "me"
Me is used as a replacement for your own ID.
var WorkspaceAgentIP = netip.MustParseAddr("fd7a:115c:a1e0:49d6:b259:b7ac:b1b2:48f4")
WorkspaceAgentIP is a static IPv6 address with the Tailscale prefix that is used to route connections from clients to this node. A dynamic address is not required because a Tailnet client only dials a single agent at a time.
var WorkspaceAgentIgnoredListeningPorts = map[uint16]struct{}{
0: {},
1: {},
2: {},
3: {},
4: {},
5: {},
6: {},
7: {},
8: {},
20: {},
21: {},
22: {},
23: {},
25: {},
53: {},
110: {},
143: {},
179: {},
389: {},
636: {},
465: {},
587: {},
989: {},
990: {},
993: {},
995: {},
3306: {},
3389: {},
5432: {},
27017: {},
27018: {},
27019: {},
28017: {},
}
WorkspaceAgentIgnoredListeningPorts contains a list of ports to ignore when looking for running applications inside a workspace. We want to ignore non-HTTP servers, so we pre-populate this list with common ports that are not HTTP servers.
This is implemented as a map for fast lookup.
Functions ¶
func IsConnectionError ¶ added in v0.16.0
IsConnectionError is a convenience function for checking if the source of an error is due to a 'connection refused', 'no such host', etc.
func ReadBodyAsError ¶ added in v0.16.0
ReadBodyAsError reads the response as a codersdk.Response, and wraps it in a codersdk.Error type for easy marshaling.
func ServerSentEventReader ¶ added in v0.9.0
func ServerSentEventReader(ctx context.Context, rc io.ReadCloser) func() (*ServerSentEvent, error)
func ValidateNewWorkspaceParameters ¶ added in v0.17.0
func ValidateNewWorkspaceParameters(richParameters []TemplateVersionParameter, buildParameters []WorkspaceBuildParameter) error
func ValidateWorkspaceBuildParameter ¶ added in v0.15.3
func ValidateWorkspaceBuildParameter(richParameter TemplateVersionParameter, buildParameter WorkspaceBuildParameter, lastBuildParameter *WorkspaceBuildParameter) error
func ValidateWorkspaceBuildParameters ¶ added in v0.15.3
func ValidateWorkspaceBuildParameters(richParameters []TemplateVersionParameter, buildParameters, lastBuildParameters []WorkspaceBuildParameter) error
func WorkspaceDisplayStatus ¶ added in v0.7.7
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)
func WorkspaceNotifyChannel ¶ added in v0.12.6
WorkspaceNotifyChannel is the PostgreSQL NOTIFY channel to listen for updates on. The payload is empty, because the size of a workspace payload can be very large.
Types ¶
type APIKey ¶ added in v0.7.6
type APIKey struct { ID string `json:"id" table:"id,default_sort" validate:"required"` UserID uuid.UUID `json:"user_id" validate:"required" format:"uuid"` LastUsed time.Time `json:"last_used" table:"last used" validate:"required" format:"date-time"` ExpiresAt time.Time `json:"expires_at" table:"expires at" validate:"required" format:"date-time"` CreatedAt time.Time `json:"created_at" table:"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" validate:"required" enums:"all,application_connect"` LifetimeSeconds int64 `json:"lifetime_seconds" validate:"required"` }
APIKey: do not ever return the HashedSecret
type APIKeyScope ¶ added in v0.10.0
type APIKeyScope string
const ( // APIKeyScopeAll is a scope that allows the user to do everything. APIKeyScopeAll APIKeyScope = "all" // APIKeyScopeApplicationConnect is a scope that allows the user // to connect to applications in a workspace. APIKeyScopeApplicationConnect APIKeyScope = "application_connect" )
type AddLicenseRequest ¶ added in v0.8.7
type AddLicenseRequest struct {
License string `json:"license" validate:"required"`
}
type AgentStatsReportRequest ¶ added in v0.8.12
type AgentStatsReportRequest struct { }
AgentStatsReportRequest is a WebSocket request by coderd to the agent for stats. @typescript-ignore AgentStatsReportRequest
type AgentStatsReportResponse ¶ added in v0.8.12
type AgentStatsReportResponse struct { NumConns int64 `json:"num_comms"` // RxBytes is the number of received bytes. RxBytes int64 `json:"rx_bytes"` // TxBytes is the number of transmitted bytes. TxBytes int64 `json:"tx_bytes"` }
AgentStatsReportResponse is returned for each report request by the agent.
type AppHostResponse ¶ added in v0.16.0
type AppHostResponse struct { // Host is the externally accessible URL for the Coder instance. Host string `json:"host"` }
type AppearanceConfig ¶ added in v0.14.0
type AppearanceConfig struct { LogoURL string `json:"logo_url"` ServiceBanner ServiceBannerConfig `json:"service_banner"` }
type AssignableRoles ¶ added in v0.8.6
type AuditAction ¶ added in v0.8.11
type AuditAction string
const ( AuditActionCreate AuditAction = "create" AuditActionWrite AuditAction = "write" AuditActionDelete AuditAction = "delete" AuditActionStart AuditAction = "start" AuditActionStop AuditAction = "stop" AuditActionLogin AuditAction = "login" AuditActionLogout AuditAction = "logout" )
func (AuditAction) Friendly ¶ added in v0.16.0
func (a AuditAction) Friendly() string
type AuditDiff ¶ added in v0.8.11
type AuditDiff map[string]AuditDiffField
type AuditDiffField ¶ added in v0.8.11
type AuditLog ¶ added in v0.8.11
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"` OrganizationID uuid.UUID `json:"organization_id" format:"uuid"` IP netip.Addr `json:"ip"` UserAgent string `json:"user_agent"` ResourceType ResourceType `json:"resource_type"` ResourceID uuid.UUID `json:"resource_id" format:"uuid"` // ResourceTarget is the name of the resource. 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"` Description string `json:"description"` ResourceLink string `json:"resource_link"` IsDeleted bool `json:"is_deleted"` User *User `json:"user"` }
type AuditLogResponse ¶ added in v0.8.14
type AuditLogsRequest ¶ added in v0.9.0
type AuditLogsRequest struct { SearchQuery string `json:"q,omitempty"` Pagination }
type AuthMethod ¶ added in v0.16.0
type AuthMethod struct {
Enabled bool `json:"enabled"`
}
type AuthMethods ¶ added in v0.4.4
type AuthMethods struct { Password AuthMethod `json:"password"` Github AuthMethod `json:"github"` OIDC OIDCAuthMethod `json:"oidc"` }
AuthMethods contains authentication method information like whether they are enabled or not or custom text, etc.
type AuthorizationCheck ¶ added in v0.9.0
type AuthorizationCheck struct { // Object can represent a "set" of objects, such as: all workspaces in an organization, all workspaces owned by me, and all workspaces across the entire product. // When defining an object, use the most specific language when possible to // produce the smallest set. Meaning to set as many fields on 'Object' as // you can. Example, if you want to check if you can update all workspaces // owned by 'me', try to also add an 'OrganizationID' to the settings. // Omitting the 'OrganizationID' could produce the incorrect value, as // workspaces have both `user` and `organization` owners. Object AuthorizationObject `json:"object"` Action string `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 ¶ added in v0.9.0
type AuthorizationObject struct { // ResourceType is the name of the resource. // `./coderd/rbac/object.go` has the list of valid resource types. ResourceType string `json:"resource_type"` // OwnerID (optional) adds the set constraint to all resources owned by a given user. OwnerID string `json:"owner_id,omitempty"` // OrganizationID (optional) adds the set constraint to all resources owned by a given organization. OrganizationID string `json:"organization_id,omitempty"` // ResourceID (optional) reduces the set to a singular resource. This assigns // a resource ID to the resource type, eg: a single workspace. // The rbac library will not fetch the resource from the database, so if you // are using this option, you should also set the owner ID and organization ID // if possible. Be as specific as possible using all the fields relevant. ResourceID string `json:"resource_id,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 ¶ added in v0.9.0
type AuthorizationRequest struct { // Checks is a map keyed with an arbitrary string to a permission check. // The key can be any string that is helpful to the caller, and allows // multiple permission checks to be run in a single request. // The key ensures that each permission check has the same key in the // response. 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.
type AuthorizationResponse ¶ added in v0.9.0
type BuildInfoResponse ¶ added in v0.4.1
type BuildInfoResponse struct { // ExternalURL references the current Coder version. // For production builds, this will link directly to a release. For development builds, this will link to a commit. ExternalURL string `json:"external_url"` // Version returns the semantic version of the build. Version string `json:"version"` }
BuildInfoResponse contains build information for this instance of Coder.
func (BuildInfoResponse) CanonicalVersion ¶ added in v0.7.7
func (b BuildInfoResponse) CanonicalVersion() string
CanonicalVersion trims build information from the version. E.g. 'v0.7.4-devel+11573034' -> 'v0.7.4'.
type BuildReason ¶ added in v0.7.2
type BuildReason string
const ( // "initiator" is used when a workspace build is triggered by a user. // Combined with the initiator id/username, it indicates which user initiated the build. BuildReasonInitiator BuildReason = "initiator" // "autostart" is used when a build to start a workspace is triggered by Autostart. // The initiator id/username in this case is the workspace owner and can be ignored. BuildReasonAutostart BuildReason = "autostart" // "autostop" is used when a build to stop a workspace is triggered by Autostop. // The initiator id/username in this case is the workspace owner and can be ignored. BuildReasonAutostop BuildReason = "autostop" )
type Client ¶
type Client struct { HTTPClient *http.Client URL *url.URL // Logger is optionally provided to log requests. // Method, URL, and response code will be logged by default. Logger slog.Logger // LogBodies can be enabled to print request and response bodies to the logger. LogBodies bool // Trace can be enabled to propagate tracing spans to the Coder API. // This is useful for tracking a request end-to-end. Trace bool // contains filtered or unexported fields }
Client is an HTTP caller for methods to the Coder API. @typescript-ignore Client
func (*Client) AddLicense ¶ added in v0.8.7
func (*Client) AppHost ¶ added in v0.16.0
func (c *Client) AppHost(ctx context.Context) (AppHostResponse, error)
AppHost returns the site-wide application wildcard hostname without the leading "*.", 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.
func (*Client) Appearance ¶ added in v0.14.0
func (c *Client) Appearance(ctx context.Context) (AppearanceConfig, error)
Appearance returns the configuration that modifies the visual display of the dashboard.
func (*Client) AuditLogs ¶ added in v0.8.14
func (c *Client) AuditLogs(ctx context.Context, req AuditLogsRequest) (AuditLogResponse, error)
AuditLogs retrieves audit logs from the given page.
func (*Client) AuthCheck ¶ added in v0.16.0
func (c *Client) AuthCheck(ctx context.Context, req AuthorizationRequest) (AuthorizationResponse, error)
AuthCheck allows the authenticated user to check if they have the given permissions to a set of resources.
func (*Client) AuthMethods ¶ added in v0.4.4
func (c *Client) AuthMethods(ctx context.Context) (AuthMethods, error)
AuthMethods returns types of authentication available to the user.
func (*Client) BuildInfo ¶ added in v0.4.1
func (c *Client) BuildInfo(ctx context.Context) (BuildInfoResponse, error)
BuildInfo returns build information for this instance of Coder.
func (*Client) CancelTemplateVersion ¶ added in v0.4.0
CancelTemplateVersion marks a template version job as canceled.
func (*Client) CancelTemplateVersionDryRun ¶ added in v0.6.1
CancelTemplateVersionDryRun marks a template version dry-run job as canceled.
func (*Client) CancelWorkspaceBuild ¶
CancelWorkspaceBuild marks a workspace build job as canceled.
func (*Client) CreateAPIKey ¶
CreateAPIKey generates an API key for the user ID provided. DEPRECATED: use CreateToken instead.
func (*Client) CreateFirstUser ¶
func (c *Client) CreateFirstUser(ctx context.Context, req CreateFirstUserRequest) (CreateFirstUserResponse, error)
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.
func (*Client) CreateGroup ¶ added in v0.9.9
func (*Client) CreateOrganization ¶
func (c *Client) CreateOrganization(ctx context.Context, req CreateOrganizationRequest) (Organization, error)
CreateOrganization creates an organization and adds the provided user as an admin.
func (*Client) CreateParameter ¶
func (c *Client) CreateParameter(ctx context.Context, scope ParameterScope, id uuid.UUID, req CreateParameterRequest) (Parameter, error)
func (*Client) CreateTemplate ¶ added in v0.4.0
func (c *Client) CreateTemplate(ctx context.Context, organizationID uuid.UUID, request CreateTemplateRequest) (Template, error)
CreateTemplate creates a new template inside an organization.
func (*Client) CreateTemplateVersion ¶ added in v0.4.0
func (c *Client) CreateTemplateVersion(ctx context.Context, organizationID uuid.UUID, req CreateTemplateVersionRequest) (TemplateVersion, error)
CreateTemplateVersion processes source-code and optionally associates the version with a template. Executing without a template is useful for validating source-code.
func (*Client) CreateTemplateVersionDryRun ¶ added in v0.6.1
func (c *Client) CreateTemplateVersionDryRun(ctx context.Context, version uuid.UUID, req CreateTemplateVersionDryRunRequest) (ProvisionerJob, error)
CreateTemplateVersionDryRun begins a dry-run provisioner job against the given template version with the given parameter values.
func (*Client) CreateTestAuditLog ¶ added in v0.8.14
func (c *Client) CreateTestAuditLog(ctx context.Context, req CreateTestAuditLogRequest) error
CreateTestAuditLog creates a fake audit log. Only owners of the organization can perform this action. It's used for testing purposes.
func (*Client) CreateToken ¶ added in v0.9.7
func (c *Client) CreateToken(ctx context.Context, userID string, req CreateTokenRequest) (GenerateAPIKeyResponse, error)
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.
func (*Client) CreateUser ¶
CreateUser creates a new user.
func (*Client) CreateWorkspace ¶
func (c *Client) CreateWorkspace(ctx context.Context, organizationID uuid.UUID, user string, request CreateWorkspaceRequest) (Workspace, error)
CreateWorkspace creates a new workspace for the template specified.
func (*Client) CreateWorkspaceBuild ¶
func (c *Client) CreateWorkspaceBuild(ctx context.Context, workspace uuid.UUID, request CreateWorkspaceBuildRequest) (WorkspaceBuild, error)
CreateWorkspaceBuild queues a new build to occur for a workspace.
func (*Client) DeleteAPIKey ¶ added in v0.9.7
DeleteAPIKey deletes API key by id.
func (*Client) DeleteGroup ¶ added in v0.9.9
func (*Client) DeleteLicense ¶ added in v0.8.7
func (*Client) DeleteParameter ¶
func (*Client) DeleteTemplate ¶ added in v0.4.0
func (*Client) DeleteUser ¶ added in v0.8.15
DeleteUser deletes a user.
func (*Client) DeletedWorkspace ¶ added in v0.6.0
DeletedWorkspace returns a single workspace that was deleted.
func (*Client) DeploymentConfig ¶ added in v0.11.0
func (c *Client) DeploymentConfig(ctx context.Context) (DeploymentConfig, error)
DeploymentConfig returns the deployment config for the coder server.
func (*Client) DeploymentDAUs ¶ added in v0.15.3
func (c *Client) DeploymentDAUs(ctx context.Context) (*DeploymentDAUsResponse, error)
func (*Client) DialWorkspaceAgent ¶
func (c *Client) DialWorkspaceAgent(ctx context.Context, agentID uuid.UUID, options *DialWorkspaceAgentOptions) (*WorkspaceAgentConn, error)
func (*Client) Entitlements ¶ added in v0.8.6
func (c *Client) Entitlements(ctx context.Context) (Entitlements, error)
func (*Client) Experiments ¶ added in v0.15.0
func (c *Client) Experiments(ctx context.Context) (Experiments, error)
func (*Client) GroupByOrgAndName ¶ added in v0.12.0
func (*Client) GroupsByOrganization ¶ added in v0.9.9
func (*Client) HasFirstUser ¶
HasFirstUser returns whether the first user has been created.
func (*Client) ListOrganizationRoles ¶ added in v0.5.4
func (c *Client) ListOrganizationRoles(ctx context.Context, org uuid.UUID) ([]AssignableRoles, error)
ListOrganizationRoles lists all assignable roles for a given organization.
func (*Client) ListSiteRoles ¶ added in v0.5.4
func (c *Client) ListSiteRoles(ctx context.Context) ([]AssignableRoles, error)
ListSiteRoles lists all assignable site wide roles.
func (*Client) LoginWithPassword ¶
func (c *Client) LoginWithPassword(ctx context.Context, req LoginWithPasswordRequest) (LoginWithPasswordResponse, error)
LoginWithPassword creates a session token authenticating with an email and password. Call `SetSessionToken()` to apply the newly acquired token to the client.
func (*Client) Logout ¶
Logout calls the /logout API Call `ClearSessionToken()` to clear the session token of the client.
func (*Client) Organization ¶
func (*Client) OrganizationByName ¶
func (*Client) OrganizationsByUser ¶
OrganizationsByUser returns all organizations the user is a member of.
func (*Client) Parameters ¶
func (*Client) PatchGroup ¶ added in v0.9.9
func (*Client) PreviousTemplateVersion ¶ added in v0.13.2
func (*Client) ProvisionerDaemons ¶ added in v0.6.1
func (c *Client) ProvisionerDaemons(ctx context.Context) ([]ProvisionerDaemon, error)
ProvisionerDaemonsByOrganization returns provisioner daemons available for an organization.
func (*Client) PutExtendWorkspace ¶ added in v0.6.1
func (c *Client) PutExtendWorkspace(ctx context.Context, id uuid.UUID, req PutExtendWorkspaceRequest) error
PutExtendWorkspace updates the deadline for resources of the latest workspace build.
func (*Client) RegenerateGitSSHKey ¶ added in v0.4.0
RegenerateGitSSHKey will create a new SSH key pair for the user and return it.
func (*Client) Request ¶ added in v0.5.10
func (c *Client) Request(ctx context.Context, method, path string, body interface{}, opts ...RequestOption) (*http.Response, error)
Request performs a HTTP request with the body provided. The caller is responsible for closing the response body.
func (*Client) ServeProvisionerDaemon ¶ added in v0.12.8
func (c *Client) ServeProvisionerDaemon(ctx context.Context, organization uuid.UUID, provisioners []ProvisionerType, tags map[string]string) (proto.DRPCProvisionerDaemonClient, error)
ListenProvisionerDaemon returns the gRPC service for a provisioner daemon implementation.
func (*Client) SessionToken ¶
SessionToken returns the currently set token for the client.
func (*Client) SetSessionToken ¶ added in v0.12.6
SetSessionToken returns the currently set token for the client.
func (*Client) TemplateACL ¶ added in v0.9.9
func (*Client) TemplateByName ¶ added in v0.4.0
func (c *Client) TemplateByName(ctx context.Context, organizationID uuid.UUID, name string) (Template, error)
TemplateByName finds a template inside the organization provided with a case-insensitive name.
func (*Client) TemplateDAUs ¶ added in v0.8.12
func (*Client) TemplateExamples ¶ added in v0.13.2
func (c *Client) TemplateExamples(ctx context.Context, organizationID uuid.UUID) ([]TemplateExample, error)
TemplateExamples lists example templates embedded in coder.
func (*Client) TemplateVersion ¶ added in v0.4.0
TemplateVersion returns a template version by ID.
func (*Client) TemplateVersionByName ¶ added in v0.4.0
func (c *Client) TemplateVersionByName(ctx context.Context, template uuid.UUID, name string) (TemplateVersion, error)
TemplateVersionByName returns a template version by it's friendly name. This is used for path-based routing. Like: /templates/example/versions/helloworld
func (*Client) TemplateVersionByOrganizationAndName ¶ added in v0.12.8
func (*Client) TemplateVersionDryRun ¶ added in v0.6.1
func (c *Client) TemplateVersionDryRun(ctx context.Context, version, job uuid.UUID) (ProvisionerJob, error)
TemplateVersionDryRun returns the current state of a template version dry-run job.
func (*Client) TemplateVersionDryRunLogsAfter ¶ added in v0.6.1
func (c *Client) TemplateVersionDryRunLogsAfter(ctx context.Context, version, job uuid.UUID, after int64) (<-chan ProvisionerJobLog, io.Closer, error)
TemplateVersionDryRunLogsAfter streams logs for a template version dry-run that occurred after a specific log ID.
func (*Client) TemplateVersionDryRunLogsBefore ¶ added in v0.6.1
func (c *Client) TemplateVersionDryRunLogsBefore(ctx context.Context, version, job uuid.UUID, before int64) ([]ProvisionerJobLog, error)
TemplateVersionDryRunLogsBefore returns logs for a template version dry-run that occurred before a specific log ID.
func (*Client) TemplateVersionDryRunResources ¶ added in v0.6.1
func (c *Client) TemplateVersionDryRunResources(ctx context.Context, version, job uuid.UUID) ([]WorkspaceResource, error)
TemplateVersionDryRunResources returns the resources of a finished template version dry-run job.
func (*Client) TemplateVersionLogsAfter ¶ added in v0.4.0
func (c *Client) TemplateVersionLogsAfter(ctx context.Context, version uuid.UUID, after int64) (<-chan ProvisionerJobLog, io.Closer, error)
TemplateVersionLogsAfter streams logs for a template version that occurred after a specific log ID.
func (*Client) TemplateVersionLogsBefore ¶ added in v0.4.0
func (c *Client) TemplateVersionLogsBefore(ctx context.Context, version uuid.UUID, before int64) ([]ProvisionerJobLog, error)
TemplateVersionLogsBefore returns logs that occurred before a specific log ID.
func (*Client) TemplateVersionParameters ¶ added in v0.4.0
func (c *Client) TemplateVersionParameters(ctx context.Context, version uuid.UUID) ([]ComputedParameter, error)
TemplateVersionParameters returns computed parameters for a template version.
func (*Client) TemplateVersionResources ¶ added in v0.4.0
func (c *Client) TemplateVersionResources(ctx context.Context, version uuid.UUID) ([]WorkspaceResource, error)
TemplateVersionResources returns resources a template version declares.
func (*Client) TemplateVersionRichParameters ¶ added in v0.15.0
func (c *Client) TemplateVersionRichParameters(ctx context.Context, version uuid.UUID) ([]TemplateVersionParameter, error)
TemplateVersionParameters returns parameters a template version exposes.
func (*Client) TemplateVersionSchema ¶ added in v0.4.0
func (c *Client) TemplateVersionSchema(ctx context.Context, version uuid.UUID) ([]ParameterSchema, error)
TemplateVersionSchema returns schemas for a template version by ID.
func (*Client) TemplateVersionsByTemplate ¶ added in v0.4.0
func (c *Client) TemplateVersionsByTemplate(ctx context.Context, req TemplateVersionsByTemplateRequest) ([]TemplateVersion, error)
TemplateVersionsByTemplate lists versions associated with a template.
func (*Client) TemplatesByOrganization ¶ added in v0.4.0
func (c *Client) TemplatesByOrganization(ctx context.Context, organizationID uuid.UUID) ([]Template, error)
TemplatesByOrganization lists all templates inside of an organization.
func (*Client) UpdateActiveTemplateVersion ¶ added in v0.4.0
func (c *Client) UpdateActiveTemplateVersion(ctx context.Context, template uuid.UUID, req UpdateActiveTemplateVersion) error
UpdateActiveTemplateVersion updates the active template version to the ID provided. The template version must be attached to the template.
func (*Client) UpdateAppearance ¶ added in v0.14.0
func (c *Client) UpdateAppearance(ctx context.Context, appearance AppearanceConfig) error
func (*Client) UpdateCheck ¶ added in v0.13.0
func (c *Client) UpdateCheck(ctx context.Context) (UpdateCheckResponse, error)
UpdateCheck returns information about the latest release version of Coder and whether or not the server is running the latest release.
func (*Client) UpdateOrganizationMemberRoles ¶ added in v0.5.2
func (c *Client) UpdateOrganizationMemberRoles(ctx context.Context, organizationID uuid.UUID, user string, req UpdateRoles) (OrganizationMember, error)
UpdateOrganizationMemberRoles grants the userID the specified roles in an org. Include ALL roles the user has.
func (*Client) UpdateTemplateACL ¶ added in v0.9.9
func (*Client) UpdateTemplateMeta ¶ added in v0.6.3
func (*Client) UpdateUserPassword ¶ added in v0.5.5
func (c *Client) UpdateUserPassword(ctx context.Context, user string, req UpdateUserPasswordRequest) error
UpdateUserPassword updates a user password. It calls PUT /users/{user}/password
func (*Client) UpdateUserProfile ¶ added in v0.4.2
func (c *Client) UpdateUserProfile(ctx context.Context, user string, req UpdateUserProfileRequest) (User, error)
UpdateUserProfile enables callers to update profile information
func (*Client) UpdateUserRoles ¶ added in v0.5.2
UpdateUserRoles grants the userID the specified roles. Include ALL roles the user has.
func (*Client) UpdateUserStatus ¶ added in v0.5.8
func (c *Client) UpdateUserStatus(ctx context.Context, user string, status UserStatus) (User, error)
UpdateUserStatus sets the user status to the given status
func (*Client) UpdateWorkspace ¶ added in v0.8.7
func (*Client) UpdateWorkspaceAutostart ¶ added in v0.4.1
func (c *Client) UpdateWorkspaceAutostart(ctx context.Context, id uuid.UUID, req UpdateWorkspaceAutostartRequest) error
UpdateWorkspaceAutostart sets the autostart schedule for workspace by id. If the provided schedule is empty, autostart is disabled for the workspace.
func (*Client) UpdateWorkspaceTTL ¶ added in v0.6.0
func (c *Client) UpdateWorkspaceTTL(ctx context.Context, id uuid.UUID, req UpdateWorkspaceTTLRequest) error
UpdateWorkspaceTTL sets the ttl for workspace by id. If the provided duration is nil, autostop is disabled for the workspace.
func (*Client) Upload ¶
func (c *Client) Upload(ctx context.Context, contentType string, rd io.Reader) (UploadResponse, error)
Upload uploads an arbitrary file with the content type provided. This is used to upload a source-code archive.
func (*Client) Users ¶ added in v0.4.4
func (c *Client) Users(ctx context.Context, req UsersRequest) (GetUsersResponse, error)
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.
func (*Client) WatchWorkspace ¶ added in v0.6.0
func (*Client) WorkspaceAgent ¶ added in v0.4.1
WorkspaceAgent returns an agent by ID.
func (*Client) WorkspaceAgentListeningPorts ¶ added in v0.9.5
func (c *Client) WorkspaceAgentListeningPorts(ctx context.Context, agentID uuid.UUID) (WorkspaceAgentListeningPortsResponse, error)
WorkspaceAgentListeningPorts returns a list of ports that are currently being listened on inside the workspace agent's network namespace.
func (*Client) WorkspaceAgentReconnectingPTY ¶ added in v0.5.2
func (c *Client) WorkspaceAgentReconnectingPTY(ctx context.Context, agentID, reconnect uuid.UUID, height, width uint16, command string) (net.Conn, error)
WorkspaceAgentReconnectingPTY spawns a PTY that reconnects using the token provided. It communicates using `agent.ReconnectingPTYRequest` marshaled as JSON. Responses are PTY output that can be rendered.
func (*Client) WorkspaceBuild ¶
WorkspaceBuild returns a single workspace build for a workspace. If history is "", the latest version is returned.
func (*Client) WorkspaceBuildByUsernameAndWorkspaceNameAndBuildNumber ¶ added in v0.6.6
func (*Client) WorkspaceBuildLogsAfter ¶
func (c *Client) WorkspaceBuildLogsAfter(ctx context.Context, build uuid.UUID, after int64) (<-chan ProvisionerJobLog, io.Closer, error)
WorkspaceBuildLogsAfter streams logs for a workspace build that occurred after a specific log ID.
func (*Client) WorkspaceBuildLogsBefore ¶
func (c *Client) WorkspaceBuildLogsBefore(ctx context.Context, build uuid.UUID, before int64) ([]ProvisionerJobLog, error)
WorkspaceBuildLogsBefore returns logs that occurred before a specific log ID.
func (*Client) WorkspaceBuildParameters ¶ added in v0.15.0
func (*Client) WorkspaceBuildState ¶ added in v0.5.3
WorkspaceBuildState returns the provisioner state of the build.
func (*Client) WorkspaceBuilds ¶
func (c *Client) WorkspaceBuilds(ctx context.Context, req WorkspaceBuildsRequest) ([]WorkspaceBuild, error)
func (*Client) WorkspaceByOwnerAndName ¶ added in v0.5.0
func (c *Client) WorkspaceByOwnerAndName(ctx context.Context, owner string, name string, params WorkspaceOptions) (Workspace, error)
WorkspaceByOwnerAndName returns a workspace by the owner's UUID and the workspace's name.
func (*Client) WorkspaceQuota ¶ added in v0.9.2
func (*Client) Workspaces ¶ added in v0.6.0
func (c *Client) Workspaces(ctx context.Context, filter WorkspaceFilter) (WorkspacesResponse, error)
Workspaces returns all workspaces the authenticated user has access to.
type ComputedParameter ¶ added in v0.7.2
type CreateFirstUserRequest ¶
type CreateFirstUserResponse ¶
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 CreateGroupRequest ¶ added in v0.9.9
type CreateOrganizationRequest ¶
type CreateOrganizationRequest struct {
Name string `json:"name" validate:"required,username"`
}
type CreateParameterRequest ¶
type CreateParameterRequest struct { // CloneID allows copying the value of another parameter. // The other param must be related to the same template_id for this to // succeed. // No other fields are required if using this, as all fields will be copied // from the other parameter. CloneID uuid.UUID `json:"copy_from_parameter,omitempty" validate:"" format:"uuid"` Name string `json:"name" validate:"required"` SourceValue string `json:"source_value" validate:"required"` SourceScheme ParameterSourceScheme `json:"source_scheme" validate:"oneof=data,required" enums:"none,data"` DestinationScheme ParameterDestinationScheme `` /* 148-byte string literal not displayed */ }
CreateParameterRequest is a structure used to create a new parameter value for a scope.
@Description CreateParameterRequest is a structure used to create a new parameter value for a scope.
type CreateTemplateRequest ¶ added in v0.4.0
type CreateTemplateRequest struct { // Name is the name of the template. Name string `json:"name" validate:"template_name,required"` // DisplayName is the displayed name of the template. DisplayName string `json:"display_name,omitempty" validate:"template_display_name"` // Description is a description of what the template contains. It must be // less than 128 bytes. Description string `json:"description,omitempty" validate:"lt=128"` // Icon is a relative path or external URL that specifies // an icon to be displayed in the dashboard. Icon string `json:"icon,omitempty"` // VersionID is an in-progress or completed job to use as an initial version // of the template. // // This is required on creation to enable a user-flow of validating a // template works. There is no reason the data-model cannot support empty // templates, but it doesn't make sense for users. VersionID uuid.UUID `json:"template_version_id" validate:"required" format:"uuid"` ParameterValues []CreateParameterRequest `json:"parameter_values,omitempty"` // DefaultTTLMillis allows optionally specifying the default TTL // for all workspaces created from this template. DefaultTTLMillis *int64 `json:"default_ttl_ms,omitempty"` // Allow users to cancel in-progress workspace jobs. // *bool as the default value is "true". AllowUserCancelWorkspaceJobs *bool `json:"allow_user_cancel_workspace_jobs"` }
CreateTemplateRequest provides options when creating a template.
type CreateTemplateVersionDryRunRequest ¶ added in v0.6.1
type CreateTemplateVersionDryRunRequest struct { WorkspaceName string `json:"workspace_name"` ParameterValues []CreateParameterRequest `json:"parameter_values"` RichParameterValues []WorkspaceBuildParameter `json:"rich_parameter_values"` }
CreateTemplateVersionDryRunRequest defines the request parameters for CreateTemplateVersionDryRun.
type CreateTemplateVersionRequest ¶ added in v0.4.0
type CreateTemplateVersionRequest struct { Name string `json:"name,omitempty" validate:"omitempty,template_name"` // TemplateID optionally associates a version with a template. 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"` // ParameterValues allows for additional parameters to be provided // during the dry-run provision stage. ParameterValues []CreateParameterRequest `json:"parameter_values,omitempty"` }
CreateTemplateVersionRequest enables callers to create a new Template Version.
type CreateTestAuditLogRequest ¶ added in v0.9.0
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"` }
type CreateTokenRequest ¶ added in v0.10.0
type CreateTokenRequest struct { Lifetime time.Duration `json:"lifetime"` Scope APIKeyScope `json:"scope" enums:"all,application_connect"` }
type CreateUserRequest ¶
type CreateUserRequest struct { Email string `json:"email" validate:"required,email" format:"email"` Username string `json:"username" validate:"required,username"` Password string `json:"password" validate:"required"` OrganizationID uuid.UUID `json:"organization_id" validate:"required" format:"uuid"` }
type CreateWorkspaceBuildRequest ¶
type CreateWorkspaceBuildRequest struct { TemplateVersionID uuid.UUID `json:"template_version_id,omitempty" format:"uuid"` Transition WorkspaceTransition `json:"transition" validate:"oneof=create start stop delete,required"` DryRun bool `json:"dry_run,omitempty"` ProvisionerState []byte `json:"state,omitempty"` // Orphan may be set for the Destroy transition. Orphan bool `json:"orphan,omitempty"` // ParameterValues are optional. It will write params to the 'workspace' scope. // This will overwrite any existing parameters with the same name. // This will not delete old params not included in this list. ParameterValues []CreateParameterRequest `json:"parameter_values,omitempty"` RichParameterValues []WorkspaceBuildParameter `json:"rich_parameter_values,omitempty"` }
CreateWorkspaceBuildRequest provides options to update the latest workspace build.
type CreateWorkspaceRequest ¶
type CreateWorkspaceRequest struct { TemplateID uuid.UUID `json:"template_id" validate:"required" format:"uuid"` Name string `json:"name" validate:"workspace_name,required"` AutostartSchedule *string `json:"autostart_schedule"` TTLMillis *int64 `json:"ttl_ms,omitempty"` // ParameterValues allows for additional parameters to be provided // during the initial provision. ParameterValues []CreateParameterRequest `json:"parameter_values,omitempty"` RichParameterValues []WorkspaceBuildParameter `json:"rich_parameter_values,omitempty"` }
CreateWorkspaceRequest provides options for creating a new workspace.
type DERP ¶ added in v0.11.0
type DERP struct { Server *DERPServerConfig `json:"server" typescript:",notnull"` Config *DERPConfig `json:"config" typescript:",notnull"` }
type DERPConfig ¶ added in v0.11.0
type DERPConfig struct { URL *DeploymentConfigField[string] `json:"url" typescript:",notnull"` Path *DeploymentConfigField[string] `json:"path" typescript:",notnull"` }
type DERPRegion ¶ added in v0.8.11
type DERPServerConfig ¶ added in v0.11.0
type DERPServerConfig struct { Enable *DeploymentConfigField[bool] `json:"enable" typescript:",notnull"` RegionID *DeploymentConfigField[int] `json:"region_id" typescript:",notnull"` RegionCode *DeploymentConfigField[string] `json:"region_code" typescript:",notnull"` RegionName *DeploymentConfigField[string] `json:"region_name" typescript:",notnull"` STUNAddresses *DeploymentConfigField[[]string] `json:"stun_addresses" typescript:",notnull"` RelayURL *DeploymentConfigField[string] `json:"relay_url" typescript:",notnull"` }
type DangerousConfig ¶ added in v0.15.0
type DangerousConfig struct { AllowPathAppSharing *DeploymentConfigField[bool] `json:"allow_path_app_sharing" typescript:",notnull"` AllowPathAppSiteOwnerAccess *DeploymentConfigField[bool] `json:"allow_path_app_site_owner_access" typescript:",notnull"` }
type DeploymentConfig ¶ added in v0.11.0
type DeploymentConfig struct { AccessURL *DeploymentConfigField[string] `json:"access_url" typescript:",notnull"` WildcardAccessURL *DeploymentConfigField[string] `json:"wildcard_access_url" typescript:",notnull"` RedirectToAccessURL *DeploymentConfigField[bool] `json:"redirect_to_access_url" typescript:",notnull"` HTTPAddress *DeploymentConfigField[string] `json:"http_address" typescript:",notnull"` AutobuildPollInterval *DeploymentConfigField[time.Duration] `json:"autobuild_poll_interval" typescript:",notnull"` DERP *DERP `json:"derp" typescript:",notnull"` GitAuth *DeploymentConfigField[[]GitAuthConfig] `json:"gitauth" typescript:",notnull"` Prometheus *PrometheusConfig `json:"prometheus" typescript:",notnull"` Pprof *PprofConfig `json:"pprof" typescript:",notnull"` ProxyTrustedHeaders *DeploymentConfigField[[]string] `json:"proxy_trusted_headers" typescript:",notnull"` ProxyTrustedOrigins *DeploymentConfigField[[]string] `json:"proxy_trusted_origins" typescript:",notnull"` CacheDirectory *DeploymentConfigField[string] `json:"cache_directory" typescript:",notnull"` InMemoryDatabase *DeploymentConfigField[bool] `json:"in_memory_database" typescript:",notnull"` PostgresURL *DeploymentConfigField[string] `json:"pg_connection_url" typescript:",notnull"` OAuth2 *OAuth2Config `json:"oauth2" typescript:",notnull"` OIDC *OIDCConfig `json:"oidc" typescript:",notnull"` Telemetry *TelemetryConfig `json:"telemetry" typescript:",notnull"` TLS *TLSConfig `json:"tls" typescript:",notnull"` Trace *TraceConfig `json:"trace" typescript:",notnull"` SecureAuthCookie *DeploymentConfigField[bool] `json:"secure_auth_cookie" typescript:",notnull"` SSHKeygenAlgorithm *DeploymentConfigField[string] `json:"ssh_keygen_algorithm" typescript:",notnull"` MetricsCacheRefreshInterval *DeploymentConfigField[time.Duration] `json:"metrics_cache_refresh_interval" typescript:",notnull"` AgentStatRefreshInterval *DeploymentConfigField[time.Duration] `json:"agent_stat_refresh_interval" typescript:",notnull"` AgentFallbackTroubleshootingURL *DeploymentConfigField[string] `json:"agent_fallback_troubleshooting_url" typescript:",notnull"` AuditLogging *DeploymentConfigField[bool] `json:"audit_logging" typescript:",notnull"` BrowserOnly *DeploymentConfigField[bool] `json:"browser_only" typescript:",notnull"` SCIMAPIKey *DeploymentConfigField[string] `json:"scim_api_key" typescript:",notnull"` Provisioner *ProvisionerConfig `json:"provisioner" typescript:",notnull"` RateLimit *RateLimitConfig `json:"rate_limit" typescript:",notnull"` Experiments *DeploymentConfigField[[]string] `json:"experiments" typescript:",notnull"` UpdateCheck *DeploymentConfigField[bool] `json:"update_check" typescript:",notnull"` MaxTokenLifetime *DeploymentConfigField[time.Duration] `json:"max_token_lifetime" typescript:",notnull"` Swagger *SwaggerConfig `json:"swagger" typescript:",notnull"` Logging *LoggingConfig `json:"logging" typescript:",notnull"` Dangerous *DangerousConfig `json:"dangerous" typescript:",notnull"` DisablePathApps *DeploymentConfigField[bool] `json:"disable_path_apps" typescript:",notnull"` SessionDuration *DeploymentConfigField[time.Duration] `json:"max_session_expiry" typescript:",notnull"` DisableSessionExpiryRefresh *DeploymentConfigField[bool] `json:"disable_session_expiry_refresh" typescript:",notnull"` DisablePasswordAuth *DeploymentConfigField[bool] `json:"disable_password_auth" typescript:",notnull"` // DEPRECATED: Use HTTPAddress or TLS.Address instead. Address *DeploymentConfigField[string] `json:"address" typescript:",notnull"` // DEPRECATED: Use Experiments instead. Experimental *DeploymentConfigField[bool] `json:"experimental" typescript:",notnull"` }
DeploymentConfig is the central configuration for the coder server.
type DeploymentConfigField ¶ added in v0.11.0
type DeploymentConfigField[T Flaggable] struct { Name string `json:"name"` Usage string `json:"usage"` Flag string `json:"flag"` // EnvOverride will override the automatically generated environment // variable name. Useful if you're moving values around but need to keep // backwards compatibility with old environment variable names. // // NOTE: this is not supported for array flags. EnvOverride string `json:"-"` Shorthand string `json:"shorthand"` Enterprise bool `json:"enterprise"` Hidden bool `json:"hidden"` Secret bool `json:"secret"` Default T `json:"default"` Value T `json:"value"` }
func (*DeploymentConfigField[T]) MarshalJSON ¶ added in v0.11.0
func (f *DeploymentConfigField[T]) MarshalJSON() ([]byte, error)
MarshalJSON removes the Value field from the JSON output of any fields marked Secret. nolint:revive
type DeploymentDAUsResponse ¶ added in v0.15.3
type DeploymentDAUsResponse struct {
Entries []DAUEntry `json:"entries"`
}
type DialWorkspaceAgentOptions ¶ added in v0.10.0
type DialWorkspaceAgentOptions struct { Logger slog.Logger // BlockEndpoints forced a direct connection through DERP. BlockEndpoints bool EnableTrafficStats bool }
@typescript-ignore DialWorkspaceAgentOptions
type Entitlement ¶ added in v0.8.6
type Entitlement string
Entitlement represents whether a feature is licensed.
const ( EntitlementEntitled Entitlement = "entitled" EntitlementGracePeriod Entitlement = "grace_period" EntitlementNotEntitled Entitlement = "not_entitled" )
type Entitlements ¶ added in v0.8.6
type Error ¶
Error represents an unaccepted or invalid request to the API. @typescript-ignore Error
func (*Error) StatusCode ¶
type Experiment ¶ added in v0.15.0
type Experiment string
const ( // ExperimentAuthzQuerier is an internal experiment that enables the ExperimentAuthzQuerier // interface for all RBAC operations. NOT READY FOR PRODUCTION USE. ExperimentAuthzQuerier Experiment = "authz_querier" // ExperimentTemplateEditor is an internal experiment that enables the template editor // for all users. ExperimentTemplateEditor Experiment = "template_editor" )
type Experiments ¶ added in v0.15.0
type Experiments []Experiment
Experiments is a list of experiments that are enabled for the deployment. 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.
func (Experiments) Enabled ¶ added in v0.15.0
func (e Experiments) Enabled(ex Experiment) bool
type Feature ¶ added in v0.8.6
type Feature struct { Entitlement Entitlement `json:"entitlement"` Enabled bool `json:"enabled"` Limit *int64 `json:"limit,omitempty"` Actual *int64 `json:"actual,omitempty"` }
type FeatureName ¶ added in v0.15.0
type FeatureName string
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" FeatureBrowserOnly FeatureName = "browser_only" FeatureSCIM FeatureName = "scim" FeatureTemplateRBAC FeatureName = "template_rbac" FeatureHighAvailability FeatureName = "high_availability" FeatureMultipleGitAuth FeatureName = "multiple_git_auth" FeatureExternalProvisionerDaemons FeatureName = "external_provisioner_daemons" FeatureAppearance FeatureName = "appearance" )
func (FeatureName) AlwaysEnable ¶ added in v0.15.0
func (n FeatureName) AlwaysEnable() bool
AlwaysEnable returns if the feature is always enabled if entitled. Warning: We don't know if we need this functionality. This method may disappear at any time.
func (FeatureName) Humanize ¶ added in v0.15.0
func (n FeatureName) Humanize() string
Humanize returns the feature name in a human-readable format.
type GenerateAPIKeyResponse ¶
type GenerateAPIKeyResponse struct {
Key string `json:"key"`
}
GenerateAPIKeyResponse contains an API key for a user.
type GetUsersResponse ¶ added in v0.12.8
type GitAuthConfig ¶ added in v0.11.0
type GitAuthConfig struct { ID string `json:"id"` Type string `json:"type"` ClientID string `json:"client_id"` ClientSecret string `json:"-" yaml:"client_secret"` AuthURL string `json:"auth_url"` TokenURL string `json:"token_url"` ValidateURL string `json:"validate_url"` Regex string `json:"regex"` NoRefresh bool `json:"no_refresh"` Scopes []string `json:"scopes"` }
type GitProvider ¶ added in v0.11.0
type GitProvider string
GitProvider is a constant that represents the type of providers that are supported within Coder. @typescript-ignore GitProvider
type Healthcheck ¶ added in v0.9.0
type Healthcheck struct { // URL specifies the endpoint to check for the app health. URL string `json:"url"` // Interval specifies the seconds between each health check. Interval int32 `json:"interval"` // Threshold specifies the number of consecutive failed health checks before returning "unhealthy". Threshold int32 `json:"threshold"` }
type License ¶ added in v0.8.7
type License struct { ID int32 `json:"id"` UUID uuid.UUID `json:"uuid" format:"uuid"` UploadedAt time.Time `json:"uploaded_at" format:"date-time"` // Claims are the JWT claims asserted by the license. Here we use // a generic string map to ensure that all data from the server is // parsed verbatim, not just the fields this version of Coder // understands. Claims map[string]interface{} `json:"claims"` }
type LoggingConfig ¶ added in v0.15.0
type LoggingConfig struct { Human *DeploymentConfigField[string] `json:"human" typescript:",notnull"` JSON *DeploymentConfigField[string] `json:"json" typescript:",notnull"` Stackdriver *DeploymentConfigField[string] `json:"stackdriver" typescript:",notnull"` }
type LoginType ¶ added in v0.7.6
type LoginType string
LoginType is the type of login used to create the API key.
type LoginWithPasswordRequest ¶
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 ¶
type LoginWithPasswordResponse struct {
SessionToken string `json:"session_token" validate:"required"`
}
LoginWithPasswordResponse contains a session token for the newly authenticated user.
type NullTime ¶ added in v0.8.7
NullTime represents a nullable time.Time. @typescript-ignore NullTime
func NewNullTime ¶ added in v0.8.7
NewNullTime returns a new NullTime with the given time.Time.
func (NullTime) MarshalJSON ¶ added in v0.8.7
MarshalJSON implements json.Marshaler.
func (*NullTime) UnmarshalJSON ¶ added in v0.8.7
UnmarshalJSON implements json.Unmarshaler.
type OAuth2Config ¶ added in v0.11.0
type OAuth2Config struct {
Github *OAuth2GithubConfig `json:"github" typescript:",notnull"`
}
type OAuth2GithubConfig ¶ added in v0.11.0
type OAuth2GithubConfig struct { ClientID *DeploymentConfigField[string] `json:"client_id" typescript:",notnull"` ClientSecret *DeploymentConfigField[string] `json:"client_secret" typescript:",notnull"` AllowedOrgs *DeploymentConfigField[[]string] `json:"allowed_orgs" typescript:",notnull"` AllowedTeams *DeploymentConfigField[[]string] `json:"allowed_teams" typescript:",notnull"` AllowSignups *DeploymentConfigField[bool] `json:"allow_signups" typescript:",notnull"` AllowEveryone *DeploymentConfigField[bool] `json:"allow_everyone" typescript:",notnull"` EnterpriseBaseURL *DeploymentConfigField[string] `json:"enterprise_base_url" typescript:",notnull"` }
type OIDCAuthMethod ¶ added in v0.16.0
type OIDCAuthMethod struct { AuthMethod SignInText string `json:"signInText"` IconURL string `json:"iconUrl"` }
type OIDCConfig ¶ added in v0.11.0
type OIDCConfig struct { AllowSignups *DeploymentConfigField[bool] `json:"allow_signups" typescript:",notnull"` ClientID *DeploymentConfigField[string] `json:"client_id" typescript:",notnull"` ClientSecret *DeploymentConfigField[string] `json:"client_secret" typescript:",notnull"` EmailDomain *DeploymentConfigField[[]string] `json:"email_domain" typescript:",notnull"` IssuerURL *DeploymentConfigField[string] `json:"issuer_url" typescript:",notnull"` Scopes *DeploymentConfigField[[]string] `json:"scopes" typescript:",notnull"` IgnoreEmailVerified *DeploymentConfigField[bool] `json:"ignore_email_verified" typescript:",notnull"` UsernameField *DeploymentConfigField[string] `json:"username_field" typescript:",notnull"` SignInText *DeploymentConfigField[string] `json:"sign_in_text" typescript:",notnull"` IconURL *DeploymentConfigField[string] `json:"icon_url" typescript:",notnull"` }
type Organization ¶
type Organization struct { ID uuid.UUID `json:"id" validate:"required" format:"uuid"` Name string `json:"name" validate:"required"` CreatedAt time.Time `json:"created_at" validate:"required" format:"date-time"` UpdatedAt time.Time `json:"updated_at" validate:"required" format:"date-time"` }
Organization is the JSON representation of a Coder organization.
type OrganizationMember ¶ added in v0.5.2
type OrganizationMember struct { UserID uuid.UUID `db:"user_id" json:"user_id" format:"uuid"` OrganizationID uuid.UUID `db:"organization_id" json:"organization_id" format:"uuid"` CreatedAt time.Time `db:"created_at" json:"created_at" format:"date-time"` UpdatedAt time.Time `db:"updated_at" json:"updated_at" format:"date-time"` Roles []Role `db:"roles" json:"roles"` }
type Pagination ¶ added in v0.5.6
type Pagination struct { // AfterID returns all or up to Limit results after the given // UUID. This option can be used with or as an alternative to // Offset for better performance. To use it as an alternative, // set AfterID to the last UUID returned by the previous // request. AfterID uuid.UUID `json:"after_id,omitempty" format:"uuid"` // Limit sets the maximum number of users to be returned // in a single page. If the limit is <= 0, there is no limit // and all users are returned. Limit int `json:"limit,omitempty"` // Offset is used to indicate which page to return. An offset of 0 // returns the first 'limit' number of users. // To get the next page, use offset=<limit>*<page_number>. // Offset is 0 indexed, so the first record sits at offset 0. Offset int `json:"offset,omitempty"` }
Pagination sets pagination options for the endpoints that support it.
type Parameter ¶
type Parameter struct { ID uuid.UUID `json:"id" table:"id" format:"uuid"` Scope ParameterScope `json:"scope" table:"scope" enums:"template,workspace,import_job"` ScopeID uuid.UUID `json:"scope_id" table:"scope id" format:"uuid"` Name string `json:"name" table:"name,default_sort"` SourceScheme ParameterSourceScheme `json:"source_scheme" table:"source scheme" validate:"ne=none" enums:"none,data"` DestinationScheme ParameterDestinationScheme `` /* 126-byte string literal not displayed */ CreatedAt time.Time `json:"created_at" table:"created at" format:"date-time"` UpdatedAt time.Time `json:"updated_at" table:"updated at" format:"date-time"` }
Parameter represents a set value for the scope.
@Description Parameter represents a set value for the scope.
type ParameterDestinationScheme ¶ added in v0.6.0
type ParameterDestinationScheme string
const ( ParameterDestinationSchemeNone ParameterDestinationScheme = "none" ParameterDestinationSchemeEnvironmentVariable ParameterDestinationScheme = "environment_variable" ParameterDestinationSchemeProvisionerVariable ParameterDestinationScheme = "provisioner_variable" )
type ParameterSchema ¶ added in v0.6.0
type ParameterSchema 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"` Name string `json:"name"` Description string `json:"description"` DefaultSourceScheme ParameterSourceScheme `json:"default_source_scheme" enums:"none,data"` DefaultSourceValue string `json:"default_source_value"` AllowOverrideSource bool `json:"allow_override_source"` DefaultDestinationScheme ParameterDestinationScheme `json:"default_destination_scheme" enums:"none,environment_variable,provisioner_variable"` AllowOverrideDestination bool `json:"allow_override_destination"` DefaultRefresh string `json:"default_refresh"` RedisplayValue bool `json:"redisplay_value"` ValidationError string `json:"validation_error"` ValidationCondition string `json:"validation_condition"` ValidationTypeSystem string `json:"validation_type_system"` ValidationValueType string `json:"validation_value_type"` // This is a special array of items provided if the validation condition // explicitly states the value must be one of a set. ValidationContains []string `json:"validation_contains,omitempty"` }
type ParameterScope ¶
type ParameterScope string
const ( ParameterTemplate ParameterScope = "template" ParameterWorkspace ParameterScope = "workspace" ParameterImportJob ParameterScope = "import_job" )
type ParameterSourceScheme ¶ added in v0.6.0
type ParameterSourceScheme string
const ( ParameterSourceSchemeNone ParameterSourceScheme = "none" ParameterSourceSchemeData ParameterSourceScheme = "data" )
type ParameterTypeSystem ¶ added in v0.6.0
type ParameterTypeSystem string
const ( ParameterTypeSystemNone ParameterTypeSystem = "none" ParameterTypeSystemHCL ParameterTypeSystem = "hcl" )
type PatchGroupRequest ¶ added in v0.9.9
type PprofConfig ¶ added in v0.11.0
type PprofConfig struct { Enable *DeploymentConfigField[bool] `json:"enable" typescript:",notnull"` Address *DeploymentConfigField[string] `json:"address" typescript:",notnull"` }
type PrometheusConfig ¶ added in v0.11.0
type PrometheusConfig struct { Enable *DeploymentConfigField[bool] `json:"enable" typescript:",notnull"` Address *DeploymentConfigField[string] `json:"address" typescript:",notnull"` }
type ProvisionerConfig ¶ added in v0.12.6
type ProvisionerConfig struct { Daemons *DeploymentConfigField[int] `json:"daemons" typescript:",notnull"` DaemonPollInterval *DeploymentConfigField[time.Duration] `json:"daemon_poll_interval" typescript:",notnull"` DaemonPollJitter *DeploymentConfigField[time.Duration] `json:"daemon_poll_jitter" typescript:",notnull"` ForceCancelInterval *DeploymentConfigField[time.Duration] `json:"force_cancel_interval" typescript:",notnull"` }
type ProvisionerDaemon ¶
type ProvisionerDaemon struct { ID uuid.UUID `json:"id" format:"uuid"` CreatedAt time.Time `json:"created_at" format:"date-time"` UpdatedAt sql.NullTime `json:"updated_at" format:"date-time"` Name string `json:"name"` Provisioners []ProvisionerType `json:"provisioners"` Tags map[string]string `json:"tags"` }
type ProvisionerJob ¶
type ProvisionerJob struct { ID uuid.UUID `json:"id" format:"uuid"` CreatedAt time.Time `json:"created_at" format:"date-time"` StartedAt *time.Time `json:"started_at,omitempty" format:"date-time"` CompletedAt *time.Time `json:"completed_at,omitempty" format:"date-time"` CanceledAt *time.Time `json:"canceled_at,omitempty" format:"date-time"` Error string `json:"error,omitempty"` Status ProvisionerJobStatus `json:"status" enums:"pending,running,succeeded,canceling,canceled,failed"` WorkerID *uuid.UUID `json:"worker_id,omitempty" format:"uuid"` FileID uuid.UUID `json:"file_id" format:"uuid"` Tags map[string]string `json:"tags"` }
ProvisionerJob describes the job executed by the provisioning daemon.
type ProvisionerJobLog ¶
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.
type ProvisionerJobStatus ¶
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" )
func (ProvisionerJobStatus) Active ¶ added in v0.4.4
func (p ProvisionerJobStatus) Active() bool
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 ProvisionerStorageMethod ¶ added in v0.6.0
type ProvisionerStorageMethod string
const (
ProvisionerStorageMethodFile ProvisionerStorageMethod = "file"
)
type ProvisionerType ¶ added in v0.6.0
type ProvisionerType string
const ( ProvisionerTypeEcho ProvisionerType = "echo" ProvisionerTypeTerraform ProvisionerType = "terraform" )
type PutExtendWorkspaceRequest ¶ added in v0.6.1
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 RateLimitConfig ¶ added in v0.14.0
type RateLimitConfig struct { DisableAll *DeploymentConfigField[bool] `json:"disable_all" typescript:",notnull"` API *DeploymentConfigField[int] `json:"api" typescript:",notnull"` }
type ReconnectingPTYRequest ¶ added in v0.9.0
type ReconnectingPTYRequest struct { Data string `json:"data"` Height uint16 `json:"height"` Width uint16 `json:"width"` }
ReconnectingPTYRequest is sent from the client to the server to pipe data to a PTY. @typescript-ignore ReconnectingPTYRequest
type Replica ¶ added in v0.10.0
type Replica struct { // ID is the unique identifier for the replica. ID uuid.UUID `json:"id" format:"uuid"` // Hostname is the hostname of the replica. Hostname string `json:"hostname"` // CreatedAt is the timestamp when the replica was first seen. CreatedAt time.Time `json:"created_at" format:"date-time"` // RelayAddress is the accessible address to relay DERP connections. RelayAddress string `json:"relay_address"` // RegionID is the region of the replica. RegionID int32 `json:"region_id"` // Error is the replica error. Error string `json:"error"` // DatabaseLatency is the latency in microseconds to the database. DatabaseLatency int32 `json:"database_latency"` }
type RequestOption ¶ added in v0.9.0
RequestOption is a function that can be used to modify an http.Request.
func WithQueryParam ¶ added in v0.9.8
func WithQueryParam(key, value string) RequestOption
WithQueryParam adds a query parameter to the request.
type ResourceType ¶ added in v0.8.11
type ResourceType string
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" )
func (ResourceType) FriendlyString ¶ added in v0.8.15
func (r ResourceType) FriendlyString() string
type Response ¶ added in v0.7.12
type Response struct { // Message is an actionable message that depicts actions the request took. // These messages should be fully formed sentences with proper punctuation. // Examples: // - "A user has been created." // - "Failed to create a user." Message string `json:"message"` // Detail is a debug message that provides further insight into why the // action failed. This information can be technical and a regular golang // err.Error() text. // - "database: too many open connections" // - "stat: too many open files" Detail string `json:"detail,omitempty"` // Validations are form field-specific friendly error messages. They will be // shown on a form field in the UI. These can also be used to add additional // context if there is a set of errors in the primary 'Message'. Validations []ValidationError `json:"validations,omitempty"` }
Response represents a generic HTTP response.
type ServerSentEvent ¶ added in v0.9.0
type ServerSentEvent struct { Type ServerSentEventType `json:"type"` Data interface{} `json:"data"` }
type ServerSentEventType ¶ added in v0.9.0
type ServerSentEventType string
const ( ServerSentEventTypePing ServerSentEventType = "ping" ServerSentEventTypeData ServerSentEventType = "data" ServerSentEventTypeError ServerSentEventType = "error" )
type ServiceBannerConfig ¶ added in v0.14.0
type SwaggerConfig ¶ added in v0.13.5
type SwaggerConfig struct {
Enable *DeploymentConfigField[bool] `json:"enable" typescript:",notnull"`
}
type TLSConfig ¶ added in v0.11.0
type TLSConfig struct { Enable *DeploymentConfigField[bool] `json:"enable" typescript:",notnull"` Address *DeploymentConfigField[string] `json:"address" typescript:",notnull"` RedirectHTTP *DeploymentConfigField[bool] `json:"redirect_http" typescript:",notnull"` CertFiles *DeploymentConfigField[[]string] `json:"cert_file" typescript:",notnull"` ClientAuth *DeploymentConfigField[string] `json:"client_auth" typescript:",notnull"` ClientCAFile *DeploymentConfigField[string] `json:"client_ca_file" typescript:",notnull"` KeyFiles *DeploymentConfigField[[]string] `json:"key_file" typescript:",notnull"` MinVersion *DeploymentConfigField[string] `json:"min_version" typescript:",notnull"` ClientCertFile *DeploymentConfigField[string] `json:"client_cert_file" typescript:",notnull"` ClientKeyFile *DeploymentConfigField[string] `json:"client_key_file" typescript:",notnull"` }
type TelemetryConfig ¶ added in v0.11.0
type TelemetryConfig struct { Enable *DeploymentConfigField[bool] `json:"enable" typescript:",notnull"` Trace *DeploymentConfigField[bool] `json:"trace" typescript:",notnull"` URL *DeploymentConfigField[string] `json:"url" typescript:",notnull"` }
type Template ¶ added in v0.4.0
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"` 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 is set to -1 when loading. ActiveUserCount int `json:"active_user_count"` BuildTimeStats TemplateBuildTimeStats `json:"build_time_stats"` Description string `json:"description"` Icon string `json:"icon"` DefaultTTLMillis int64 `json:"default_ttl_ms"` CreatedByID uuid.UUID `json:"created_by_id" format:"uuid"` CreatedByName string `json:"created_by_name"` AllowUserCancelWorkspaceJobs bool `json:"allow_user_cancel_workspace_jobs"` }
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 ¶ added in v0.9.9
type TemplateACL struct { Users []TemplateUser `json:"users"` Groups []TemplateGroup `json:"group"` }
type TemplateBuildTimeStats ¶ added in v0.10.0
type TemplateBuildTimeStats map[WorkspaceTransition]TransitionStats
type TemplateDAUsResponse ¶ added in v0.8.12
type TemplateDAUsResponse struct {
Entries []DAUEntry `json:"entries"`
}
TemplateDAUsResponse contains statistics of daily active users of the template.
type TemplateExample ¶ added in v0.13.2
type TemplateGroup ¶ added in v0.9.9
type TemplateGroup struct { Group Role TemplateRole `json:"role" enums:"admin,use"` }
type TemplateRole ¶ added in v0.9.9
type TemplateRole string
const ( TemplateRoleAdmin TemplateRole = "admin" TemplateRoleUse TemplateRole = "use" TemplateRoleDeleted TemplateRole = "" )
type TemplateUser ¶ added in v0.9.9
type TemplateUser struct { User Role TemplateRole `json:"role" enums:"admin,use"` }
type TemplateVersion ¶ added in v0.4.0
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"` Job ProvisionerJob `json:"job"` Readme string `json:"readme"` CreatedBy User `json:"created_by"` }
TemplateVersion represents a single version of a template.
type TemplateVersionParameter ¶ added in v0.4.0
type TemplateVersionParameter struct { Name string `json:"name"` Description string `json:"description"` DescriptionPlaintext string `json:"description_plaintext"` Type string `json:"type" enums:"string,number,bool"` 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"` }
TemplateVersionParameter represents a parameter for a template version.
type TemplateVersionParameterOption ¶ added in v0.15.0
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 TemplateVersionsByTemplateRequest ¶ added in v0.5.6
type TemplateVersionsByTemplateRequest struct { TemplateID uuid.UUID `json:"template_id" validate:"required" format:"uuid"` Pagination }
TemplateVersionsByTemplateRequest defines the request parameters for TemplateVersionsByTemplate.
type TraceConfig ¶ added in v0.12.0
type TraceConfig struct { Enable *DeploymentConfigField[bool] `json:"enable" typescript:",notnull"` HoneycombAPIKey *DeploymentConfigField[string] `json:"honeycomb_api_key" typescript:",notnull"` CaptureLogs *DeploymentConfigField[bool] `json:"capture_logs" typescript:",notnull"` }
type TransitionStats ¶ added in v0.12.9
type UpdateActiveTemplateVersion ¶ added in v0.4.0
type UpdateCheckResponse ¶ added in v0.13.0
type UpdateCheckResponse struct { // Current indicates whether the server version is the same as the latest. Current bool `json:"current"` // Version is the semantic version for the latest release of Coder. Version string `json:"version"` // URL to download the latest release of Coder. URL string `json:"url"` }
UpdateCheckResponse contains information on the latest release of Coder.
type UpdateRoles ¶ added in v0.5.2
type UpdateRoles struct {
Roles []string `json:"roles" validate:""`
}
type UpdateTemplateACL ¶ added in v0.9.9
type UpdateTemplateACL struct { UserPerms map[string]TemplateRole `json:"user_perms,omitempty"` GroupPerms map[string]TemplateRole `json:"group_perms,omitempty"` }
type UpdateTemplateMeta ¶ added in v0.6.3
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"` AllowUserCancelWorkspaceJobs bool `json:"allow_user_cancel_workspace_jobs,omitempty"` }
type UpdateUserPasswordRequest ¶ added in v0.5.5
type UpdateUserProfileRequest ¶ added in v0.4.2
type UpdateUserProfileRequest struct {
Username string `json:"username" validate:"required,username"`
}
type UpdateWorkspaceAutostartRequest ¶ added in v0.4.1
type UpdateWorkspaceAutostartRequest struct {
Schedule *string `json:"schedule"`
}
UpdateWorkspaceAutostartRequest is a request to update a workspace's autostart schedule.
type UpdateWorkspaceRequest ¶ added in v0.8.7
type UpdateWorkspaceRequest struct {
Name string `json:"name,omitempty" validate:"username"`
}
type UpdateWorkspaceTTLRequest ¶ added in v0.6.0
type UpdateWorkspaceTTLRequest struct {
TTLMillis *int64 `json:"ttl_ms"`
}
UpdateWorkspaceTTLRequest is a request to update a workspace's TTL.
type UploadResponse ¶
UploadResponse contains the hash to reference the uploaded file.
type User ¶
type User struct { ID uuid.UUID `json:"id" validate:"required" table:"id" format:"uuid"` Username string `json:"username" validate:"required" table:"username,default_sort"` Email string `json:"email" validate:"required" table:"email" format:"email"` CreatedAt time.Time `json:"created_at" validate:"required" table:"created at" format:"date-time"` LastSeenAt time.Time `json:"last_seen_at" format:"date-time"` Status UserStatus `json:"status" table:"status" enums:"active,suspended"` OrganizationIDs []uuid.UUID `json:"organization_ids" format:"uuid"` Roles []Role `json:"roles"` AvatarURL string `json:"avatar_url" format:"uri"` }
User represents a user in Coder.
type UserStatus ¶ added in v0.5.1
type UserStatus string
const ( UserStatusActive UserStatus = "active" UserStatusSuspended UserStatus = "suspended" )
type UsersRequest ¶ added in v0.4.4
type UsersRequest struct { Search string `json:"search,omitempty" typescript:"-"` // Filter users by status. Status UserStatus `json:"status,omitempty" typescript:"-"` // Filter users that have the given role. Role string `json:"role,omitempty" typescript:"-"` SearchQuery string `json:"q,omitempty"` Pagination }
type ValidationError ¶ added in v0.7.12
type ValidationError struct { Field string `json:"field" validate:"required"` Detail string `json:"detail" validate:"required"` }
ValidationError represents a scoped error to a user input.
func (ValidationError) Error ¶ added in v0.8.2
func (e ValidationError) Error() string
type ValidationMonotonicOrder ¶ added in v0.17.0
type ValidationMonotonicOrder string
const ( MonotonicOrderIncreasing ValidationMonotonicOrder = "increasing" MonotonicOrderDecreasing ValidationMonotonicOrder = "decreasing" )
type Workspace ¶
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"` 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"` LatestBuild WorkspaceBuild `json:"latest_build"` 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"` }
Workspace is a deployment of a template. It references a specific version and can be updated.
type WorkspaceAgent ¶
type WorkspaceAgent 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"` 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"` 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"` StartupScript string `json:"startup_script,omitempty"` Directory string `json:"directory,omitempty"` ExpandedDirectory string `json:"expanded_directory,omitempty"` Version string `json:"version"` Apps []WorkspaceApp `json:"apps"` // DERPLatency is mapped by region name (e.g. "New York City", "Seattle"). DERPLatency map[string]DERPRegion `json:"latency,omitempty"` ConnectionTimeoutSeconds int32 `json:"connection_timeout_seconds"` TroubleshootingURL string `json:"troubleshooting_url"` // LoginBeforeReady if true, the agent will delay logins until it is ready (e.g. executing startup script has ended). LoginBeforeReady bool `db:"login_before_ready" json:"login_before_ready"` // StartupScriptTimeoutSeconds is the number of seconds to wait for the startup script to complete. If the script does not complete within this time, the agent lifecycle will be marked as start_timeout. StartupScriptTimeoutSeconds int32 `db:"startup_script_timeout_seconds" json:"startup_script_timeout_seconds"` }
type WorkspaceAgentConn ¶ added in v0.16.0
WorkspaceAgentConn represents a connection to a workspace agent. @typescript-ignore WorkspaceAgentConn
func (*WorkspaceAgentConn) AwaitReachable ¶ added in v0.16.0
func (c *WorkspaceAgentConn) AwaitReachable(ctx context.Context) bool
AwaitReachable waits for the agent to be reachable.
func (*WorkspaceAgentConn) Close ¶ added in v0.16.0
func (c *WorkspaceAgentConn) Close() error
Close ends the connection to the workspace agent.
func (*WorkspaceAgentConn) DialContext ¶ added in v0.16.0
func (c *WorkspaceAgentConn) DialContext(ctx context.Context, network string, addr string) (net.Conn, error)
DialContext dials the address provided in the workspace agent. The network must be "tcp" or "udp".
func (*WorkspaceAgentConn) ListeningPorts ¶ added in v0.16.0
func (c *WorkspaceAgentConn) ListeningPorts(ctx context.Context) (WorkspaceAgentListeningPortsResponse, error)
ListeningPorts lists the ports that are currently in use by the workspace.
func (*WorkspaceAgentConn) Ping ¶ added in v0.16.0
Ping pings the agent and returns the round-trip time. The bool returns true if the ping was made P2P.
func (*WorkspaceAgentConn) ReconnectingPTY ¶ added in v0.16.0
func (c *WorkspaceAgentConn) ReconnectingPTY(ctx context.Context, id uuid.UUID, height, width uint16, command string) (net.Conn, error)
ReconnectingPTY spawns a new reconnecting terminal session. `ReconnectingPTYRequest` should be JSON marshaled and written to the returned net.Conn. Raw terminal output will be read from the returned net.Conn.
func (*WorkspaceAgentConn) SSH ¶ added in v0.16.0
SSH pipes the SSH protocol over the returned net.Conn. This connects to the built-in SSH server in the workspace agent.
type WorkspaceAgentConnectionInfo ¶ added in v0.8.11
WorkspaceAgentConnectionInfo returns required information for establishing a connection with a workspace. @typescript-ignore WorkspaceAgentConnectionInfo
type WorkspaceAgentLifecycle ¶ added in v0.15.3
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).
Note that states are not guaranteed to be reported, for instance the agent may go from "created" to "ready" without reporting "starting", if it had trouble connecting on startup.
const ( WorkspaceAgentLifecycleCreated WorkspaceAgentLifecycle = "created" WorkspaceAgentLifecycleStarting WorkspaceAgentLifecycle = "starting" WorkspaceAgentLifecycleStartTimeout WorkspaceAgentLifecycle = "start_timeout" WorkspaceAgentLifecycleStartError WorkspaceAgentLifecycle = "start_error" WorkspaceAgentLifecycleReady WorkspaceAgentLifecycle = "ready" )
WorkspaceAgentLifecycle enums.
type WorkspaceAgentListeningPort ¶ added in v0.16.0
type WorkspaceAgentListeningPortsResponse ¶ added in v0.16.0
type WorkspaceAgentListeningPortsResponse struct { // If there are no ports in the list, nothing should be displayed in the UI. // There must not be a "no ports available" message or anything similar, as // there will always be no ports displayed on platforms where our port // detection logic is unsupported. Ports []WorkspaceAgentListeningPort `json:"ports"` }
type WorkspaceAgentReconnectingPTYInit ¶ added in v0.16.0
type WorkspaceAgentReconnectingPTYInit struct { ID uuid.UUID Height uint16 Width uint16 Command string }
WorkspaceAgentReconnectingPTYInit initializes a new reconnecting PTY session. @typescript-ignore WorkspaceAgentReconnectingPTYInit
type WorkspaceAgentStatus ¶
type WorkspaceAgentStatus string
const ( WorkspaceAgentConnecting WorkspaceAgentStatus = "connecting" WorkspaceAgentConnected WorkspaceAgentStatus = "connected" WorkspaceAgentDisconnected WorkspaceAgentStatus = "disconnected" WorkspaceAgentTimeout WorkspaceAgentStatus = "timeout" )
type WorkspaceApp ¶ added in v0.6.2
type WorkspaceApp struct { ID uuid.UUID `json:"id" format:"uuid"` // URL is the address being proxied to inside the workspace. // If external is specified, this will be opened on the client. URL string `json:"url"` // External specifies whether the URL should be opened externally on // the client or not. External bool `json:"external"` // Slug is a unique identifier within the agent. Slug string `json:"slug"` // DisplayName is a friendly name for the app. DisplayName string `json:"display_name"` Command string `json:"command,omitempty"` // Icon is a relative path or external URL that specifies // an icon to be displayed in the dashboard. Icon string `json:"icon,omitempty"` // Subdomain denotes whether the app should be accessed via a path on the // `coder server` or via a hostname-based dev URL. If this is set to true // and there is no app wildcard configured on the server, the app will not // be accessible in the UI. Subdomain bool `json:"subdomain"` SharingLevel WorkspaceAppSharingLevel `json:"sharing_level" enums:"owner,authenticated,public"` // Healthcheck specifies the configuration for checking app health. Healthcheck Healthcheck `json:"healthcheck"` Health WorkspaceAppHealth `json:"health"` }
type WorkspaceAppHealth ¶ added in v0.9.0
type WorkspaceAppHealth string
const ( WorkspaceAppHealthDisabled WorkspaceAppHealth = "disabled" WorkspaceAppHealthInitializing WorkspaceAppHealth = "initializing" WorkspaceAppHealthHealthy WorkspaceAppHealth = "healthy" WorkspaceAppHealthUnhealthy WorkspaceAppHealth = "unhealthy" )
type WorkspaceAppSharingLevel ¶ added in v0.10.0
type WorkspaceAppSharingLevel string
const ( WorkspaceAppSharingLevelOwner WorkspaceAppSharingLevel = "owner" WorkspaceAppSharingLevelAuthenticated WorkspaceAppSharingLevel = "authenticated" WorkspaceAppSharingLevelPublic WorkspaceAppSharingLevel = "public" )
type WorkspaceBuild ¶
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"` 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"` Status WorkspaceStatus `json:"status" enums:"pending,starting,running,stopping,stopped,failed,canceling,canceled,deleting,deleted"` DailyCost int32 `json:"daily_cost"` }
WorkspaceBuild is an at-point representation of a workspace state. BuildNumbers start at 1 and increase by 1 for each subsequent build
type WorkspaceBuildParameter ¶ added in v0.15.0
WorkspaceBuildParameter represents a parameter specific for a workspace build.
type WorkspaceBuildsRequest ¶ added in v0.6.0
type WorkspaceBuildsRequest struct { WorkspaceID uuid.UUID Pagination Since time.Time }
type WorkspaceFilter ¶ added in v0.6.0
type WorkspaceFilter struct { // Owner can be "me" or a username Owner string `json:"owner,omitempty" typescript:"-"` // Template is a template name Template string `json:"template,omitempty" typescript:"-"` // Name will return partial matches Name string `json:"name,omitempty" typescript:"-"` // Status is a workspace status, which is really the status of the latest build Status string `json:"status,omitempty" typescript:"-"` // Offset is the number of workspaces to skip before returning results. Offset int `json:"offset,omitempty" typescript:"-"` // Limit is a limit on the number of workspaces returned. Limit int `json:"limit,omitempty" typescript:"-"` // FilterQuery supports a raw filter query string FilterQuery string `json:"q,omitempty"` }
type WorkspaceOptions ¶ added in v0.6.3
type WorkspaceOptions struct {
IncludeDeleted bool `json:"include_deleted,omitempty"`
}
type WorkspaceQuota ¶ added in v0.9.2
type WorkspaceResource ¶
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 ¶ added in v0.8.3
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.
type WorkspaceStatus ¶ added in v0.9.2
type WorkspaceStatus string
const ( WorkspaceStatusPending WorkspaceStatus = "pending" WorkspaceStatusStarting WorkspaceStatus = "starting" WorkspaceStatusRunning WorkspaceStatus = "running" WorkspaceStatusStopping WorkspaceStatus = "stopping" WorkspaceStatusStopped WorkspaceStatus = "stopped" WorkspaceStatusFailed WorkspaceStatus = "failed" WorkspaceStatusCanceling WorkspaceStatus = "canceling" WorkspaceStatusCanceled WorkspaceStatus = "canceled" WorkspaceStatusDeleting WorkspaceStatus = "deleting" WorkspaceStatusDeleted WorkspaceStatus = "deleted" )
type WorkspaceTransition ¶ added in v0.6.0
type WorkspaceTransition string
const ( WorkspaceTransitionStart WorkspaceTransition = "start" WorkspaceTransitionStop WorkspaceTransition = "stop" WorkspaceTransitionDelete WorkspaceTransition = "delete" )
type WorkspacesRequest ¶ added in v0.11.0
type WorkspacesRequest struct { SearchQuery string `json:"q,omitempty"` Pagination }
type WorkspacesResponse ¶ added in v0.12.6
Source Files ¶
- apikey.go
- audit.go
- authorization.go
- client.go
- deployment.go
- files.go
- gitsshkey.go
- groups.go
- licenses.go
- organizations.go
- pagination.go
- parameters.go
- provisionerdaemons.go
- replicas.go
- richparameters.go
- roles.go
- serversentevents.go
- templates.go
- templateversions.go
- time.go
- updatecheck.go
- users.go
- workspaceagentconn.go
- workspaceagents.go
- workspaceapps.go
- workspacebuilds.go
- workspacedisplaystatus.go
- workspaces.go