Movatterモバイル変換


[0]ホーム

URL:


Alert GO-2024-3228: Coder vulnerable to post-auth URL redirection to untrusted site ('Open Redirect') in github.com/coder/coder
Notice  The highest tagged major version isv2.

codersdk

package
v0.27.3Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License:AGPL-3.0Imports:46Imported by:2

Details

Repository

github.com/coder/coder

Links

Documentation

Index

Constants

View Source
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"// DevURLSessionTokenCookie is the name of the cookie that stores a devurl// token on app domains.//nolint:gosecDevURLSessionTokenCookie = "coder_devurl_session_token"// DevURLSignedAppTokenCookie is the name of the cookie that stores a// temporary JWT that can be used to authenticate instead of the session// token.//nolint:gosecDevURLSignedAppTokenCookie = "coder_devurl_signed_app_token"// SignedAppTokenQueryParameter is the name of the query parameter that// stores a temporary JWT that can be used to authenticate instead of the// session token. This is only acceptable on reconnecting-pty requests, not// apps.//// It has a random suffix to avoid conflict with user query parameters on// apps.//nolint:gosecSignedAppTokenQueryParameter = "coder_signed_app_token_23db1dde"// BypassRatelimitHeader is the custom header to use to bypass ratelimits.// Only owners can bypass rate limits. This is typically used for scale testing.// nolint: gosecBypassRatelimitHeader = "X-Coder-Bypass-Ratelimit"// CLITelemetryHeader contains a base64-encoded representation of the CLI// command that was invoked to produce the request. It is for internal use// only.CLITelemetryHeader = "Coder-CLI-Telemetry")

These cookies are Coder-specific. If a new one is added or changed, the nameshouldn't be likely to conflict with any user-application set cookies.Be sure to strip additional cookies in httpapi.StripCoderCookies!

View Source
const (LogSourceProvisionerDaemonLogSource = "provisioner_daemon"LogSourceProvisionerLogSource = "provisioner"LogLevelTraceLogLevel = "trace"LogLevelDebugLogLevel = "debug"LogLevelInfoLogLevel = "info"LogLevelWarnLogLevel = "warn"LogLevelErrorLogLevel = "error")
View Source
const (WorkspaceAgentSSHPort             =tailnet.WorkspaceAgentSSHPortWorkspaceAgentReconnectingPTYPort =tailnet.WorkspaceAgentReconnectingPTYPortWorkspaceAgentSpeedtestPort       =tailnet.WorkspaceAgentSpeedtestPort// 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)
View Source
const (ContentTypeTar = "application/x-tar")
View Source
const (LicenseExpiryClaim = "license_expires")

Variables

View Source
var ErrSkipClose =xerrors.New("skip tailnet close")
View Source
var ExperimentsAll =Experiments{}

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

FeatureNames must be kept in-sync with the Feature enum above.

View Source
var Me = "me"

Me is used as a replacement for your own ID.

View Source
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 routeconnections from clients to this node. A dynamic address is not required because a Tailnetclient only dials a single agent at a time.

Deprecated: use tailnet.IP() instead. This is kept for backwardscompatibility with wsconncache.See:https://github.com/coder/coder/issues/8218

View Source
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 forrunning 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.

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

Functions

funcBitmapToWeekdaysadded inv0.26.2

func BitmapToWeekdays(bitmapuint8) []string

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

funcDefaultCacheDiradded inv0.19.0

func DefaultCacheDir()string

funcIsConnectionErroradded inv0.16.0

func IsConnectionError(errerror)bool

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

funcIsSecretDeploymentOptionadded inv0.19.0

func IsSecretDeploymentOption(optclibase.Option)bool

funcIsWorkspaceProxiesadded inv0.23.0

func IsWorkspaceProxies(optclibase.Option)bool

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

funcParseSSHConfigOptionadded inv0.20.0

func ParseSSHConfigOption(optstring) (keystring, valuestring, errerror)

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

funcReadBodyAsErroradded inv0.16.0

func ReadBodyAsError(res *http.Response)error

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

funcServerSentEventReaderadded inv0.9.0

func ServerSentEventReader(ctxcontext.Context, rcio.ReadCloser) func() (*ServerSentEvent,error)

funcTimezoneOffsetHouradded inv0.24.0

func TimezoneOffsetHour(loc *time.Location)int

funcValidateNewWorkspaceParametersadded inv0.17.0

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

funcValidateWorkspaceBuildParameteradded inv0.15.3

func ValidateWorkspaceBuildParameter(richParameterTemplateVersionParameter, buildParameter *WorkspaceBuildParameter, lastBuildParameter *WorkspaceBuildParameter)error

funcValidateWorkspaceBuildParametersadded inv0.15.3

func ValidateWorkspaceBuildParameters(richParameters []TemplateVersionParameter, buildParameters, lastBuildParameters []WorkspaceBuildParameter)error

funcWeekdaysToBitmapadded inv0.26.2

func WeekdaysToBitmap(days []string) (uint8,error)

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

funcWorkspaceDisplayStatusadded inv0.7.7

func WorkspaceDisplayStatus(jobStatusProvisionerJobStatus, transitionWorkspaceTransition)string

WorkspaceDisplayStatus computes a status to display on CLI/UI based onthe 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)

funcWorkspaceNotifyChanneladded inv0.12.6

func WorkspaceNotifyChannel(iduuid.UUID)string

WorkspaceNotifyChannel is the PostgreSQL NOTIFYchannel to listen for updates on. The payload is empty,because the size of a workspace payload can be very large.

Types

typeAPIKeyadded inv0.7.6

type APIKey struct {IDstring      `json:"id" validate:"required"`UserIDuuid.UUID   `json:"user_id" validate:"required" format:"uuid"`LastUsedtime.Time   `json:"last_used" validate:"required" format:"date-time"`ExpiresAttime.Time   `json:"expires_at" validate:"required" format:"date-time"`CreatedAttime.Time   `json:"created_at" validate:"required" format:"date-time"`UpdatedAttime.Time   `json:"updated_at" validate:"required" format:"date-time"`LoginTypeLoginType   `json:"login_type" validate:"required" enums:"password,github,oidc,token"`ScopeAPIKeyScope `json:"scope" validate:"required" enums:"all,application_connect"`TokenNamestring      `json:"token_name" validate:"required"`LifetimeSecondsint64       `json:"lifetime_seconds" validate:"required"`}

APIKey: do not ever return the HashedSecret

typeAPIKeyScopeadded inv0.10.0

type APIKeyScopestring
const (// APIKeyScopeAll is a scope that allows the user to do everything.APIKeyScopeAllAPIKeyScope = "all"// APIKeyScopeApplicationConnect is a scope that allows the user// to connect to applications in a workspace.APIKeyScopeApplicationConnectAPIKeyScope = "application_connect")

typeAPIKeyWithOwneradded inv0.18.0

type APIKeyWithOwner struct {APIKeyUsernamestring `json:"username"`}

typeAddLicenseRequestadded inv0.8.7

type AddLicenseRequest struct {Licensestring `json:"license" validate:"required"`}

typeAgentStatsReportRequestadded inv0.8.12

type AgentStatsReportRequest struct{}

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

typeAgentStatsReportResponseadded inv0.8.12

type AgentStatsReportResponse struct {NumConnsint64 `json:"num_comms"`// RxBytes is the number of received bytes.RxBytesint64 `json:"rx_bytes"`// TxBytes is the number of transmitted bytes.TxBytesint64 `json:"tx_bytes"`}

AgentStatsReportResponse is returned for each reportrequest by the agent.

typeAgentSubsystemadded inv0.23.5

type AgentSubsystemstring
const (AgentSubsystemEnvboxAgentSubsystem = "envbox")

typeAppHostResponseadded inv0.16.0

type AppHostResponse struct {// Host is the externally accessible URL for the Coder instance.Hoststring `json:"host"`}

typeAppearanceConfigadded inv0.14.0

type AppearanceConfig struct {LogoURLstring              `json:"logo_url"`ServiceBannerServiceBannerConfig `json:"service_banner"`SupportLinks  []LinkConfig        `json:"support_links,omitempty"`}

typeAssignableRolesadded inv0.8.6

type AssignableRoles struct {RoleAssignablebool `json:"assignable"`}

typeAuditActionadded inv0.8.11

type AuditActionstring
const (AuditActionCreateAuditAction = "create"AuditActionWriteAuditAction = "write"AuditActionDeleteAuditAction = "delete"AuditActionStartAuditAction = "start"AuditActionStopAuditAction = "stop"AuditActionLoginAuditAction = "login"AuditActionLogoutAuditAction = "logout"AuditActionRegisterAuditAction = "register")

func (AuditAction)Friendlyadded inv0.16.0

func (aAuditAction) Friendly()string

typeAuditDiffadded inv0.8.11

type AuditDiff map[string]AuditDiffField

typeAuditDiffFieldadded inv0.8.11

type AuditDiffField struct {Oldany  `json:"old,omitempty"`Newany  `json:"new,omitempty"`Secretbool `json:"secret"`}

typeAuditLogadded inv0.8.11

type AuditLog struct {IDuuid.UUID    `json:"id" format:"uuid"`RequestIDuuid.UUID    `json:"request_id" format:"uuid"`Timetime.Time    `json:"time" format:"date-time"`OrganizationIDuuid.UUID    `json:"organization_id" format:"uuid"`IPnetip.Addr   `json:"ip"`UserAgentstring       `json:"user_agent"`ResourceTypeResourceType `json:"resource_type"`ResourceIDuuid.UUID    `json:"resource_id" format:"uuid"`// ResourceTarget is the name of the resource.ResourceTargetstring          `json:"resource_target"`ResourceIconstring          `json:"resource_icon"`ActionAuditAction     `json:"action"`DiffAuditDiff       `json:"diff"`StatusCodeint32           `json:"status_code"`AdditionalFieldsjson.RawMessage `json:"additional_fields"`Descriptionstring          `json:"description"`ResourceLinkstring          `json:"resource_link"`IsDeletedbool            `json:"is_deleted"`User *User `json:"user"`}

typeAuditLogResponseadded inv0.8.14

type AuditLogResponse struct {AuditLogs []AuditLog `json:"audit_logs"`Countint64      `json:"count"`}

typeAuditLogsRequestadded inv0.9.0

type AuditLogsRequest struct {SearchQuerystring `json:"q,omitempty"`Pagination}

typeAuthMethodadded inv0.16.0

type AuthMethod struct {Enabledbool `json:"enabled"`}

typeAuthMethodsadded inv0.4.4

type AuthMethods struct {ConvertToOIDCEnabledbool           `json:"convert_to_oidc_enabled"`PasswordAuthMethod     `json:"password"`GithubAuthMethod     `json:"github"`OIDCOIDCAuthMethod `json:"oidc"`}

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

typeAuthorizationCheckadded inv0.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.ObjectAuthorizationObject `json:"object"`Actionstring              `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.

typeAuthorizationObjectadded inv0.9.0

type AuthorizationObject struct {// ResourceType is the name of the resource.// `./coderd/rbac/object.go` has the list of valid resource types.ResourceTypeRBACResource `json:"resource_type"`// OwnerID (optional) adds the set constraint to all resources owned by a given user.OwnerIDstring `json:"owner_id,omitempty"`// OrganizationID (optional) adds the set constraint to all resources owned by a given organization.OrganizationIDstring `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.ResourceIDstring `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.

typeAuthorizationRequestadded inv0.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 becausego-playground/validate can only validate structs. If you attempt to passa map into `httpapi.Read`, you will get an invalid type error.

typeAuthorizationResponseadded inv0.9.0

type AuthorizationResponse map[string]bool

typeBuildInfoResponseadded inv0.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.ExternalURLstring `json:"external_url"`// Version returns the semantic version of the build.Versionstring `json:"version"`// DashboardURL is the URL to hit the deployment's dashboard.// For external workspace proxies, this is the coderd they are connected// to.DashboardURLstring `json:"dashboard_url"`WorkspaceProxybool `json:"workspace_proxy"`}

BuildInfoResponse contains build information for this instance of Coder.

func (BuildInfoResponse)CanonicalVersionadded inv0.7.7

func (bBuildInfoResponse) CanonicalVersion()string

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

typeBuildReasonadded inv0.7.2

type BuildReasonstring
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.BuildReasonInitiatorBuildReason = "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.BuildReasonAutostartBuildReason = "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.BuildReasonAutostopBuildReason = "autostop")

typeClient

type Client struct {HTTPClient *http.ClientURL        *url.URL// SessionTokenHeader is an optional custom header to use for setting tokens. By// default 'Coder-Session-Token' is used.SessionTokenHeaderstring// PlainLogger may be set to log HTTP traffic in a human-readable form.// It uses the LogBodies option.PlainLoggerio.Writer// Trace can be enabled to propagate tracing spans to the Coder API.// This is useful for tracking a request end-to-end.Tracebool// DisableDirectConnections forces any connections to workspaces to go// through DERP, regardless of the BlockEndpoints setting on each// connection.DisableDirectConnectionsbool// contains filtered or unexported fields}

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

funcNew

func New(serverURL *url.URL) *Client

New creates a Coder client for the provided URL.

func (*Client)APIKeyByIDadded inv0.19.0

func (c *Client) APIKeyByID(ctxcontext.Context, userIDstring, idstring) (*APIKey,error)

APIKeyByID returns the api key by id.

func (*Client)APIKeyByNameadded inv0.19.0

func (c *Client) APIKeyByName(ctxcontext.Context, userIDstring, namestring) (*APIKey,error)

APIKeyByName returns the api key by name.

func (*Client)AddLicenseadded inv0.8.7

func (c *Client) AddLicense(ctxcontext.Context, rAddLicenseRequest) (License,error)

func (*Client)AppHostadded inv0.16.0

func (c *Client) AppHost(ctxcontext.Context) (AppHostResponse,error)

AppHost returns the site-wide application wildcard hostname without theleading "*.", 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)Appearanceadded inv0.14.0

func (c *Client) Appearance(ctxcontext.Context) (AppearanceConfig,error)

Appearance returns the configuration that modifies the visualdisplay of the dashboard.

func (*Client)AuditLogsadded inv0.8.14

AuditLogs retrieves audit logs from the given page.

func (*Client)AuthCheckadded inv0.16.0

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

func (*Client)AuthMethodsadded inv0.4.4

func (c *Client) AuthMethods(ctxcontext.Context) (AuthMethods,error)

AuthMethods returns types of authentication available to the user.

func (*Client)BuildInfoadded inv0.4.1

func (c *Client) BuildInfo(ctxcontext.Context) (BuildInfoResponse,error)

BuildInfo returns build information for this instance of Coder.

func (*Client)CancelTemplateVersionadded inv0.4.0

func (c *Client) CancelTemplateVersion(ctxcontext.Context, versionuuid.UUID)error

CancelTemplateVersion marks a template version job as canceled.

func (*Client)CancelTemplateVersionDryRunadded inv0.6.1

func (c *Client) CancelTemplateVersionDryRun(ctxcontext.Context, version, jobuuid.UUID)error

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

func (*Client)CancelWorkspaceBuild

func (c *Client) CancelWorkspaceBuild(ctxcontext.Context, iduuid.UUID)error

CancelWorkspaceBuild marks a workspace build job as canceled.

func (*Client)ConvertLoginTypeadded inv0.25.0

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

func (*Client)CreateAPIKey

func (c *Client) CreateAPIKey(ctxcontext.Context, userstring) (GenerateAPIKeyResponse,error)

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

func (*Client)CreateFirstUser

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)CreateGroupadded inv0.9.9

func (c *Client) CreateGroup(ctxcontext.Context, orgIDuuid.UUID, reqCreateGroupRequest) (Group,error)

func (*Client)CreateOrganization

func (c *Client) CreateOrganization(ctxcontext.Context, reqCreateOrganizationRequest) (Organization,error)

CreateOrganization creates an organization and adds the provided user as an admin.

func (*Client)CreateTemplateadded inv0.4.0

func (c *Client) CreateTemplate(ctxcontext.Context, organizationIDuuid.UUID, requestCreateTemplateRequest) (Template,error)

CreateTemplate creates a new template inside an organization.

func (*Client)CreateTemplateVersionadded inv0.4.0

func (c *Client) CreateTemplateVersion(ctxcontext.Context, organizationIDuuid.UUID, reqCreateTemplateVersionRequest) (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)CreateTemplateVersionDryRunadded inv0.6.1

func (c *Client) CreateTemplateVersionDryRun(ctxcontext.Context, versionuuid.UUID, reqCreateTemplateVersionDryRunRequest) (ProvisionerJob,error)

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

func (*Client)CreateTestAuditLogadded inv0.8.14

func (c *Client) CreateTestAuditLog(ctxcontext.Context, reqCreateTestAuditLogRequest)error

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

func (*Client)CreateTokenadded inv0.9.7

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

func (*Client)CreateUser

func (c *Client) CreateUser(ctxcontext.Context, reqCreateUserRequest) (User,error)

CreateUser creates a new user.

func (*Client)CreateWorkspace

func (c *Client) CreateWorkspace(ctxcontext.Context, organizationIDuuid.UUID, userstring, requestCreateWorkspaceRequest) (Workspace,error)

CreateWorkspace creates a new workspace for the template specified.

func (*Client)CreateWorkspaceBuild

func (c *Client) CreateWorkspaceBuild(ctxcontext.Context, workspaceuuid.UUID, requestCreateWorkspaceBuildRequest) (WorkspaceBuild,error)

CreateWorkspaceBuild queues a new build to occur for a workspace.

func (*Client)CreateWorkspaceProxyadded inv0.22.0

func (*Client)DeleteAPIKeyadded inv0.9.7

func (c *Client) DeleteAPIKey(ctxcontext.Context, userIDstring, idstring)error

DeleteAPIKey deletes API key by id.

func (*Client)DeleteGroupadded inv0.9.9

func (c *Client) DeleteGroup(ctxcontext.Context, groupuuid.UUID)error

func (*Client)DeleteLicenseadded inv0.8.7

func (c *Client) DeleteLicense(ctxcontext.Context, idint32)error

func (*Client)DeleteTemplateadded inv0.4.0

func (c *Client) DeleteTemplate(ctxcontext.Context, templateuuid.UUID)error

func (*Client)DeleteUseradded inv0.8.15

func (c *Client) DeleteUser(ctxcontext.Context, iduuid.UUID)error

DeleteUser deletes a user.

func (*Client)DeleteWorkspaceProxyByIDadded inv0.23.0

func (c *Client) DeleteWorkspaceProxyByID(ctxcontext.Context, iduuid.UUID)error

func (*Client)DeleteWorkspaceProxyByNameadded inv0.23.0

func (c *Client) DeleteWorkspaceProxyByName(ctxcontext.Context, namestring)error

func (*Client)DeletedWorkspaceadded inv0.6.0

func (c *Client) DeletedWorkspace(ctxcontext.Context, iduuid.UUID) (Workspace,error)

DeletedWorkspace returns a single workspace that was deleted.

func (*Client)DeploymentConfigadded inv0.11.0

func (c *Client) DeploymentConfig(ctxcontext.Context) (*DeploymentConfig,error)

DeploymentConfig returns the deployment config for the coder server.

func (*Client)DeploymentDAUsadded inv0.15.3

func (c *Client) DeploymentDAUs(ctxcontext.Context, tzOffsetint) (*DAUsResponse,error)

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

func (*Client)DeploymentDAUsLocalTZadded inv0.24.0

func (c *Client) DeploymentDAUsLocalTZ(ctxcontext.Context) (*DAUsResponse,error)

func (*Client)DeploymentStatsadded inv0.19.0

func (c *Client) DeploymentStats(ctxcontext.Context) (DeploymentStats,error)

func (*Client)DialWorkspaceAgent

func (c *Client) DialWorkspaceAgent(ctxcontext.Context, agentIDuuid.UUID, options *DialWorkspaceAgentOptions) (agentConn *WorkspaceAgentConn, errerror)

func (*Client)Download

func (c *Client) Download(ctxcontext.Context, iduuid.UUID) ([]byte,string,error)

Download fetches a file by uploaded hash.

func (*Client)Entitlementsadded inv0.8.6

func (c *Client) Entitlements(ctxcontext.Context) (Entitlements,error)

func (*Client)Experimentsadded inv0.15.0

func (c *Client) Experiments(ctxcontext.Context) (Experiments,error)

func (*Client)GetTokenConfigadded inv0.20.0

func (c *Client) GetTokenConfig(ctxcontext.Context, userIDstring) (TokenConfig,error)

GetTokenConfig returns deployment options related to token management

func (*Client)GitAuthByIDadded inv0.25.0

func (c *Client) GitAuthByID(ctxcontext.Context, providerstring) (GitAuth,error)

GitAuthByID returns the git auth for the given provider by ID.

func (*Client)GitAuthDeviceByIDadded inv0.25.0

func (c *Client) GitAuthDeviceByID(ctxcontext.Context, providerstring) (GitAuthDevice,error)

func (*Client)GitAuthDeviceExchangeadded inv0.25.0

func (c *Client) GitAuthDeviceExchange(ctxcontext.Context, providerstring, reqGitAuthDeviceExchange)error

ExchangeGitAuth exchanges a device code for a git auth token.

func (*Client)GitSSHKeyadded inv0.4.0

func (c *Client) GitSSHKey(ctxcontext.Context, userstring) (GitSSHKey,error)

GitSSHKey returns the user's git SSH public key.

func (*Client)Groupadded inv0.9.9

func (c *Client) Group(ctxcontext.Context, groupuuid.UUID) (Group,error)

func (*Client)GroupByOrgAndNameadded inv0.12.0

func (c *Client) GroupByOrgAndName(ctxcontext.Context, orgIDuuid.UUID, namestring) (Group,error)

func (*Client)GroupsByOrganizationadded inv0.9.9

func (c *Client) GroupsByOrganization(ctxcontext.Context, orgIDuuid.UUID) ([]Group,error)

func (*Client)HasFirstUser

func (c *Client) HasFirstUser(ctxcontext.Context) (bool,error)

HasFirstUser returns whether the first user has been created.

func (*Client)Licensesadded inv0.8.7

func (c *Client) Licenses(ctxcontext.Context) ([]License,error)

func (*Client)ListOrganizationRolesadded inv0.5.4

func (c *Client) ListOrganizationRoles(ctxcontext.Context, orguuid.UUID) ([]AssignableRoles,error)

ListOrganizationRoles lists all assignable roles for a given organization.

func (*Client)ListSiteRolesadded inv0.5.4

func (c *Client) ListSiteRoles(ctxcontext.Context) ([]AssignableRoles,error)

ListSiteRoles lists all assignable site wide roles.

func (*Client)LogBodiesadded inv0.12.6

func (c *Client) LogBodies()bool

LogBodies returns whether requests and response bodies are logged.

func (*Client)Loggeradded inv0.12.6

func (c *Client) Logger()slog.Logger

Logger returns the logger for the client.

func (*Client)LoginWithPassword

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

func (c *Client) Logout(ctxcontext.Context)error

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

func (*Client)Organization

func (c *Client) Organization(ctxcontext.Context, iduuid.UUID) (Organization,error)

func (*Client)OrganizationByName

func (c *Client) OrganizationByName(ctxcontext.Context, userstring, namestring) (Organization,error)

func (*Client)OrganizationsByUser

func (c *Client) OrganizationsByUser(ctxcontext.Context, userstring) ([]Organization,error)

OrganizationsByUser returns all organizations the user is a member of.

func (*Client)PatchGroupadded inv0.9.9

func (c *Client) PatchGroup(ctxcontext.Context, groupuuid.UUID, reqPatchGroupRequest) (Group,error)

func (*Client)PatchWorkspaceProxyadded inv0.23.3

func (*Client)PreviousTemplateVersionadded inv0.13.2

func (c *Client) PreviousTemplateVersion(ctxcontext.Context, organizationuuid.UUID, templateName, versionNamestring) (TemplateVersion,error)

func (*Client)ProvisionerDaemonsadded inv0.6.1

func (c *Client) ProvisionerDaemons(ctxcontext.Context) ([]ProvisionerDaemon,error)

ProvisionerDaemonsByOrganization returns provisioner daemons available for an organization.

func (*Client)PutExtendWorkspaceadded inv0.6.1

func (c *Client) PutExtendWorkspace(ctxcontext.Context, iduuid.UUID, reqPutExtendWorkspaceRequest)error

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

func (*Client)RegenerateGitSSHKeyadded inv0.4.0

func (c *Client) RegenerateGitSSHKey(ctxcontext.Context, userstring) (GitSSHKey,error)

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

func (*Client)Regionsadded inv0.23.1

func (c *Client) Regions(ctxcontext.Context) ([]Region,error)

func (*Client)Replicasadded inv0.10.0

func (c *Client) Replicas(ctxcontext.Context) ([]Replica,error)

Replicas fetches the list of replicas.

func (*Client)Requestadded inv0.5.10

func (c *Client) Request(ctxcontext.Context, method, pathstring, body interface{}, opts ...RequestOption) (*http.Response,error)

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

func (*Client)SSHConfigurationadded inv0.20.0

func (c *Client) SSHConfiguration(ctxcontext.Context) (SSHConfigResponse,error)

SSHConfiguration returns information about the SSH configuration for theCoder instance.

func (*Client)ServeProvisionerDaemonadded inv0.12.8

func (c *Client) ServeProvisionerDaemon(ctxcontext.Context, organizationuuid.UUID, provisioners []ProvisionerType, tags map[string]string) (proto.DRPCProvisionerDaemonClient,error)

ListenProvisionerDaemon returns the gRPC service for a provisioner daemonimplementation. The context is during dial, not during the lifetime of theclient. Client should be closed after use.

func (*Client)SessionToken

func (c *Client) SessionToken()string

SessionToken returns the currently set token for the client.

func (*Client)SetLogBodiesadded inv0.26.0

func (c *Client) SetLogBodies(logBodiesbool)

SetLogBodies sets whether to log request and response bodies.

func (*Client)SetLoggeradded inv0.26.0

func (c *Client) SetLogger(loggerslog.Logger)

SetLogger sets the logger for the client.

func (*Client)SetSessionTokenadded inv0.12.6

func (c *Client) SetSessionToken(tokenstring)

SetSessionToken returns the currently set token for the client.

func (*Client)Templateadded inv0.4.0

func (c *Client) Template(ctxcontext.Context, templateuuid.UUID) (Template,error)

Template returns a single template.

func (*Client)TemplateACLadded inv0.9.9

func (c *Client) TemplateACL(ctxcontext.Context, templateIDuuid.UUID) (TemplateACL,error)

func (*Client)TemplateByNameadded inv0.4.0

func (c *Client) TemplateByName(ctxcontext.Context, organizationIDuuid.UUID, namestring) (Template,error)

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

func (*Client)TemplateDAUsadded inv0.8.12

func (c *Client) TemplateDAUs(ctxcontext.Context, templateIDuuid.UUID, tzOffsetint) (*DAUsResponse,error)

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

func (*Client)TemplateDAUsLocalTZadded inv0.24.0

func (c *Client) TemplateDAUsLocalTZ(ctxcontext.Context, templateIDuuid.UUID) (*DAUsResponse,error)

func (*Client)TemplateExamplesadded inv0.13.2

func (c *Client) TemplateExamples(ctxcontext.Context, organizationIDuuid.UUID) ([]TemplateExample,error)

TemplateExamples lists example templates embedded in coder.

func (*Client)TemplateInsightsadded inv0.27.1

func (*Client)TemplateVersionadded inv0.4.0

func (c *Client) TemplateVersion(ctxcontext.Context, iduuid.UUID) (TemplateVersion,error)

TemplateVersion returns a template version by ID.

func (*Client)TemplateVersionByNameadded inv0.4.0

func (c *Client) TemplateVersionByName(ctxcontext.Context, templateuuid.UUID, namestring) (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)TemplateVersionByOrganizationAndNameadded inv0.12.8

func (c *Client) TemplateVersionByOrganizationAndName(ctxcontext.Context, organizationIDuuid.UUID, templateName, versionNamestring) (TemplateVersion,error)

func (*Client)TemplateVersionDryRunadded inv0.6.1

func (c *Client) TemplateVersionDryRun(ctxcontext.Context, version, jobuuid.UUID) (ProvisionerJob,error)

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

func (*Client)TemplateVersionDryRunLogsAfteradded inv0.6.1

func (c *Client) TemplateVersionDryRunLogsAfter(ctxcontext.Context, version, jobuuid.UUID, afterint64) (<-chanProvisionerJobLog,io.Closer,error)

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

func (*Client)TemplateVersionDryRunResourcesadded inv0.6.1

func (c *Client) TemplateVersionDryRunResources(ctxcontext.Context, version, jobuuid.UUID) ([]WorkspaceResource,error)

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

func (*Client)TemplateVersionGitAuthadded inv0.18.0

func (c *Client) TemplateVersionGitAuth(ctxcontext.Context, versionuuid.UUID) ([]TemplateVersionGitAuth,error)

TemplateVersionGitAuth returns git authentication for the requested template version.

func (*Client)TemplateVersionLogsAfteradded inv0.4.0

func (c *Client) TemplateVersionLogsAfter(ctxcontext.Context, versionuuid.UUID, afterint64) (<-chanProvisionerJobLog,io.Closer,error)

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

func (*Client)TemplateVersionResourcesadded inv0.4.0

func (c *Client) TemplateVersionResources(ctxcontext.Context, versionuuid.UUID) ([]WorkspaceResource,error)

TemplateVersionResources returns resources a template version declares.

func (*Client)TemplateVersionRichParametersadded inv0.15.0

func (c *Client) TemplateVersionRichParameters(ctxcontext.Context, versionuuid.UUID) ([]TemplateVersionParameter,error)

TemplateVersionParameters returns parameters a template version exposes.

func (*Client)TemplateVersionVariablesadded inv0.17.4

func (c *Client) TemplateVersionVariables(ctxcontext.Context, versionuuid.UUID) ([]TemplateVersionVariable,error)

TemplateVersionVariables returns resources a template version variables.

func (*Client)TemplateVersionsByTemplateadded inv0.4.0

func (c *Client) TemplateVersionsByTemplate(ctxcontext.Context, reqTemplateVersionsByTemplateRequest) ([]TemplateVersion,error)

TemplateVersionsByTemplate lists versions associated with a template.

func (*Client)TemplatesByOrganizationadded inv0.4.0

func (c *Client) TemplatesByOrganization(ctxcontext.Context, organizationIDuuid.UUID) ([]Template,error)

TemplatesByOrganization lists all templates inside of an organization.

func (*Client)Tokensadded inv0.16.0

func (c *Client) Tokens(ctxcontext.Context, userIDstring, filterTokensFilter) ([]APIKeyWithOwner,error)

Tokens list machine API keys.

func (*Client)UpdateActiveTemplateVersionadded inv0.4.0

func (c *Client) UpdateActiveTemplateVersion(ctxcontext.Context, templateuuid.UUID, reqUpdateActiveTemplateVersion)error

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

func (*Client)UpdateAppearanceadded inv0.14.0

func (c *Client) UpdateAppearance(ctxcontext.Context, appearanceUpdateAppearanceConfig)error

func (*Client)UpdateCheckadded inv0.13.0

func (c *Client) UpdateCheck(ctxcontext.Context) (UpdateCheckResponse,error)

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

func (*Client)UpdateOrganizationMemberRolesadded inv0.5.2

func (c *Client) UpdateOrganizationMemberRoles(ctxcontext.Context, organizationIDuuid.UUID, userstring, reqUpdateRoles) (OrganizationMember,error)

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

func (*Client)UpdateTemplateACLadded inv0.9.9

func (c *Client) UpdateTemplateACL(ctxcontext.Context, templateIDuuid.UUID, reqUpdateTemplateACL)error

func (*Client)UpdateTemplateMetaadded inv0.6.3

func (c *Client) UpdateTemplateMeta(ctxcontext.Context, templateIDuuid.UUID, reqUpdateTemplateMeta) (Template,error)

func (*Client)UpdateTemplateVersionadded inv0.21.0

func (c *Client) UpdateTemplateVersion(ctxcontext.Context, versionIDuuid.UUID, reqPatchTemplateVersionRequest) (TemplateVersion,error)

func (*Client)UpdateUserPasswordadded inv0.5.5

func (c *Client) UpdateUserPassword(ctxcontext.Context, userstring, reqUpdateUserPasswordRequest)error

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

func (*Client)UpdateUserProfileadded inv0.4.2

func (c *Client) UpdateUserProfile(ctxcontext.Context, userstring, reqUpdateUserProfileRequest) (User,error)

UpdateUserProfile enables callers to update profile information

func (*Client)UpdateUserQuietHoursScheduleadded inv0.26.2

func (c *Client) UpdateUserQuietHoursSchedule(ctxcontext.Context, userIdentstring, reqUpdateUserQuietHoursScheduleRequest) (UserQuietHoursScheduleResponse,error)

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

func (*Client)UpdateUserRolesadded inv0.5.2

func (c *Client) UpdateUserRoles(ctxcontext.Context, userstring, reqUpdateRoles) (User,error)

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

func (*Client)UpdateUserStatusadded inv0.5.8

func (c *Client) UpdateUserStatus(ctxcontext.Context, userstring, statusUserStatus) (User,error)

UpdateUserStatus sets the user status to the given status

func (*Client)UpdateWorkspaceadded inv0.8.7

func (c *Client) UpdateWorkspace(ctxcontext.Context, iduuid.UUID, reqUpdateWorkspaceRequest)error

func (*Client)UpdateWorkspaceAutostartadded inv0.4.1

func (c *Client) UpdateWorkspaceAutostart(ctxcontext.Context, iduuid.UUID, reqUpdateWorkspaceAutostartRequest)error

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

func (*Client)UpdateWorkspaceLockadded inv0.25.0

func (c *Client) UpdateWorkspaceLock(ctxcontext.Context, iduuid.UUID, reqUpdateWorkspaceLock)error

UpdateWorkspaceLock locks or unlocks a workspace.

func (*Client)UpdateWorkspaceTTLadded inv0.6.0

func (c *Client) UpdateWorkspaceTTL(ctxcontext.Context, iduuid.UUID, reqUpdateWorkspaceTTLRequest)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(ctxcontext.Context, contentTypestring, rdio.Reader) (UploadResponse,error)

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

func (*Client)User

func (c *Client) User(ctxcontext.Context, userIdentstring) (User,error)

User returns a user for the ID/username provided.

func (*Client)UserLatencyInsightsadded inv0.27.1

func (*Client)UserQuietHoursScheduleadded inv0.26.2

func (c *Client) UserQuietHoursSchedule(ctxcontext.Context, userIdentstring) (UserQuietHoursScheduleResponse,error)

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

func (*Client)UserRolesadded inv0.16.0

func (c *Client) UserRoles(ctxcontext.Context, userstring) (UserRoles,error)

UserRoles returns all roles the user has

func (*Client)Usersadded inv0.4.4

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)WatchWorkspaceadded inv0.6.0

func (c *Client) WatchWorkspace(ctxcontext.Context, iduuid.UUID) (<-chanWorkspace,error)

func (*Client)WatchWorkspaceAgentMetadataadded inv0.21.3

func (c *Client) WatchWorkspaceAgentMetadata(ctxcontext.Context, iduuid.UUID) (<-chan []WorkspaceAgentMetadata, <-chanerror)

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

func (*Client)Workspace

func (c *Client) Workspace(ctxcontext.Context, iduuid.UUID) (Workspace,error)

Workspace returns a single workspace.

func (*Client)WorkspaceAgentadded inv0.4.1

func (c *Client) WorkspaceAgent(ctxcontext.Context, iduuid.UUID) (WorkspaceAgent,error)

WorkspaceAgent returns an agent by ID.

func (*Client)WorkspaceAgentConnectionInfoadded inv0.25.0

func (c *Client) WorkspaceAgentConnectionInfo(ctxcontext.Context) (*WorkspaceAgentConnectionInfo,error)

func (*Client)WorkspaceAgentListeningPortsadded inv0.9.5

func (c *Client) WorkspaceAgentListeningPorts(ctxcontext.Context, agentIDuuid.UUID) (WorkspaceAgentListeningPortsResponse,error)

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

func (*Client)WorkspaceAgentReconnectingPTYadded inv0.5.2

func (c *Client) WorkspaceAgentReconnectingPTY(ctxcontext.Context, optsWorkspaceAgentReconnectingPTYOpts) (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)WorkspaceAgentStartupLogsAfteradded inv0.21.0

func (c *Client) WorkspaceAgentStartupLogsAfter(ctxcontext.Context, agentIDuuid.UUID, afterint64, followbool) (<-chan []WorkspaceAgentStartupLog,io.Closer,error)

func (*Client)WorkspaceBuild

func (c *Client) WorkspaceBuild(ctxcontext.Context, iduuid.UUID) (WorkspaceBuild,error)

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

func (*Client)WorkspaceBuildByUsernameAndWorkspaceNameAndBuildNumberadded inv0.6.6

func (c *Client) WorkspaceBuildByUsernameAndWorkspaceNameAndBuildNumber(ctxcontext.Context, usernamestring, workspaceNamestring, buildNumberstring) (WorkspaceBuild,error)

func (*Client)WorkspaceBuildLogsAfter

func (c *Client) WorkspaceBuildLogsAfter(ctxcontext.Context, builduuid.UUID, afterint64) (<-chanProvisionerJobLog,io.Closer,error)

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

func (*Client)WorkspaceBuildParametersadded inv0.15.0

func (c *Client) WorkspaceBuildParameters(ctxcontext.Context, builduuid.UUID) ([]WorkspaceBuildParameter,error)

func (*Client)WorkspaceBuildStateadded inv0.5.3

func (c *Client) WorkspaceBuildState(ctxcontext.Context, builduuid.UUID) ([]byte,error)

WorkspaceBuildState returns the provisioner state of the build.

func (*Client)WorkspaceBuilds

func (c *Client) WorkspaceBuilds(ctxcontext.Context, reqWorkspaceBuildsRequest) ([]WorkspaceBuild,error)

func (*Client)WorkspaceByOwnerAndNameadded inv0.5.0

func (c *Client) WorkspaceByOwnerAndName(ctxcontext.Context, ownerstring, namestring, paramsWorkspaceOptions) (Workspace,error)

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

func (*Client)WorkspaceProxiesadded inv0.23.0

func (c *Client) WorkspaceProxies(ctxcontext.Context) (RegionsResponse[WorkspaceProxy],error)

func (*Client)WorkspaceProxyByIDadded inv0.23.3

func (c *Client) WorkspaceProxyByID(ctxcontext.Context, iduuid.UUID) (WorkspaceProxy,error)

func (*Client)WorkspaceProxyByNameadded inv0.23.3

func (c *Client) WorkspaceProxyByName(ctxcontext.Context, namestring) (WorkspaceProxy,error)

func (*Client)WorkspaceQuotaadded inv0.9.2

func (c *Client) WorkspaceQuota(ctxcontext.Context, userIDstring) (WorkspaceQuota,error)

func (*Client)Workspacesadded inv0.6.0

func (c *Client) Workspaces(ctxcontext.Context, filterWorkspaceFilter) (WorkspacesResponse,error)

Workspaces returns all workspaces the authenticated user has access to.

typeConnectionLatencyadded inv0.27.1

type ConnectionLatency struct {P50float64 `json:"p50" example:"31.312"`P95float64 `json:"p95" example:"119.832"`}

ConnectionLatency shows the latency for a connection.

typeConvertLoginRequestadded inv0.25.0

type ConvertLoginRequest struct {// ToType is the login type to convert to.ToTypeLoginType `json:"to_type" validate:"required"`Passwordstring    `json:"password" validate:"required"`}

typeCreateFirstUserRequest

type CreateFirstUserRequest struct {Emailstring `json:"email" validate:"required,email"`Usernamestring `json:"username" validate:"required,username"`Passwordstring `json:"password" validate:"required"`Trialbool   `json:"trial"`}

typeCreateFirstUserResponse

type CreateFirstUserResponse struct {UserIDuuid.UUID `json:"user_id" format:"uuid"`OrganizationIDuuid.UUID `json:"organization_id" format:"uuid"`}

CreateFirstUserResponse contains IDs for newly created user info.

typeCreateGroupRequestadded inv0.9.9

type CreateGroupRequest struct {Namestring `json:"name"`AvatarURLstring `json:"avatar_url"`QuotaAllowanceint    `json:"quota_allowance"`}

typeCreateOrganizationRequest

type CreateOrganizationRequest struct {Namestring `json:"name" validate:"required,username"`}

typeCreateTemplateRequestadded inv0.4.0

type CreateTemplateRequest struct {// Name is the name of the template.Namestring `json:"name" validate:"template_name,required"`// DisplayName is the displayed name of the template.DisplayNamestring `json:"display_name,omitempty" validate:"template_display_name"`// Description is a description of what the template contains. It must be// less than 128 bytes.Descriptionstring `json:"description,omitempty" validate:"lt=128"`// Icon is a relative path or external URL that specifies// an icon to be displayed in the dashboard.Iconstring `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.VersionIDuuid.UUID `json:"template_version_id" validate:"required" format:"uuid"`// DefaultTTLMillis allows optionally specifying the default TTL// for all workspaces created from this template.DefaultTTLMillis *int64 `json:"default_ttl_ms,omitempty"`// TODO(@dean): remove max_ttl once restart_requirement is maturedMaxTTLMillis *int64 `json:"max_ttl_ms,omitempty"`// RestartRequirement allows optionally specifying the restart requirement// for workspaces created from this template. This is an enterprise feature.RestartRequirement *TemplateRestartRequirement `json:"restart_requirement,omitempty"`// Allow users to cancel in-progress workspace jobs.// *bool as the default value is "true".AllowUserCancelWorkspaceJobs *bool `json:"allow_user_cancel_workspace_jobs"`// AllowUserAutostart allows users to set a schedule for autostarting their// workspace. By default this is true. This can only be disabled when using// an enterprise license.AllowUserAutostart *bool `json:"allow_user_autostart"`// AllowUserAutostop allows users to set a custom workspace TTL to use in// place of the template's DefaultTTL field. By default this is true. If// false, the DefaultTTL will always be used. This can only be disabled when// using an enterprise license.AllowUserAutostop *bool `json:"allow_user_autostop"`// FailureTTLMillis allows optionally specifying the max lifetime before Coder// stops all resources for failed workspaces created from this template.FailureTTLMillis *int64 `json:"failure_ttl_ms,omitempty"`// InactivityTTLMillis allows optionally specifying the max lifetime before Coder// locks inactive workspaces created from this template.InactivityTTLMillis *int64 `json:"inactivity_ttl_ms,omitempty"`// LockedTTLMillis allows optionally specifying the max lifetime before Coder// permanently deletes locked workspaces created from this template.LockedTTLMillis *int64 `json:"locked_ttl_ms,omitempty"`// DisableEveryoneGroupAccess allows optionally disabling the default// behavior of granting the 'everyone' group access to use the template.// If this is set to true, the template will not be available to all users,// and must be explicitly granted to users or groups in the permissions settings// of the template.DisableEveryoneGroupAccessbool `json:"disable_everyone_group_access"`}

CreateTemplateRequest provides options when creating a template.

typeCreateTemplateVersionDryRunRequestadded inv0.6.1

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

CreateTemplateVersionDryRunRequest defines the request parameters forCreateTemplateVersionDryRun.

typeCreateTemplateVersionRequestadded inv0.4.0

type CreateTemplateVersionRequest struct {Namestring `json:"name,omitempty" validate:"omitempty,template_version_name"`Messagestring `json:"message,omitempty" validate:"lt=1048577"`// TemplateID optionally associates a version with a template.TemplateIDuuid.UUID                `json:"template_id,omitempty" format:"uuid"`StorageMethodProvisionerStorageMethod `json:"storage_method" validate:"oneof=file,required" enums:"file"`FileIDuuid.UUID                `json:"file_id,omitempty" validate:"required_without=ExampleID" format:"uuid"`ExampleIDstring                   `json:"example_id,omitempty" validate:"required_without=FileID"`ProvisionerProvisionerType          `json:"provisioner" validate:"oneof=terraform echo,required"`ProvisionerTags map[string]string        `json:"tags"`UserVariableValues []VariableValue `json:"user_variable_values,omitempty"`}

CreateTemplateVersionRequest enables callers to create a new Template Version.

typeCreateTestAuditLogRequestadded inv0.9.0

type CreateTestAuditLogRequest struct {ActionAuditAction     `json:"action,omitempty" enums:"create,write,delete,start,stop"`ResourceTypeResourceType    `json:"resource_type,omitempty" enums:"template,template_version,user,workspace,workspace_build,git_ssh_key,auditable_group"`ResourceIDuuid.UUID       `json:"resource_id,omitempty" format:"uuid"`AdditionalFieldsjson.RawMessage `json:"additional_fields,omitempty"`Timetime.Time       `json:"time,omitempty" format:"date-time"`BuildReasonBuildReason     `json:"build_reason,omitempty" enums:"autostart,autostop,initiator"`}

typeCreateTokenRequestadded inv0.10.0

type CreateTokenRequest struct {Lifetimetime.Duration `json:"lifetime"`ScopeAPIKeyScope   `json:"scope" enums:"all,application_connect"`TokenNamestring        `json:"token_name"`}

typeCreateUserRequest

type CreateUserRequest struct {Emailstring `json:"email" validate:"required,email" format:"email"`Usernamestring `json:"username" validate:"required,username"`Passwordstring `json:"password" validate:"required_if=DisableLogin false"`// DisableLogin sets the user's login type to 'none'. This prevents the user// from being able to use a password or any other authentication method to login.DisableLoginbool      `json:"disable_login"`OrganizationIDuuid.UUID `json:"organization_id" validate:"" format:"uuid"`}

typeCreateWorkspaceBuildRequest

type CreateWorkspaceBuildRequest struct {TemplateVersionIDuuid.UUID           `json:"template_version_id,omitempty" format:"uuid"`TransitionWorkspaceTransition `json:"transition" validate:"oneof=create start stop delete,required"`DryRunbool                `json:"dry_run,omitempty"`ProvisionerState  []byte              `json:"state,omitempty"`// Orphan may be set for the Destroy transition.Orphanbool `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.RichParameterValues []WorkspaceBuildParameter `json:"rich_parameter_values,omitempty"`// Log level changes the default logging verbosity of a provider ("info" if empty).LogLevelProvisionerLogLevel `json:"log_level,omitempty" validate:"omitempty,oneof=debug"`}

CreateWorkspaceBuildRequest provides options to update the latest workspace build.

typeCreateWorkspaceProxyRequestadded inv0.22.0

type CreateWorkspaceProxyRequest struct {Namestring `json:"name" validate:"required"`DisplayNamestring `json:"display_name"`Iconstring `json:"icon"`}

typeCreateWorkspaceRequest

type CreateWorkspaceRequest struct {TemplateIDuuid.UUID `json:"template_id" validate:"required" format:"uuid"`Namestring    `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.RichParameterValues []WorkspaceBuildParameter `json:"rich_parameter_values,omitempty"`}

CreateWorkspaceRequest provides options for creating a new workspace.

typeDAUEntryadded inv0.8.12

type DAUEntry struct {Datetime.Time `json:"date" format:"date-time"`Amountint       `json:"amount"`}

typeDAURequestadded inv0.24.0

type DAURequest struct {TZHourOffsetint}

typeDAUsResponseadded inv0.24.0

type DAUsResponse struct {Entries      []DAUEntry `json:"entries"`TZHourOffsetint        `json:"tz_hour_offset"`}

typeDERPadded inv0.11.0

type DERP struct {ServerDERPServerConfig `json:"server" typescript:",notnull"`ConfigDERPConfig       `json:"config" typescript:",notnull"`}

typeDERPConfigadded inv0.11.0

type DERPConfig struct {BlockDirectclibase.Bool   `json:"block_direct" typescript:",notnull"`URLclibase.String `json:"url" typescript:",notnull"`Pathclibase.String `json:"path" typescript:",notnull"`}

typeDERPRegionadded inv0.8.11

type DERPRegion struct {Preferredbool    `json:"preferred"`LatencyMillisecondsfloat64 `json:"latency_ms"`}

typeDERPServerConfigadded inv0.11.0

type DERPServerConfig struct {Enableclibase.Bool        `json:"enable" typescript:",notnull"`RegionIDclibase.Int64       `json:"region_id" typescript:",notnull"`RegionCodeclibase.String      `json:"region_code" typescript:",notnull"`RegionNameclibase.String      `json:"region_name" typescript:",notnull"`STUNAddressesclibase.StringArray `json:"stun_addresses" typescript:",notnull"`RelayURLclibase.URL         `json:"relay_url" typescript:",notnull"`}

typeDangerousConfigadded inv0.15.0

type DangerousConfig struct {AllowPathAppSharingclibase.Bool `json:"allow_path_app_sharing" typescript:",notnull"`AllowPathAppSiteOwnerAccessclibase.Bool `json:"allow_path_app_site_owner_access" typescript:",notnull"`AllowAllCorsclibase.Bool `json:"allow_all_cors" typescript:",notnull"`}

typeDeploymentConfigadded inv0.11.0

type DeploymentConfig struct {Values  *DeploymentValues `json:"config,omitempty"`Optionsclibase.OptionSet `json:"options,omitempty"`}

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

@typescript-ignore DeploymentConfigapitypings doesn't know how to generate the OptionSet... yet.

typeDeploymentStatsadded inv0.19.0

type DeploymentStats struct {// AggregatedFrom is the time in which stats are aggregated from.// This might be back in time a specific duration or interval.AggregatedFromtime.Time `json:"aggregated_from" format:"date-time"`// CollectedAt is the time in which stats are collected at.CollectedAttime.Time `json:"collected_at" format:"date-time"`// NextUpdateAt is the time when the next batch of stats will// be updated.NextUpdateAttime.Time `json:"next_update_at" format:"date-time"`WorkspacesWorkspaceDeploymentStats    `json:"workspaces"`SessionCountSessionCountDeploymentStats `json:"session_count"`}

typeDeploymentValuesadded inv0.19.0

type DeploymentValues struct {Verboseclibase.Bool `json:"verbose,omitempty"`AccessURLclibase.URL  `json:"access_url,omitempty"`WildcardAccessURLclibase.URL  `json:"wildcard_access_url,omitempty"`DocsURLclibase.URL  `json:"docs_url,omitempty"`RedirectToAccessURLclibase.Bool `json:"redirect_to_access_url,omitempty"`// HTTPAddress is a string because it may be set to zero to disable.HTTPAddressclibase.String                  `json:"http_address,omitempty" typescript:",notnull"`AutobuildPollIntervalclibase.Duration                `json:"autobuild_poll_interval,omitempty"`JobHangDetectorIntervalclibase.Duration                `json:"job_hang_detector_interval,omitempty"`DERPDERP                            `json:"derp,omitempty" typescript:",notnull"`PrometheusPrometheusConfig                `json:"prometheus,omitempty" typescript:",notnull"`PprofPprofConfig                     `json:"pprof,omitempty" typescript:",notnull"`ProxyTrustedHeadersclibase.StringArray             `json:"proxy_trusted_headers,omitempty" typescript:",notnull"`ProxyTrustedOriginsclibase.StringArray             `json:"proxy_trusted_origins,omitempty" typescript:",notnull"`CacheDirclibase.String                  `json:"cache_directory,omitempty" typescript:",notnull"`InMemoryDatabaseclibase.Bool                    `json:"in_memory_database,omitempty" typescript:",notnull"`PostgresURLclibase.String                  `json:"pg_connection_url,omitempty" typescript:",notnull"`OAuth2OAuth2Config                    `json:"oauth2,omitempty" typescript:",notnull"`OIDCOIDCConfig                      `json:"oidc,omitempty" typescript:",notnull"`TelemetryTelemetryConfig                 `json:"telemetry,omitempty" typescript:",notnull"`TLSTLSConfig                       `json:"tls,omitempty" typescript:",notnull"`TraceTraceConfig                     `json:"trace,omitempty" typescript:",notnull"`SecureAuthCookieclibase.Bool                    `json:"secure_auth_cookie,omitempty" typescript:",notnull"`StrictTransportSecurityclibase.Int64                   `json:"strict_transport_security,omitempty" typescript:",notnull"`StrictTransportSecurityOptionsclibase.StringArray             `json:"strict_transport_security_options,omitempty" typescript:",notnull"`SSHKeygenAlgorithmclibase.String                  `json:"ssh_keygen_algorithm,omitempty" typescript:",notnull"`MetricsCacheRefreshIntervalclibase.Duration                `json:"metrics_cache_refresh_interval,omitempty" typescript:",notnull"`AgentStatRefreshIntervalclibase.Duration                `json:"agent_stat_refresh_interval,omitempty" typescript:",notnull"`AgentFallbackTroubleshootingURLclibase.URL                     `json:"agent_fallback_troubleshooting_url,omitempty" typescript:",notnull"`BrowserOnlyclibase.Bool                    `json:"browser_only,omitempty" typescript:",notnull"`SCIMAPIKeyclibase.String                  `json:"scim_api_key,omitempty" typescript:",notnull"`ProvisionerProvisionerConfig               `json:"provisioner,omitempty" typescript:",notnull"`RateLimitRateLimitConfig                 `json:"rate_limit,omitempty" typescript:",notnull"`Experimentsclibase.StringArray             `json:"experiments,omitempty" typescript:",notnull"`UpdateCheckclibase.Bool                    `json:"update_check,omitempty" typescript:",notnull"`MaxTokenLifetimeclibase.Duration                `json:"max_token_lifetime,omitempty" typescript:",notnull"`SwaggerSwaggerConfig                   `json:"swagger,omitempty" typescript:",notnull"`LoggingLoggingConfig                   `json:"logging,omitempty" typescript:",notnull"`DangerousDangerousConfig                 `json:"dangerous,omitempty" typescript:",notnull"`DisablePathAppsclibase.Bool                    `json:"disable_path_apps,omitempty" typescript:",notnull"`SessionDurationclibase.Duration                `json:"max_session_expiry,omitempty" typescript:",notnull"`DisableSessionExpiryRefreshclibase.Bool                    `json:"disable_session_expiry_refresh,omitempty" typescript:",notnull"`DisablePasswordAuthclibase.Bool                    `json:"disable_password_auth,omitempty" typescript:",notnull"`SupportSupportConfig                   `json:"support,omitempty" typescript:",notnull"`GitAuthProvidersclibase.Struct[[]GitAuthConfig] `json:"git_auth,omitempty" typescript:",notnull"`SSHConfigSSHConfig                       `json:"config_ssh,omitempty" typescript:",notnull"`WgtunnelHostclibase.String                  `json:"wgtunnel_host,omitempty" typescript:",notnull"`DisableOwnerWorkspaceExecclibase.Bool                    `json:"disable_owner_workspace_exec,omitempty" typescript:",notnull"`ProxyHealthStatusIntervalclibase.Duration                `json:"proxy_health_status_interval,omitempty" typescript:",notnull"`EnableTerraformDebugModeclibase.Bool                    `json:"enable_terraform_debug_mode,omitempty" typescript:",notnull"`UserQuietHoursScheduleUserQuietHoursScheduleConfig    `json:"user_quiet_hours_schedule,omitempty" typescript:",notnull"`Configclibase.YAMLConfigPath `json:"config,omitempty" typescript:",notnull"`WriteConfigclibase.Bool           `json:"write_config,omitempty" typescript:",notnull"`// DEPRECATED: Use HTTPAddress or TLS.Address instead.Addressclibase.HostPort `json:"address,omitempty" typescript:",notnull"`}

DeploymentValues is the central configuration values the coder server.

func (*DeploymentValues)Optionsadded inv0.19.0

func (*DeploymentValues)WithoutSecretsadded inv0.19.0

func (c *DeploymentValues) WithoutSecrets() (*DeploymentValues,error)

WithoutSecrets returns a copy of the config without secret values.

typeDialWorkspaceAgentOptionsadded inv0.10.0

type DialWorkspaceAgentOptions struct {Loggerslog.Logger// BlockEndpoints forced a direct connection through DERP. The Client may// have DisableDirect set which will override this value.BlockEndpointsbool}

@typescript-ignore DialWorkspaceAgentOptions

typeEntitlementadded inv0.8.6

type Entitlementstring

Entitlement represents whether a feature is licensed.

const (EntitlementEntitledEntitlement = "entitled"EntitlementGracePeriodEntitlement = "grace_period"EntitlementNotEntitledEntitlement = "not_entitled")

typeEntitlementsadded inv0.8.6

type Entitlements struct {Features         map[FeatureName]Feature `json:"features"`Warnings         []string                `json:"warnings"`Errors           []string                `json:"errors"`HasLicensebool                    `json:"has_license"`Trialbool                    `json:"trial"`RequireTelemetrybool                    `json:"require_telemetry"`}

typeError

type Error struct {ResponseHelperstring// contains filtered or unexported fields}

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

funcAsErroradded inv0.9.9

func AsError(errerror) (*Error,bool)

func (*Error)Error

func (e *Error) Error()string

func (*Error)Friendlyadded inv0.8.0

func (e *Error) Friendly()string

func (*Error)StatusCode

func (e *Error) StatusCode()int

typeExperimentadded inv0.15.0

type Experimentstring
const (// ExperimentMoons enabled the workspace proxy endpoints and CRUD. This// feature is not yet complete in functionality.ExperimentMoonsExperiment = "moons"//https://github.com/coder/coder/milestone/19ExperimentWorkspaceActionsExperiment = "workspace_actions"// ExperimentTailnetHACoordinator downgrades to the haCoordinator instead// of PGCoord.  Should only be used if we see issues in prod with PGCoord// which is now the default.ExperimentTailnetHACoordinatorExperiment = "tailnet_ha_coordinator"// ExperimentConvertToOIDC enables users to convert from password to// oidc.ExperimentConvertToOIDCExperiment = "convert-to-oidc"// ExperimentSingleTailnet replaces workspace connections inside coderd to// all use a single tailnet, instead of the previous behavior of creating a// single tailnet for each agent.// WARNING: This cannot be enabled when using HA.ExperimentSingleTailnetExperiment = "single_tailnet"// ExperimentTemplateRestartRequirement allows template admins to have more// control over when workspaces created on a template are required to// restart, and allows users to ensure these restarts never happen during// their business hours.//// Enables:// - User quiet hours schedule settings// - Template restart requirement settings// - Changes the max_deadline algorithm to use restart requirement and user//   quiet hours instead of max_ttl.ExperimentTemplateRestartRequirementExperiment = "template_restart_requirement")

typeExperimentsadded inv0.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 tobe backwards compatible. They may be removed or renamed at any time.

func (Experiments)Enabledadded inv0.15.0

func (eExperiments) Enabled(exExperiment)bool

typeFeatureadded inv0.8.6

type Feature struct {EntitlementEntitlement `json:"entitlement"`Enabledbool        `json:"enabled"`Limit       *int64      `json:"limit,omitempty"`Actual      *int64      `json:"actual,omitempty"`}

typeFeatureNameadded inv0.15.0

type FeatureNamestring

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

const (FeatureUserLimitFeatureName = "user_limit"FeatureAuditLogFeatureName = "audit_log"FeatureBrowserOnlyFeatureName = "browser_only"FeatureSCIMFeatureName = "scim"FeatureTemplateRBACFeatureName = "template_rbac"FeatureHighAvailabilityFeatureName = "high_availability"FeatureMultipleGitAuthFeatureName = "multiple_git_auth"FeatureExternalProvisionerDaemonsFeatureName = "external_provisioner_daemons"FeatureAppearanceFeatureName = "appearance"FeatureAdvancedTemplateSchedulingFeatureName = "advanced_template_scheduling"FeatureTemplateRestartRequirementFeatureName = "template_restart_requirement"FeatureWorkspaceProxyFeatureName = "workspace_proxy")

func (FeatureName)AlwaysEnableadded inv0.15.0

func (nFeatureName) 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)Humanizeadded inv0.15.0

func (nFeatureName) Humanize()string

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

typeGenerateAPIKeyResponse

type GenerateAPIKeyResponse struct {Keystring `json:"key"`}

GenerateAPIKeyResponse contains an API key for a user.

typeGetUsersResponseadded inv0.12.8

type GetUsersResponse struct {Users []User `json:"users"`Countint    `json:"count"`}

typeGitAuthadded inv0.25.0

type GitAuth struct {Authenticatedbool   `json:"authenticated"`Devicebool   `json:"device"`Typestring `json:"type"`// User is the user that authenticated with the provider.User *GitAuthUser `json:"user"`// AppInstallable is true if the request for app installs was successful.AppInstallablebool `json:"app_installable"`// AppInstallations are the installations that the user has access to.AppInstallations []GitAuthAppInstallation `json:"installations"`// AppInstallURL is the URL to install the app.AppInstallURLstring `json:"app_install_url"`}

typeGitAuthAppInstallationadded inv0.25.0

type GitAuthAppInstallation struct {IDint         `json:"id"`AccountGitAuthUser `json:"account"`ConfigureURLstring      `json:"configure_url"`}

typeGitAuthConfigadded inv0.11.0

type GitAuthConfig struct {IDstring   `json:"id"`Typestring   `json:"type"`ClientIDstring   `json:"client_id"`ClientSecretstring   `json:"-" yaml:"client_secret"`AuthURLstring   `json:"auth_url"`TokenURLstring   `json:"token_url"`ValidateURLstring   `json:"validate_url"`AppInstallURLstring   `json:"app_install_url"`AppInstallationsURLstring   `json:"app_installations_url"`Regexstring   `json:"regex"`NoRefreshbool     `json:"no_refresh"`Scopes              []string `json:"scopes"`DeviceFlowbool     `json:"device_flow"`DeviceCodeURLstring   `json:"device_code_url"`}

typeGitAuthDeviceadded inv0.25.0

type GitAuthDevice struct {DeviceCodestring `json:"device_code"`UserCodestring `json:"user_code"`VerificationURIstring `json:"verification_uri"`ExpiresInint    `json:"expires_in"`Intervalint    `json:"interval"`}

GitAuthDevice is the response from the device authorization endpoint.See:https://tools.ietf.org/html/rfc8628#section-3.2

typeGitAuthDeviceExchangeadded inv0.25.0

type GitAuthDeviceExchange struct {DeviceCodestring `json:"device_code"`}

typeGitAuthUseradded inv0.25.0

type GitAuthUser struct {Loginstring `json:"login"`AvatarURLstring `json:"avatar_url"`ProfileURLstring `json:"profile_url"`Namestring `json:"name"`}

typeGitProvideradded inv0.11.0

type GitProviderstring

GitProvider is a constant that represents thetype of providers that are supported within Coder.

const (GitProviderAzureDevopsGitProvider = "azure-devops"GitProviderGitHubGitProvider = "github"GitProviderGitLabGitProvider = "gitlab"GitProviderBitBucketGitProvider = "bitbucket")

func (GitProvider)Prettyadded inv0.18.0

func (gGitProvider) Pretty()string

typeGitSSHKeyadded inv0.4.0

type GitSSHKey struct {UserIDuuid.UUID `json:"user_id" format:"uuid"`CreatedAttime.Time `json:"created_at" format:"date-time"`UpdatedAttime.Time `json:"updated_at" format:"date-time"`PublicKeystring    `json:"public_key"`}

typeGroupadded inv0.9.9

type Group struct {IDuuid.UUID `json:"id" format:"uuid"`Namestring    `json:"name"`OrganizationIDuuid.UUID `json:"organization_id" format:"uuid"`Members        []User    `json:"members"`AvatarURLstring    `json:"avatar_url"`QuotaAllowanceint       `json:"quota_allowance"`}

typeHealthcheckadded inv0.9.0

type Healthcheck struct {// URL specifies the endpoint to check for the app health.URLstring `json:"url"`// Interval specifies the seconds between each health check.Intervalint32 `json:"interval"`// Threshold specifies the number of consecutive failed health checks before returning "unhealthy".Thresholdint32 `json:"threshold"`}

typeInsightsReportIntervaladded inv0.27.1

type InsightsReportIntervalstring

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

const (InsightsReportIntervalDayInsightsReportInterval = "day")

InsightsReportInterval enums.

typeIssueReconnectingPTYSignedTokenRequestadded inv0.23.0

type IssueReconnectingPTYSignedTokenRequest struct {// URL is the URL of the reconnecting-pty endpoint you are connecting to.URLstring    `json:"url" validate:"required"`AgentIDuuid.UUID `json:"agentID" format:"uuid" validate:"required"`}

typeIssueReconnectingPTYSignedTokenResponseadded inv0.23.0

type IssueReconnectingPTYSignedTokenResponse struct {SignedTokenstring `json:"signed_token"`}

typeJobErrorCodeadded inv0.19.0

type JobErrorCodestring

JobErrorCode defines the error code returned by job runner.

const (MissingTemplateParameterJobErrorCode = "MISSING_TEMPLATE_PARAMETER"RequiredTemplateVariablesJobErrorCode = "REQUIRED_TEMPLATE_VARIABLES")

typeLicenseadded inv0.8.7

type License struct {IDint32     `json:"id"`UUIDuuid.UUID `json:"uuid" format:"uuid"`UploadedAttime.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" table:"claims"`}

func (*License)AllFeaturesClaimadded inv0.26.1

func (l *License) AllFeaturesClaim()bool

func (*License)ExpiresAtadded inv0.26.1

func (l *License) ExpiresAt() (time.Time,error)

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

func (*License)FeaturesClaimsadded inv0.26.1

func (l *License) FeaturesClaims() (map[FeatureName]int64,error)

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

func (*License)Trialadded inv0.26.1

func (l *License) Trial()bool

typeLinkConfigadded inv0.18.0

type LinkConfig struct {Namestring `json:"name" yaml:"name"`Targetstring `json:"target" yaml:"target"`Iconstring `json:"icon" yaml:"icon"`}

typeLogLeveladded inv0.6.0

type LogLevelstring

typeLogSourceadded inv0.6.0

type LogSourcestring

typeLoggingConfigadded inv0.15.0

type LoggingConfig struct {Humanclibase.String `json:"human" typescript:",notnull"`JSONclibase.String `json:"json" typescript:",notnull"`Stackdriverclibase.String `json:"stackdriver" typescript:",notnull"`}

typeLoginTypeadded inv0.7.6

type LoginTypestring

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

const (LoginTypePasswordLoginType = "password"LoginTypeGithubLoginType = "github"LoginTypeOIDCLoginType = "oidc"LoginTypeTokenLoginType = "token"// LoginTypeNone is used if no login method is available for this user.// If this is set, the user has no method of logging in.// API keys can still be created by an owner and used by the user.// These keys would use the `LoginTypeToken` type.LoginTypeNoneLoginType = "none")

typeLoginWithPasswordRequest

type LoginWithPasswordRequest struct {Emailstring `json:"email" validate:"required,email" format:"email"`Passwordstring `json:"password" validate:"required"`}

LoginWithPasswordRequest enables callers to authenticate with email and password.

typeLoginWithPasswordResponse

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

LoginWithPasswordResponse contains a session token for the newly authenticated user.

typeNullTimeadded inv0.8.7

type NullTime struct {sql.NullTime}

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

funcNewNullTimeadded inv0.8.7

func NewNullTime(ttime.Time, validbool)NullTime

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

func (NullTime)IsZeroadded inv0.8.7

func (tNullTime) IsZero()bool

IsZero return true if the time is null or zero.

func (NullTime)MarshalJSONadded inv0.8.7

func (tNullTime) MarshalJSON() ([]byte,error)

MarshalJSON implements json.Marshaler.

func (*NullTime)UnmarshalJSONadded inv0.8.7

func (t *NullTime) UnmarshalJSON(data []byte)error

UnmarshalJSON implements json.Unmarshaler.

typeOAuth2Configadded inv0.11.0

type OAuth2Config struct {GithubOAuth2GithubConfig `json:"github" typescript:",notnull"`}

typeOAuth2GithubConfigadded inv0.11.0

type OAuth2GithubConfig struct {ClientIDclibase.String      `json:"client_id" typescript:",notnull"`ClientSecretclibase.String      `json:"client_secret" typescript:",notnull"`AllowedOrgsclibase.StringArray `json:"allowed_orgs" typescript:",notnull"`AllowedTeamsclibase.StringArray `json:"allowed_teams" typescript:",notnull"`AllowSignupsclibase.Bool        `json:"allow_signups" typescript:",notnull"`AllowEveryoneclibase.Bool        `json:"allow_everyone" typescript:",notnull"`EnterpriseBaseURLclibase.String      `json:"enterprise_base_url" typescript:",notnull"`}

typeOAuthConversionResponseadded inv0.25.0

type OAuthConversionResponse struct {StateStringstring    `json:"state_string"`ExpiresAttime.Time `json:"expires_at" format:"date-time"`ToTypeLoginType `json:"to_type"`UserIDuuid.UUID `json:"user_id" format:"uuid"`}

typeOIDCAuthMethodadded inv0.16.0

type OIDCAuthMethod struct {AuthMethodSignInTextstring `json:"signInText"`IconURLstring `json:"iconUrl"`}

typeOIDCConfigadded inv0.11.0

type OIDCConfig struct {AllowSignupsclibase.Bool                      `json:"allow_signups" typescript:",notnull"`ClientIDclibase.String                    `json:"client_id" typescript:",notnull"`ClientSecretclibase.String                    `json:"client_secret" typescript:",notnull"`EmailDomainclibase.StringArray               `json:"email_domain" typescript:",notnull"`IssuerURLclibase.String                    `json:"issuer_url" typescript:",notnull"`Scopesclibase.StringArray               `json:"scopes" typescript:",notnull"`IgnoreEmailVerifiedclibase.Bool                      `json:"ignore_email_verified" typescript:",notnull"`UsernameFieldclibase.String                    `json:"username_field" typescript:",notnull"`EmailFieldclibase.String                    `json:"email_field" typescript:",notnull"`AuthURLParamsclibase.Struct[map[string]string] `json:"auth_url_params" typescript:",notnull"`IgnoreUserInfoclibase.Bool                      `json:"ignore_user_info" typescript:",notnull"`GroupFieldclibase.String                    `json:"groups_field" typescript:",notnull"`GroupMappingclibase.Struct[map[string]string] `json:"group_mapping" typescript:",notnull"`SignInTextclibase.String                    `json:"sign_in_text" typescript:",notnull"`IconURLclibase.URL                       `json:"icon_url" typescript:",notnull"`}

typeOrganization

type Organization struct {IDuuid.UUID `json:"id" validate:"required" format:"uuid"`Namestring    `json:"name" validate:"required"`CreatedAttime.Time `json:"created_at" validate:"required" format:"date-time"`UpdatedAttime.Time `json:"updated_at" validate:"required" format:"date-time"`}

Organization is the JSON representation of a Coder organization.

typeOrganizationMemberadded inv0.5.2

type OrganizationMember struct {UserIDuuid.UUID `db:"user_id" json:"user_id" format:"uuid"`OrganizationIDuuid.UUID `db:"organization_id" json:"organization_id" format:"uuid"`CreatedAttime.Time `db:"created_at" json:"created_at" format:"date-time"`UpdatedAttime.Time `db:"updated_at" json:"updated_at" format:"date-time"`Roles          []Role    `db:"roles" json:"roles"`}

typePaginationadded inv0.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.AfterIDuuid.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.Limitint `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.Offsetint `json:"offset,omitempty"`}

Pagination sets pagination options for the endpoints that support it.

typeParameterResolveradded inv0.23.6

type ParameterResolver struct {Rich []WorkspaceBuildParameter}

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

func (*ParameterResolver)ValidateResolveadded inv0.23.6

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

typePatchGroupRequestadded inv0.9.9

type PatchGroupRequest struct {AddUsers       []string `json:"add_users"`RemoveUsers    []string `json:"remove_users"`Namestring   `json:"name"`AvatarURL      *string  `json:"avatar_url"`QuotaAllowance *int     `json:"quota_allowance"`}

typePatchTemplateVersionRequestadded inv0.21.0

type PatchTemplateVersionRequest struct {Namestring  `json:"name" validate:"omitempty,template_version_name"`Message *string `json:"message,omitempty" validate:"omitempty,lt=1048577"`}

typePatchWorkspaceProxyadded inv0.23.3

type PatchWorkspaceProxy struct {IDuuid.UUID `json:"id" format:"uuid" validate:"required"`Namestring    `json:"name" validate:"required"`DisplayNamestring    `json:"display_name" validate:"required"`Iconstring    `json:"icon" validate:"required"`RegenerateTokenbool      `json:"regenerate_token"`}

typePprofConfigadded inv0.11.0

type PprofConfig struct {Enableclibase.Bool     `json:"enable" typescript:",notnull"`Addressclibase.HostPort `json:"address" typescript:",notnull"`}

typePrometheusConfigadded inv0.11.0

type PrometheusConfig struct {Enableclibase.Bool     `json:"enable" typescript:",notnull"`Addressclibase.HostPort `json:"address" typescript:",notnull"`CollectAgentStatsclibase.Bool     `json:"collect_agent_stats" typescript:",notnull"`CollectDBMetricsclibase.Bool     `json:"collect_db_metrics" typescript:",notnull"`}

typeProvisionerConfigadded inv0.12.6

type ProvisionerConfig struct {Daemonsclibase.Int64    `json:"daemons" typescript:",notnull"`DaemonsEchoclibase.Bool     `json:"daemons_echo" typescript:",notnull"`DaemonPollIntervalclibase.Duration `json:"daemon_poll_interval" typescript:",notnull"`DaemonPollJitterclibase.Duration `json:"daemon_poll_jitter" typescript:",notnull"`ForceCancelIntervalclibase.Duration `json:"force_cancel_interval" typescript:",notnull"`}

typeProvisionerDaemon

type ProvisionerDaemon struct {IDuuid.UUID         `json:"id" format:"uuid"`CreatedAttime.Time         `json:"created_at" format:"date-time"`UpdatedAtsql.NullTime      `json:"updated_at" format:"date-time"`Namestring            `json:"name"`Provisioners []ProvisionerType `json:"provisioners"`Tags         map[string]string `json:"tags"`}

typeProvisionerJob

type ProvisionerJob struct {IDuuid.UUID            `json:"id" format:"uuid"`CreatedAttime.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"`Errorstring               `json:"error,omitempty"`ErrorCodeJobErrorCode         `json:"error_code,omitempty" enums:"MISSING_TEMPLATE_PARAMETER,REQUIRED_TEMPLATE_VARIABLES"`StatusProvisionerJobStatus `json:"status" enums:"pending,running,succeeded,canceling,canceled,failed"`WorkerID      *uuid.UUID           `json:"worker_id,omitempty" format:"uuid"`FileIDuuid.UUID            `json:"file_id" format:"uuid"`Tags          map[string]string    `json:"tags"`QueuePositionint                  `json:"queue_position"`QueueSizeint                  `json:"queue_size"`}

ProvisionerJob describes the job executed by the provisioning daemon.

typeProvisionerJobLog

type ProvisionerJobLog struct {IDint64     `json:"id"`CreatedAttime.Time `json:"created_at" format:"date-time"`SourceLogSource `json:"log_source"`LevelLogLevel  `json:"log_level" enums:"trace,debug,info,warn,error"`Stagestring    `json:"stage"`Outputstring    `json:"output"`}

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

typeProvisionerJobStatus

type ProvisionerJobStatusstring

ProvisionerJobStatus represents the at-time state of a job.

const (ProvisionerJobPendingProvisionerJobStatus = "pending"ProvisionerJobRunningProvisionerJobStatus = "running"ProvisionerJobSucceededProvisionerJobStatus = "succeeded"ProvisionerJobCancelingProvisionerJobStatus = "canceling"ProvisionerJobCanceledProvisionerJobStatus = "canceled"ProvisionerJobFailedProvisionerJobStatus = "failed")

func (ProvisionerJobStatus)Activeadded inv0.4.4

func (pProvisionerJobStatus) Active()bool

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

typeProvisionerLogLeveladded inv0.21.3

type ProvisionerLogLevelstring
const (ProvisionerLogLevelDebugProvisionerLogLevel = "debug")

typeProvisionerStorageMethodadded inv0.6.0

type ProvisionerStorageMethodstring
const (ProvisionerStorageMethodFileProvisionerStorageMethod = "file")

typeProvisionerTypeadded inv0.6.0

type ProvisionerTypestring
const (ProvisionerTypeEchoProvisionerType = "echo"ProvisionerTypeTerraformProvisionerType = "terraform")

typeProxyHealthReportadded inv0.23.0

type ProxyHealthReport struct {// Errors are problems that prevent the workspace proxy from being healthyErrors []string `json:"errors"`// Warnings do not prevent the workspace proxy from being healthy, but// should be addressed.Warnings []string `json:"warnings"`}

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

typeProxyHealthStatusadded inv0.23.0

type ProxyHealthStatusstring
const (// ProxyHealthy means the proxy access url is reachable and returns a healthy// status code.ProxyHealthyProxyHealthStatus = "ok"// ProxyUnreachable means the proxy access url is not responding.ProxyUnreachableProxyHealthStatus = "unreachable"// ProxyUnhealthy means the proxy access url is responding, but there is some// problem with the proxy. This problem may or may not be preventing functionality.ProxyUnhealthyProxyHealthStatus = "unhealthy"// ProxyUnregistered means the proxy has not registered a url yet. This means// the proxy was created with the cli, but has not yet been started.ProxyUnregisteredProxyHealthStatus = "unregistered")

typePutExtendWorkspaceRequestadded inv0.6.1

type PutExtendWorkspaceRequest struct {Deadlinetime.Time `json:"deadline" validate:"required" format:"date-time"`}

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

typeRBACResourceadded inv0.22.1

type RBACResourcestring
const (ResourceWorkspaceRBACResource = "workspace"ResourceWorkspaceProxyRBACResource = "workspace_proxy"ResourceWorkspaceExecutionRBACResource = "workspace_execution"ResourceWorkspaceApplicationConnectRBACResource = "application_connect"ResourceAuditLogRBACResource = "audit_log"ResourceTemplateRBACResource = "template"ResourceGroupRBACResource = "group"ResourceFileRBACResource = "file"ResourceProvisionerDaemonRBACResource = "provisioner_daemon"ResourceOrganizationRBACResource = "organization"ResourceRoleAssignmentRBACResource = "assign_role"ResourceOrgRoleAssignmentRBACResource = "assign_org_role"ResourceAPIKeyRBACResource = "api_key"ResourceUserRBACResource = "user"ResourceUserDataRBACResource = "user_data"ResourceOrganizationMemberRBACResource = "organization_member"ResourceLicenseRBACResource = "license"ResourceDeploymentValuesRBACResource = "deployment_config"ResourceDeploymentStatsRBACResource = "deployment_stats"ResourceReplicasRBACResource = "replicas"ResourceDebugInfoRBACResource = "debug_info"ResourceSystemRBACResource = "system")

func (RBACResource)Stringadded inv0.22.1

func (rRBACResource) String()string

typeRateLimitConfigadded inv0.14.0

type RateLimitConfig struct {DisableAllclibase.Bool  `json:"disable_all" typescript:",notnull"`APIclibase.Int64 `json:"api" typescript:",notnull"`}

typeReconnectingPTYRequestadded inv0.9.0

type ReconnectingPTYRequest struct {Datastring `json:"data,omitempty"`Heightuint16 `json:"height,omitempty"`Widthuint16 `json:"width,omitempty"`}

ReconnectingPTYRequest is sent from the client to the serverto pipe data to a PTY.@typescript-ignore ReconnectingPTYRequest

typeRegionadded inv0.23.1

type Region struct {IDuuid.UUID `json:"id" format:"uuid" table:"id"`Namestring    `json:"name" table:"name,default_sort"`DisplayNamestring    `json:"display_name" table:"display_name"`IconURLstring    `json:"icon_url" table:"icon_url"`Healthybool      `json:"healthy" table:"healthy"`// PathAppURL is the URL to the base path for path apps. Optional// unless wildcard_hostname is set.// E.g.https://us.example.comPathAppURLstring `json:"path_app_url" table:"url"`// WildcardHostname is the wildcard hostname for subdomain apps.// E.g. *.us.example.com// E.g. *--suffix.au.example.com// Optional. Does not need to be on the same domain as PathAppURL.WildcardHostnamestring `json:"wildcard_hostname" table:"wildcard_hostname"`}

typeRegionTypesadded inv0.25.0

type RegionTypes interface {Region |WorkspaceProxy}

typeRegionsResponseadded inv0.23.1

type RegionsResponse[RRegionTypes] struct {Regions []R `json:"regions"`}

typeReplicaadded inv0.10.0

type Replica struct {// ID is the unique identifier for the replica.IDuuid.UUID `json:"id" format:"uuid"`// Hostname is the hostname of the replica.Hostnamestring `json:"hostname"`// CreatedAt is the timestamp when the replica was first seen.CreatedAttime.Time `json:"created_at" format:"date-time"`// RelayAddress is the accessible address to relay DERP connections.RelayAddressstring `json:"relay_address"`// RegionID is the region of the replica.RegionIDint32 `json:"region_id"`// Error is the replica error.Errorstring `json:"error"`// DatabaseLatency is the latency in microseconds to the database.DatabaseLatencyint32 `json:"database_latency"`}

typeRequestOptionadded inv0.9.0

type RequestOption func(*http.Request)

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

funcWithQueryParamadded inv0.9.8

func WithQueryParam(key, valuestring)RequestOption

WithQueryParam adds a query parameter to the request.

typeResourceTypeadded inv0.8.11

type ResourceTypestring
const (ResourceTypeTemplateResourceType = "template"ResourceTypeTemplateVersionResourceType = "template_version"ResourceTypeUserResourceType = "user"ResourceTypeWorkspaceResourceType = "workspace"ResourceTypeWorkspaceBuildResourceType = "workspace_build"ResourceTypeGitSSHKeyResourceType = "git_ssh_key"ResourceTypeAPIKeyResourceType = "api_key"ResourceTypeGroupResourceType = "group"ResourceTypeLicenseResourceType = "license"ResourceTypeConvertLoginResourceType = "convert_login")

func (ResourceType)FriendlyStringadded inv0.8.15

func (rResourceType) FriendlyString()string

typeResponseadded inv0.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."Messagestring `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"Detailstring `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.

typeRoleadded inv0.5.5

type Role struct {Namestring `json:"name"`DisplayNamestring `json:"display_name"`}

typeSSHConfigadded inv0.20.0

type SSHConfig struct {// DeploymentName is the config-ssh Hostname prefixDeploymentNameclibase.String// SSHConfigOptions are additional options to add to the ssh config file.// This will override defaults.SSHConfigOptionsclibase.StringArray}

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

func (SSHConfig)ParseOptionsadded inv0.20.0

func (cSSHConfig) ParseOptions() (map[string]string,error)

typeSSHConfigResponseadded inv0.20.0

type SSHConfigResponse struct {HostnamePrefixstring            `json:"hostname_prefix"`SSHConfigOptions map[string]string `json:"ssh_config_options"`}

typeServerSentEventadded inv0.9.0

type ServerSentEvent struct {TypeServerSentEventType `json:"type"`Data interface{}         `json:"data"`}

typeServerSentEventTypeadded inv0.9.0

type ServerSentEventTypestring
const (ServerSentEventTypePingServerSentEventType = "ping"ServerSentEventTypeDataServerSentEventType = "data"ServerSentEventTypeErrorServerSentEventType = "error")

typeServiceBannerConfigadded inv0.14.0

type ServiceBannerConfig struct {Enabledbool   `json:"enabled"`Messagestring `json:"message,omitempty"`BackgroundColorstring `json:"background_color,omitempty"`}

typeSessionCountDeploymentStatsadded inv0.19.0

type SessionCountDeploymentStats struct {VSCodeint64 `json:"vscode"`SSHint64 `json:"ssh"`JetBrainsint64 `json:"jetbrains"`ReconnectingPTYint64 `json:"reconnecting_pty"`}

typeSupportConfigadded inv0.18.0

type SupportConfig struct {Linksclibase.Struct[[]LinkConfig] `json:"links" typescript:",notnull"`}

typeSwaggerConfigadded inv0.13.5

type SwaggerConfig struct {Enableclibase.Bool `json:"enable" typescript:",notnull"`}

typeTLSConfigadded inv0.11.0

type TLSConfig struct {Enableclibase.Bool        `json:"enable" typescript:",notnull"`Addressclibase.HostPort    `json:"address" typescript:",notnull"`RedirectHTTPclibase.Bool        `json:"redirect_http" typescript:",notnull"`CertFilesclibase.StringArray `json:"cert_file" typescript:",notnull"`ClientAuthclibase.String      `json:"client_auth" typescript:",notnull"`ClientCAFileclibase.String      `json:"client_ca_file" typescript:",notnull"`KeyFilesclibase.StringArray `json:"key_file" typescript:",notnull"`MinVersionclibase.String      `json:"min_version" typescript:",notnull"`ClientCertFileclibase.String      `json:"client_cert_file" typescript:",notnull"`ClientKeyFileclibase.String      `json:"client_key_file" typescript:",notnull"`}

typeTelemetryConfigadded inv0.11.0

type TelemetryConfig struct {Enableclibase.Bool `json:"enable" typescript:",notnull"`Traceclibase.Bool `json:"trace" typescript:",notnull"`URLclibase.URL  `json:"url" typescript:",notnull"`}

typeTemplateadded inv0.4.0

type Template struct {IDuuid.UUID       `json:"id" format:"uuid"`CreatedAttime.Time       `json:"created_at" format:"date-time"`UpdatedAttime.Time       `json:"updated_at" format:"date-time"`OrganizationIDuuid.UUID       `json:"organization_id" format:"uuid"`Namestring          `json:"name"`DisplayNamestring          `json:"display_name"`ProvisionerProvisionerType `json:"provisioner" enums:"terraform"`ActiveVersionIDuuid.UUID       `json:"active_version_id" format:"uuid"`// ActiveUserCount is set to -1 when loading.ActiveUserCountint                    `json:"active_user_count"`BuildTimeStatsTemplateBuildTimeStats `json:"build_time_stats"`Descriptionstring                 `json:"description"`Iconstring                 `json:"icon"`DefaultTTLMillisint64                  `json:"default_ttl_ms"`// TODO(@dean): remove max_ttl once restart_requirement is maturedMaxTTLMillisint64 `json:"max_ttl_ms"`// RestartRequirement is an enterprise feature. Its value is only used if// your license is entitled to use the advanced template scheduling feature.RestartRequirementTemplateRestartRequirement `json:"restart_requirement"`CreatedByIDuuid.UUID                  `json:"created_by_id" format:"uuid"`CreatedByNamestring                     `json:"created_by_name"`// AllowUserAutostart and AllowUserAutostop are enterprise-only. Their// values are only used if your license is entitled to use the advanced// template scheduling feature.AllowUserAutostartbool `json:"allow_user_autostart"`AllowUserAutostopbool `json:"allow_user_autostop"`AllowUserCancelWorkspaceJobsbool `json:"allow_user_cancel_workspace_jobs"`// FailureTTLMillis, InactivityTTLMillis, and LockedTTLMillis are enterprise-only. Their// values are used if your license is entitled to use the advanced// template scheduling feature.FailureTTLMillisint64 `json:"failure_ttl_ms"`InactivityTTLMillisint64 `json:"inactivity_ttl_ms"`LockedTTLMillisint64 `json:"locked_ttl_ms"`}

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

typeTemplateACLadded inv0.9.9

type TemplateACL struct {Users  []TemplateUser  `json:"users"`Groups []TemplateGroup `json:"group"`}

typeTemplateAppUsageadded inv0.27.1

type TemplateAppUsage struct {TemplateIDs []uuid.UUID      `json:"template_ids" format:"uuid"`TypeTemplateAppsType `json:"type" example:"builtin"`DisplayNamestring           `json:"display_name" example:"Visual Studio Code"`Slugstring           `json:"slug" example:"vscode"`Iconstring           `json:"icon"`Secondsint64            `json:"seconds" example:"80500"`}

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

typeTemplateAppsTypeadded inv0.27.1

type TemplateAppsTypestring

TemplateAppsType defines the type of app reported.

const (TemplateAppsTypeBuiltinTemplateAppsType = "builtin")

TemplateAppsType enums.

typeTemplateBuildTimeStatsadded inv0.10.0

type TemplateBuildTimeStats map[WorkspaceTransition]TransitionStats

typeTemplateExampleadded inv0.13.2

type TemplateExample struct {IDstring   `json:"id" format:"uuid"`URLstring   `json:"url"`Namestring   `json:"name"`Descriptionstring   `json:"description"`Iconstring   `json:"icon"`Tags        []string `json:"tags"`Markdownstring   `json:"markdown"`}

typeTemplateGroupadded inv0.9.9

type TemplateGroup struct {GroupRoleTemplateRole `json:"role" enums:"admin,use"`}

typeTemplateInsightsIntervalReportadded inv0.27.1

type TemplateInsightsIntervalReport struct {StartTimetime.Time              `json:"start_time" format:"date-time"`EndTimetime.Time              `json:"end_time" format:"date-time"`TemplateIDs []uuid.UUID            `json:"template_ids" format:"uuid"`IntervalInsightsReportInterval `json:"interval"`ActiveUsersint64                  `json:"active_users" example:"14"`}

TemplateInsightsIntervalReport is the report from the template insightsendpoint for a specific interval.

typeTemplateInsightsReportadded inv0.27.1

type TemplateInsightsReport struct {StartTimetime.Time          `json:"start_time" format:"date-time"`EndTimetime.Time          `json:"end_time" format:"date-time"`TemplateIDs []uuid.UUID        `json:"template_ids" format:"uuid"`ActiveUsersint64              `json:"active_users" example:"22"`AppsUsage   []TemplateAppUsage `json:"apps_usage"`}

TemplateInsightsReport is the report from the template insights endpoint.

typeTemplateInsightsRequestadded inv0.27.1

type TemplateInsightsRequest struct {StartTimetime.Time              `json:"start_time" format:"date-time"`EndTimetime.Time              `json:"end_time" format:"date-time"`TemplateIDs []uuid.UUID            `json:"template_ids" format:"uuid"`IntervalInsightsReportInterval `json:"interval"`}

typeTemplateInsightsResponseadded inv0.27.1

type TemplateInsightsResponse struct {ReportTemplateInsightsReport           `json:"report"`IntervalReports []TemplateInsightsIntervalReport `json:"interval_reports"`}

TemplateInsightsResponse is the response from the template insights endpoint.

typeTemplateRestartRequirementadded inv0.26.2

type TemplateRestartRequirement struct {// DaysOfWeek is a list of days of the week on which restarts are required.// Restarts happen within the user's quiet hours (in their configured// timezone). If no days are specified, restarts are not required. Weekdays// cannot be specified twice.//// Restarts will only happen on weekdays in this list on weeks which line up// with Weeks.DaysOfWeek []string `json:"days_of_week" enums:"monday,tuesday,wednesday,thursday,friday,saturday,sunday"`// Weeks is the number of weeks between required restarts. Weeks are synced// across all workspaces (and Coder deployments) using modulo math on a// hardcoded epoch week of January 2nd, 2023 (the first Monday of 2023).// Values of 0 or 1 indicate weekly restarts. Values of 2 indicate// fortnightly restarts, etc.Weeksint64 `json:"weeks"`}

typeTemplateRoleadded inv0.9.9

type TemplateRolestring
const (TemplateRoleAdminTemplateRole = "admin"TemplateRoleUseTemplateRole = "use"TemplateRoleDeletedTemplateRole = "")

typeTemplateUseradded inv0.9.9

type TemplateUser struct {UserRoleTemplateRole `json:"role" enums:"admin,use"`}

typeTemplateVersionadded inv0.4.0

type TemplateVersion struct {IDuuid.UUID      `json:"id" format:"uuid"`TemplateID     *uuid.UUID     `json:"template_id,omitempty" format:"uuid"`OrganizationIDuuid.UUID      `json:"organization_id,omitempty" format:"uuid"`CreatedAttime.Time      `json:"created_at" format:"date-time"`UpdatedAttime.Time      `json:"updated_at" format:"date-time"`Namestring         `json:"name"`Messagestring         `json:"message"`JobProvisionerJob `json:"job"`Readmestring         `json:"readme"`CreatedByUser           `json:"created_by"`Warnings []TemplateVersionWarning `json:"warnings,omitempty" enums:"DEPRECATED_PARAMETERS"`}

TemplateVersion represents a single version of a template.

typeTemplateVersionGitAuthadded inv0.18.0

type TemplateVersionGitAuth struct {IDstring      `json:"id"`TypeGitProvider `json:"type"`AuthenticateURLstring      `json:"authenticate_url"`Authenticatedbool        `json:"authenticated"`}

typeTemplateVersionParameteradded inv0.4.0

type TemplateVersionParameter struct {Namestring                           `json:"name"`DisplayNamestring                           `json:"display_name,omitempty"`Descriptionstring                           `json:"description"`DescriptionPlaintextstring                           `json:"description_plaintext"`Typestring                           `json:"type" enums:"string,number,bool,list(string)"`Mutablebool                             `json:"mutable"`DefaultValuestring                           `json:"default_value"`Iconstring                           `json:"icon"`Options              []TemplateVersionParameterOption `json:"options"`ValidationErrorstring                           `json:"validation_error,omitempty"`ValidationRegexstring                           `json:"validation_regex,omitempty"`ValidationMin        *int32                           `json:"validation_min,omitempty"`ValidationMax        *int32                           `json:"validation_max,omitempty"`ValidationMonotonicValidationMonotonicOrder         `json:"validation_monotonic,omitempty" enums:"increasing,decreasing"`Requiredbool                             `json:"required"`Ephemeralbool                             `json:"ephemeral"`}

TemplateVersionParameter represents a parameter for a template version.

typeTemplateVersionParameterOptionadded inv0.15.0

type TemplateVersionParameterOption struct {Namestring `json:"name"`Descriptionstring `json:"description"`Valuestring `json:"value"`Iconstring `json:"icon"`}

TemplateVersionParameterOption represents a selectable option for a template parameter.

typeTemplateVersionVariableadded inv0.17.4

type TemplateVersionVariable struct {Namestring `json:"name"`Descriptionstring `json:"description"`Typestring `json:"type" enums:"string,number,bool"`Valuestring `json:"value"`DefaultValuestring `json:"default_value"`Requiredbool   `json:"required"`Sensitivebool   `json:"sensitive"`}

TemplateVersionVariable represents a managed template variable.

typeTemplateVersionWarningadded inv0.23.3

type TemplateVersionWarningstring
const (TemplateVersionWarningUnsupportedWorkspacesTemplateVersionWarning = "UNSUPPORTED_WORKSPACES")

typeTemplateVersionsByTemplateRequestadded inv0.5.6

type TemplateVersionsByTemplateRequest struct {TemplateIDuuid.UUID `json:"template_id" validate:"required" format:"uuid"`Pagination}

TemplateVersionsByTemplateRequest defines the request parameters forTemplateVersionsByTemplate.

typeTokenConfigadded inv0.20.0

type TokenConfig struct {MaxTokenLifetimetime.Duration `json:"max_token_lifetime"`}

typeTokensFilteradded inv0.18.0

type TokensFilter struct {IncludeAllbool `json:"include_all"`}

typeTraceConfigadded inv0.12.0

type TraceConfig struct {Enableclibase.Bool   `json:"enable" typescript:",notnull"`HoneycombAPIKeyclibase.String `json:"honeycomb_api_key" typescript:",notnull"`CaptureLogsclibase.Bool   `json:"capture_logs" typescript:",notnull"`}

typeTransitionStatsadded inv0.12.9

type TransitionStats struct {P50 *int64 `example:"123"`P95 *int64 `example:"146"`}

typeUpdateActiveTemplateVersionadded inv0.4.0

type UpdateActiveTemplateVersion struct {IDuuid.UUID `json:"id" validate:"required" format:"uuid"`}

typeUpdateAppearanceConfigadded inv0.18.0

type UpdateAppearanceConfig struct {LogoURLstring              `json:"logo_url"`ServiceBannerServiceBannerConfig `json:"service_banner"`}

typeUpdateCheckResponseadded inv0.13.0

type UpdateCheckResponse struct {// Current indicates whether the server version is the same as the latest.Currentbool `json:"current"`// Version is the semantic version for the latest release of Coder.Versionstring `json:"version"`// URL to download the latest release of Coder.URLstring `json:"url"`}

UpdateCheckResponse contains information on the latest release of Coder.

typeUpdateRolesadded inv0.5.2

type UpdateRoles struct {Roles []string `json:"roles" validate:""`}

typeUpdateTemplateACLadded inv0.9.9

type UpdateTemplateACL struct {// UserPerms should be a mapping of user id to role. The user id must be the// uuid of the user, not a username or email address.UserPerms map[string]TemplateRole `json:"user_perms,omitempty" example:"<group_id>:admin,4df59e74-c027-470b-ab4d-cbba8963a5e9:use"`// GroupPerms should be a mapping of group id to role.GroupPerms map[string]TemplateRole `json:"group_perms,omitempty" example:"<user_id>>:admin,8bd26b20-f3e8-48be-a903-46bb920cf671:use"`}

typeUpdateTemplateMetaadded inv0.6.3

type UpdateTemplateMeta struct {Namestring `json:"name,omitempty" validate:"omitempty,template_name"`DisplayNamestring `json:"display_name,omitempty" validate:"omitempty,template_display_name"`Descriptionstring `json:"description,omitempty"`Iconstring `json:"icon,omitempty"`DefaultTTLMillisint64  `json:"default_ttl_ms,omitempty"`// TODO(@dean): remove max_ttl once restart_requirement is maturedMaxTTLMillisint64 `json:"max_ttl_ms,omitempty"`// RestartRequirement can only be set if your license includes the advanced// template scheduling feature. If you attempt to set this value while// unlicensed, it will be ignored.RestartRequirement           *TemplateRestartRequirement `json:"restart_requirement,omitempty"`AllowUserAutostartbool                        `json:"allow_user_autostart,omitempty"`AllowUserAutostopbool                        `json:"allow_user_autostop,omitempty"`AllowUserCancelWorkspaceJobsbool                        `json:"allow_user_cancel_workspace_jobs,omitempty"`FailureTTLMillisint64                       `json:"failure_ttl_ms,omitempty"`InactivityTTLMillisint64                       `json:"inactivity_ttl_ms,omitempty"`LockedTTLMillisint64                       `json:"locked_ttl_ms,omitempty"`}

typeUpdateUserPasswordRequestadded inv0.5.5

type UpdateUserPasswordRequest struct {OldPasswordstring `json:"old_password" validate:""`Passwordstring `json:"password" validate:"required"`}

typeUpdateUserProfileRequestadded inv0.4.2

type UpdateUserProfileRequest struct {Usernamestring `json:"username" validate:"required,username"`}

typeUpdateUserQuietHoursScheduleRequestadded inv0.26.2

type UpdateUserQuietHoursScheduleRequest struct {// Schedule is a cron expression that defines when the user's quiet hours// window is. Schedule must not be empty. For new users, the schedule is set// to 2am in their browser or computer's timezone. The schedule denotes the// beginning of a 4 hour window where the workspace is allowed to// automatically stop or restart due to maintenance or template max TTL.//// The schedule must be daily with a single time, and should have a timezone// specified via a CRON_TZ prefix (otherwise UTC will be used).//// If the schedule is empty, the user will be updated to use the default// schedule.Schedulestring `json:"schedule" validate:"required"`}

typeUpdateWorkspaceAutostartRequestadded inv0.4.1

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

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

typeUpdateWorkspaceLockadded inv0.25.0

type UpdateWorkspaceLock struct {Lockbool `json:"lock"`}

UpdateWorkspaceLock is a request to lock or unlock a workspace.

typeUpdateWorkspaceProxyResponseadded inv0.23.3

type UpdateWorkspaceProxyResponse struct {ProxyWorkspaceProxy `json:"proxy" table:"proxy,recursive"`// The recursive table sort is not working very well.ProxyTokenstring `json:"proxy_token" table:"proxy token,default_sort"`}

typeUpdateWorkspaceRequestadded inv0.8.7

type UpdateWorkspaceRequest struct {Namestring `json:"name,omitempty" validate:"username"`}

typeUpdateWorkspaceTTLRequestadded inv0.6.0

type UpdateWorkspaceTTLRequest struct {TTLMillis *int64 `json:"ttl_ms"`}

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

typeUploadResponse

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

UploadResponse contains the hash to reference the uploaded file.

typeUser

type User struct {IDuuid.UUID `json:"id" validate:"required" table:"id" format:"uuid"`Usernamestring    `json:"username" validate:"required" table:"username,default_sort"`Emailstring    `json:"email" validate:"required" table:"email" format:"email"`CreatedAttime.Time `json:"created_at" validate:"required" table:"created at" format:"date-time"`LastSeenAttime.Time `json:"last_seen_at" format:"date-time"`StatusUserStatus  `json:"status" table:"status" enums:"active,suspended"`OrganizationIDs []uuid.UUID `json:"organization_ids" format:"uuid"`Roles           []Role      `json:"roles"`AvatarURLstring      `json:"avatar_url" format:"uri"`}

User represents a user in Coder.

typeUserLatencyadded inv0.27.1

type UserLatency struct {TemplateIDs []uuid.UUID       `json:"template_ids" format:"uuid"`UserIDuuid.UUID         `json:"user_id" format:"uuid"`Usernamestring            `json:"username"`LatencyMSConnectionLatency `json:"latency_ms"`}

UserLatency shows the connection latency for a user.

typeUserLatencyInsightsReportadded inv0.27.1

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

UserLatencyInsightsReport is the report from the user latency insightsendpoint.

typeUserLatencyInsightsRequestadded inv0.27.1

type UserLatencyInsightsRequest struct {StartTimetime.Time   `json:"start_time" format:"date-time"`EndTimetime.Time   `json:"end_time" format:"date-time"`TemplateIDs []uuid.UUID `json:"template_ids" format:"uuid"`}

typeUserLatencyInsightsResponseadded inv0.27.1

type UserLatencyInsightsResponse struct {ReportUserLatencyInsightsReport `json:"report"`}

UserLatencyInsightsResponse is the response from the user latency insightsendpoint.

typeUserLoginTypeadded inv0.25.0

type UserLoginType struct {LoginTypeLoginType `json:"login_type"`}

typeUserQuietHoursScheduleConfigadded inv0.26.2

type UserQuietHoursScheduleConfig struct {DefaultScheduleclibase.String `json:"default_schedule" typescript:",notnull"`}

typeUserQuietHoursScheduleResponseadded inv0.26.2

type UserQuietHoursScheduleResponse struct {RawSchedulestring `json:"raw_schedule"`// UserSet is true if the user has set their own quiet hours schedule. If// false, the user is using the default schedule.UserSetbool `json:"user_set"`// Time is the time of day that the quiet hours window starts in the given// Timezone each day.Timestring `json:"time"`// HH:mm (24-hour)Timezonestring `json:"timezone"`// raw format from the cron expression, UTC if unspecified// Next is the next time that the quiet hours window will start.Nexttime.Time `json:"next" format:"date-time"`}

typeUserRolesadded inv0.5.2

type UserRoles struct {Roles             []string               `json:"roles"`OrganizationRoles map[uuid.UUID][]string `json:"organization_roles"`}

typeUserStatusadded inv0.5.1

type UserStatusstring
const (UserStatusActiveUserStatus = "active"UserStatusSuspendedUserStatus = "suspended")

typeUsersRequestadded inv0.4.4

type UsersRequest struct {Searchstring `json:"search,omitempty" typescript:"-"`// Filter users by status.StatusUserStatus `json:"status,omitempty" typescript:"-"`// Filter users that have the given role.Rolestring `json:"role,omitempty" typescript:"-"`SearchQuerystring `json:"q,omitempty"`Pagination}

typeValidationErroradded inv0.7.12

type ValidationError struct {Fieldstring `json:"field" validate:"required"`Detailstring `json:"detail" validate:"required"`}

ValidationError represents a scoped error to a user input.

func (ValidationError)Erroradded inv0.8.2

func (eValidationError) Error()string

typeValidationMonotonicOrderadded inv0.17.0

type ValidationMonotonicOrderstring
const (MonotonicOrderIncreasingValidationMonotonicOrder = "increasing"MonotonicOrderDecreasingValidationMonotonicOrder = "decreasing")

typeVariableValueadded inv0.17.4

type VariableValue struct {Namestring `json:"name"`Valuestring `json:"value"`}

typeWorkspace

type Workspace struct {IDuuid.UUID      `json:"id" format:"uuid"`CreatedAttime.Time      `json:"created_at" format:"date-time"`UpdatedAttime.Time      `json:"updated_at" format:"date-time"`OwnerIDuuid.UUID      `json:"owner_id" format:"uuid"`OwnerNamestring         `json:"owner_name"`OrganizationIDuuid.UUID      `json:"organization_id" format:"uuid"`TemplateIDuuid.UUID      `json:"template_id" format:"uuid"`TemplateNamestring         `json:"template_name"`TemplateDisplayNamestring         `json:"template_display_name"`TemplateIconstring         `json:"template_icon"`TemplateAllowUserCancelWorkspaceJobsbool           `json:"template_allow_user_cancel_workspace_jobs"`LatestBuildWorkspaceBuild `json:"latest_build"`Outdatedbool           `json:"outdated"`Namestring         `json:"name"`AutostartSchedule                    *string        `json:"autostart_schedule,omitempty"`TTLMillis                            *int64         `json:"ttl_ms,omitempty"`LastUsedAttime.Time      `json:"last_used_at" format:"date-time"`// DeletingAt indicates the time of the upcoming workspace deletion, if applicable; otherwise it is nil.// Workspaces may have impending deletions if Template.InactivityTTL feature is turned on and the workspace is inactive.DeletingAt *time.Time `json:"deleting_at" format:"date-time"`// LockedAt being non-nil indicates a workspace that has been locked.// A locked workspace is no longer accessible by a user and must be// unlocked by an admin. It is subject to deletion if it breaches// the duration of the locked_ttl field on its template.LockedAt *time.Time `json:"locked_at" format:"date-time"`// Health shows the health of the workspace and information about// what is causing an unhealthy status.HealthWorkspaceHealth `json:"health"`}

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

typeWorkspaceAgent

type WorkspaceAgent struct {IDuuid.UUID                           `json:"id" format:"uuid"`CreatedAttime.Time                           `json:"created_at" format:"date-time"`UpdatedAttime.Time                           `json:"updated_at" format:"date-time"`FirstConnectedAt            *time.Time                          `json:"first_connected_at,omitempty" format:"date-time"`LastConnectedAt             *time.Time                          `json:"last_connected_at,omitempty" format:"date-time"`DisconnectedAt              *time.Time                          `json:"disconnected_at,omitempty" format:"date-time"`StartedAt                   *time.Time                          `json:"started_at,omitempty" format:"date-time"`ReadyAt                     *time.Time                          `json:"ready_at,omitempty" format:"date-time"`StatusWorkspaceAgentStatus                `json:"status"`LifecycleStateWorkspaceAgentLifecycle             `json:"lifecycle_state"`Namestring                              `json:"name"`ResourceIDuuid.UUID                           `json:"resource_id" format:"uuid"`InstanceIDstring                              `json:"instance_id,omitempty"`Architecturestring                              `json:"architecture"`EnvironmentVariables        map[string]string                   `json:"environment_variables"`OperatingSystemstring                              `json:"operating_system"`StartupScriptstring                              `json:"startup_script,omitempty"`StartupScriptBehaviorWorkspaceAgentStartupScriptBehavior `json:"startup_script_behavior"`StartupScriptTimeoutSecondsint32                               `json:"startup_script_timeout_seconds"`// 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.StartupLogsLengthint32                               `json:"startup_logs_length"`StartupLogsOverflowedbool                                `json:"startup_logs_overflowed"`Directorystring                              `json:"directory,omitempty"`ExpandedDirectorystring                              `json:"expanded_directory,omitempty"`Versionstring                              `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"`ConnectionTimeoutSecondsint32                 `json:"connection_timeout_seconds"`TroubleshootingURLstring                `json:"troubleshooting_url"`// Deprecated: Use StartupScriptBehavior instead.LoginBeforeReadybool                 `json:"login_before_ready"`ShutdownScriptstring               `json:"shutdown_script,omitempty"`ShutdownScriptTimeoutSecondsint32                `json:"shutdown_script_timeout_seconds"`SubsystemAgentSubsystem       `json:"subsystem"`HealthWorkspaceAgentHealth `json:"health"`// Health reports the health of the agent.}

typeWorkspaceAgentConnadded inv0.16.0

type WorkspaceAgentConn struct {*tailnet.Conn// contains filtered or unexported fields}

WorkspaceAgentConn represents a connection to a workspace agent.@typescript-ignore WorkspaceAgentConn

funcNewWorkspaceAgentConnadded inv0.26.2

func NewWorkspaceAgentConn(conn *tailnet.Conn, optsWorkspaceAgentConnOptions) *WorkspaceAgentConn

NewWorkspaceAgentConn creates a new WorkspaceAgentConn. `conn` may be uniqueto the WorkspaceAgentConn, or it may be shared in the case of coderd. If theconn is shared and closing it is undesirable, you may return ErrNoClose fromopts.CloseFunc. This will ensure the underlying conn is not closed.

func (*WorkspaceAgentConn)AwaitReachableadded inv0.16.0

func (c *WorkspaceAgentConn) AwaitReachable(ctxcontext.Context)bool

AwaitReachable waits for the agent to be reachable.

func (*WorkspaceAgentConn)Closeadded inv0.16.0

func (c *WorkspaceAgentConn) Close()error

Close ends the connection to the workspace agent.

func (*WorkspaceAgentConn)DialContextadded inv0.16.0

func (c *WorkspaceAgentConn) DialContext(ctxcontext.Context, networkstring, addrstring) (net.Conn,error)

DialContext dials the address provided in the workspace agent.The network must be "tcp" or "udp".

func (*WorkspaceAgentConn)ListeningPortsadded inv0.16.0

ListeningPorts lists the ports that are currently in use by the workspace.

func (*WorkspaceAgentConn)Pingadded inv0.16.0

Ping pings the agent and returns the round-trip time.The bool returns true if the ping was made P2P.

func (*WorkspaceAgentConn)ReconnectingPTYadded inv0.16.0

func (c *WorkspaceAgentConn) ReconnectingPTY(ctxcontext.Context, iduuid.UUID, height, widthuint16, commandstring) (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)SSHadded inv0.16.0

SSH pipes the SSH protocol over the returned net.Conn.This connects to the built-in SSH server in the workspace agent.

func (*WorkspaceAgentConn)SSHClientadded inv0.16.0

func (c *WorkspaceAgentConn) SSHClient(ctxcontext.Context) (*ssh.Client,error)

SSHClient calls SSH to create a client that uses a weak cipherto improve throughput.

func (*WorkspaceAgentConn)Speedtestadded inv0.16.0

func (c *WorkspaceAgentConn) Speedtest(ctxcontext.Context, directionspeedtest.Direction, durationtime.Duration) ([]speedtest.Result,error)

Speedtest runs a speedtest against the workspace agent.

typeWorkspaceAgentConnOptionsadded inv0.26.2

type WorkspaceAgentConnOptions struct {AgentIDuuid.UUIDAgentIPnetip.AddrCloseFunc func()error}

@typescript-ignore WorkspaceAgentConnOptions

typeWorkspaceAgentConnectionInfoadded inv0.8.11

type WorkspaceAgentConnectionInfo struct {DERPMap                  *tailcfg.DERPMap `json:"derp_map"`DisableDirectConnectionsbool             `json:"disable_direct_connections"`}

WorkspaceAgentConnectionInfo returns required information for establishinga connection with a workspace.@typescript-ignore WorkspaceAgentConnectionInfo

typeWorkspaceAgentHealthadded inv0.26.0

type WorkspaceAgentHealth struct {Healthybool   `json:"healthy" example:"false"`// Healthy is true if the agent is healthy.Reasonstring `json:"reason,omitempty" example:"agent has lost connection"`// Reason is a human-readable explanation of the agent's health. It is empty if Healthy is true.}

typeWorkspaceAgentLifecycleadded inv0.15.3

type WorkspaceAgentLifecyclestring

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. startedexecuting the startup script).

const (WorkspaceAgentLifecycleCreatedWorkspaceAgentLifecycle = "created"WorkspaceAgentLifecycleStartingWorkspaceAgentLifecycle = "starting"WorkspaceAgentLifecycleStartTimeoutWorkspaceAgentLifecycle = "start_timeout"WorkspaceAgentLifecycleStartErrorWorkspaceAgentLifecycle = "start_error"WorkspaceAgentLifecycleReadyWorkspaceAgentLifecycle = "ready"WorkspaceAgentLifecycleShuttingDownWorkspaceAgentLifecycle = "shutting_down"WorkspaceAgentLifecycleShutdownTimeoutWorkspaceAgentLifecycle = "shutdown_timeout"WorkspaceAgentLifecycleShutdownErrorWorkspaceAgentLifecycle = "shutdown_error"WorkspaceAgentLifecycleOffWorkspaceAgentLifecycle = "off")

WorkspaceAgentLifecycle enums.

func (WorkspaceAgentLifecycle)ShuttingDownadded inv0.25.0

func (lWorkspaceAgentLifecycle) ShuttingDown()bool

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

func (WorkspaceAgentLifecycle)Startingadded inv0.25.0

func (lWorkspaceAgentLifecycle) Starting()bool

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

typeWorkspaceAgentListeningPortadded inv0.16.0

type WorkspaceAgentListeningPort struct {ProcessNamestring `json:"process_name"`// may be emptyNetworkstring `json:"network"`// only "tcp" at the momentPortuint16 `json:"port"`}

typeWorkspaceAgentListeningPortsResponseadded inv0.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"`}

typeWorkspaceAgentMetadataadded inv0.9.0

type WorkspaceAgentMetadata struct {ResultWorkspaceAgentMetadataResult      `json:"result"`DescriptionWorkspaceAgentMetadataDescription `json:"description"`}

typeWorkspaceAgentMetadataDescriptionadded inv0.21.3

type WorkspaceAgentMetadataDescription struct {DisplayNamestring `json:"display_name"`Keystring `json:"key"`Scriptstring `json:"script"`Intervalint64  `json:"interval"`Timeoutint64  `json:"timeout"`}

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

typeWorkspaceAgentMetadataResultadded inv0.21.3

type WorkspaceAgentMetadataResult struct {CollectedAttime.Time `json:"collected_at" format:"date-time"`// Age is the number of seconds since the metadata was collected.// It is provided in addition to CollectedAt to protect against clock skew.Ageint64  `json:"age"`Valuestring `json:"value"`Errorstring `json:"error"`}

typeWorkspaceAgentReconnectingPTYInitadded inv0.16.0

type WorkspaceAgentReconnectingPTYInit struct {IDuuid.UUIDHeightuint16Widthuint16Commandstring}

WorkspaceAgentReconnectingPTYInit initializes a new reconnecting PTY session.@typescript-ignore WorkspaceAgentReconnectingPTYInit

typeWorkspaceAgentReconnectingPTYOptsadded inv0.23.1

type WorkspaceAgentReconnectingPTYOpts struct {AgentIDuuid.UUIDReconnectuuid.UUIDWidthuint16Heightuint16Commandstring// SignedToken is an optional signed token from the// issue-reconnecting-pty-signed-token endpoint. If set, the session token// on the client will not be sent.SignedTokenstring}

@typescript-ignore:WorkspaceAgentReconnectingPTYOpts

typeWorkspaceAgentStartupLogadded inv0.21.0

type WorkspaceAgentStartupLog struct {IDint64     `json:"id"`CreatedAttime.Time `json:"created_at" format:"date-time"`Outputstring    `json:"output"`LevelLogLevel  `json:"level"`}

typeWorkspaceAgentStartupScriptBehavioradded inv0.24.0

type WorkspaceAgentStartupScriptBehaviorstring

WorkspaceAgentStartupScriptBehavior defines whether or not the startup scriptshould be considered blocking or non-blocking. The blocking behavior meansthat the agent will not be considered ready until the startup script hascompleted and, for example, SSH connections will wait for the agent to beready (can be overridden).

Presently, non-blocking is the default, but this may change in the future.

const (WorkspaceAgentStartupScriptBehaviorBlockingWorkspaceAgentStartupScriptBehavior = "blocking"WorkspaceAgentStartupScriptBehaviorNonBlockingWorkspaceAgentStartupScriptBehavior = "non-blocking")

typeWorkspaceAgentStatus

type WorkspaceAgentStatusstring
const (WorkspaceAgentConnectingWorkspaceAgentStatus = "connecting"WorkspaceAgentConnectedWorkspaceAgentStatus = "connected"WorkspaceAgentDisconnectedWorkspaceAgentStatus = "disconnected"WorkspaceAgentTimeoutWorkspaceAgentStatus = "timeout")

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

typeWorkspaceAppadded inv0.6.2

type WorkspaceApp struct {IDuuid.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.URLstring `json:"url"`// External specifies whether the URL should be opened externally on// the client or not.Externalbool `json:"external"`// Slug is a unique identifier within the agent.Slugstring `json:"slug"`// DisplayName is a friendly name for the app.DisplayNamestring `json:"display_name"`Commandstring `json:"command,omitempty"`// Icon is a relative path or external URL that specifies// an icon to be displayed in the dashboard.Iconstring `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.Subdomainbool                     `json:"subdomain"`SharingLevelWorkspaceAppSharingLevel `json:"sharing_level" enums:"owner,authenticated,public"`// Healthcheck specifies the configuration for checking app health.HealthcheckHealthcheck        `json:"healthcheck"`HealthWorkspaceAppHealth `json:"health"`}

typeWorkspaceAppHealthadded inv0.9.0

type WorkspaceAppHealthstring
const (WorkspaceAppHealthDisabledWorkspaceAppHealth = "disabled"WorkspaceAppHealthInitializingWorkspaceAppHealth = "initializing"WorkspaceAppHealthHealthyWorkspaceAppHealth = "healthy"WorkspaceAppHealthUnhealthyWorkspaceAppHealth = "unhealthy")

typeWorkspaceAppSharingLeveladded inv0.10.0

type WorkspaceAppSharingLevelstring
const (WorkspaceAppSharingLevelOwnerWorkspaceAppSharingLevel = "owner"WorkspaceAppSharingLevelAuthenticatedWorkspaceAppSharingLevel = "authenticated"WorkspaceAppSharingLevelPublicWorkspaceAppSharingLevel = "public")

typeWorkspaceBuild

type WorkspaceBuild struct {IDuuid.UUID           `json:"id" format:"uuid"`CreatedAttime.Time           `json:"created_at" format:"date-time"`UpdatedAttime.Time           `json:"updated_at" format:"date-time"`WorkspaceIDuuid.UUID           `json:"workspace_id" format:"uuid"`WorkspaceNamestring              `json:"workspace_name"`WorkspaceOwnerIDuuid.UUID           `json:"workspace_owner_id" format:"uuid"`WorkspaceOwnerNamestring              `json:"workspace_owner_name"`TemplateVersionIDuuid.UUID           `json:"template_version_id" format:"uuid"`TemplateVersionNamestring              `json:"template_version_name"`BuildNumberint32               `json:"build_number"`TransitionWorkspaceTransition `json:"transition" enums:"start,stop,delete"`InitiatorIDuuid.UUID           `json:"initiator_id" format:"uuid"`InitiatorUsernamestring              `json:"initiator_name"`JobProvisionerJob      `json:"job"`ReasonBuildReason         `db:"reason" json:"reason" enums:"initiator,autostart,autostop"`Resources           []WorkspaceResource `json:"resources"`DeadlineNullTime            `json:"deadline,omitempty" format:"date-time"`MaxDeadlineNullTime            `json:"max_deadline,omitempty" format:"date-time"`StatusWorkspaceStatus     `json:"status" enums:"pending,starting,running,stopping,stopped,failed,canceling,canceled,deleting,deleted"`DailyCostint32               `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

typeWorkspaceBuildParameteradded inv0.15.0

type WorkspaceBuildParameter struct {Namestring `json:"name"`Valuestring `json:"value"`}

WorkspaceBuildParameter represents a parameter specific for a workspace build.

typeWorkspaceBuildsRequestadded inv0.6.0

type WorkspaceBuildsRequest struct {WorkspaceIDuuid.UUIDPaginationSincetime.Time}

typeWorkspaceConnectionLatencyMSadded inv0.19.0

type WorkspaceConnectionLatencyMS struct {P50float64P95float64}

typeWorkspaceDeploymentStatsadded inv0.19.0

type WorkspaceDeploymentStats struct {Pendingint64 `json:"pending"`Buildingint64 `json:"building"`Runningint64 `json:"running"`Failedint64 `json:"failed"`Stoppedint64 `json:"stopped"`ConnectionLatencyMSWorkspaceConnectionLatencyMS `json:"connection_latency_ms"`RxBytesint64                        `json:"rx_bytes"`TxBytesint64                        `json:"tx_bytes"`}

typeWorkspaceFilteradded inv0.6.0

type WorkspaceFilter struct {// Owner can be "me" or a usernameOwnerstring `json:"owner,omitempty" typescript:"-"`// Template is a template nameTemplatestring `json:"template,omitempty" typescript:"-"`// Name will return partial matchesNamestring `json:"name,omitempty" typescript:"-"`// Status is a workspace status, which is really the status of the latest buildStatusstring `json:"status,omitempty" typescript:"-"`// Offset is the number of workspaces to skip before returning results.Offsetint `json:"offset,omitempty" typescript:"-"`// Limit is a limit on the number of workspaces returned.Limitint `json:"limit,omitempty" typescript:"-"`// FilterQuery supports a raw filter query stringFilterQuerystring `json:"q,omitempty"`}

typeWorkspaceHealthadded inv0.26.0

type WorkspaceHealth struct {Healthybool        `json:"healthy" example:"false"`// Healthy is true if the workspace is healthy.FailingAgents []uuid.UUID `json:"failing_agents" format:"uuid"`// FailingAgents lists the IDs of the agents that are failing, if any.}

typeWorkspaceOptionsadded inv0.6.3

type WorkspaceOptions struct {IncludeDeletedbool `json:"include_deleted,omitempty"`}

typeWorkspaceProxyadded inv0.22.0

type WorkspaceProxy struct {// Extends Region with extra informationRegion `table:"region,recursive_inline"`// Status is the latest status check of the proxy. This will be empty for deleted// proxies. This value can be used to determine if a workspace proxy is healthy// and ready to use.StatusWorkspaceProxyStatus `json:"status,omitempty" table:"proxy,recursive"`CreatedAttime.Time `json:"created_at" format:"date-time" table:"created_at,default_sort"`UpdatedAttime.Time `json:"updated_at" format:"date-time" table:"updated_at"`Deletedbool      `json:"deleted" table:"deleted"`}

typeWorkspaceProxyBuildInfoadded inv0.23.0

type WorkspaceProxyBuildInfo struct {// TODO: @emyrk what should we include here?WorkspaceProxybool `json:"workspace_proxy"`// DashboardURL is the URL of the coderd this proxy is connected to.DashboardURLstring `json:"dashboard_url"`}

typeWorkspaceProxyStatusadded inv0.23.0

type WorkspaceProxyStatus struct {StatusProxyHealthStatus `json:"status" table:"status,default_sort"`// Report provides more information about the health of the workspace proxy.ReportProxyHealthReport `json:"report,omitempty" table:"report"`CheckedAttime.Time         `json:"checked_at" table:"checked_at" format:"date-time"`}

typeWorkspaceQuotaadded inv0.9.2

type WorkspaceQuota struct {CreditsConsumedint `json:"credits_consumed"`Budgetint `json:"budget"`}

typeWorkspaceResource

type WorkspaceResource struct {IDuuid.UUID                   `json:"id" format:"uuid"`CreatedAttime.Time                   `json:"created_at" format:"date-time"`JobIDuuid.UUID                   `json:"job_id" format:"uuid"`TransitionWorkspaceTransition         `json:"workspace_transition" enums:"start,stop,delete"`Typestring                      `json:"type"`Namestring                      `json:"name"`Hidebool                        `json:"hide"`Iconstring                      `json:"icon"`Agents     []WorkspaceAgent            `json:"agents,omitempty"`Metadata   []WorkspaceResourceMetadata `json:"metadata,omitempty"`DailyCostint32                       `json:"daily_cost"`}

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

typeWorkspaceResourceMetadataadded inv0.8.3

type WorkspaceResourceMetadata struct {Keystring `json:"key"`Valuestring `json:"value"`Sensitivebool   `json:"sensitive"`}

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

typeWorkspaceStatusadded inv0.9.2

type WorkspaceStatusstring
const (WorkspaceStatusPendingWorkspaceStatus = "pending"WorkspaceStatusStartingWorkspaceStatus = "starting"WorkspaceStatusRunningWorkspaceStatus = "running"WorkspaceStatusStoppingWorkspaceStatus = "stopping"WorkspaceStatusStoppedWorkspaceStatus = "stopped"WorkspaceStatusFailedWorkspaceStatus = "failed"WorkspaceStatusCancelingWorkspaceStatus = "canceling"WorkspaceStatusCanceledWorkspaceStatus = "canceled"WorkspaceStatusDeletingWorkspaceStatus = "deleting"WorkspaceStatusDeletedWorkspaceStatus = "deleted")

typeWorkspaceTransitionadded inv0.6.0

type WorkspaceTransitionstring
const (WorkspaceTransitionStartWorkspaceTransition = "start"WorkspaceTransitionStopWorkspaceTransition = "stop"WorkspaceTransitionDeleteWorkspaceTransition = "delete")

typeWorkspacesRequestadded inv0.11.0

type WorkspacesRequest struct {SearchQuerystring `json:"q,omitempty"`Pagination}

typeWorkspacesResponseadded inv0.12.6

type WorkspacesResponse struct {Workspaces []Workspace `json:"workspaces"`Countint         `json:"count"`}

Source Files

View all Source files

Directories

PathSynopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp