Documentation ¶
Index ¶
- Constants
- Variables
- func IsConnectionErr(err error) bool
- func WorkspaceDisplayStatus(jobStatus ProvisionerJobStatus, transition WorkspaceTransition) string
- type APIKey
- type AWSInstanceIdentityToken
- type AddLicenseRequest
- type AgentGitSSHKey
- type AssignableRoles
- type AuthMethods
- type AzureInstanceIdentityToken
- type BuildInfoResponse
- type BuildReason
- type Client
- func (c *Client) AddLicense(ctx context.Context, r AddLicenseRequest) (License, error)
- func (c *Client) AgentGitSSHKey(ctx context.Context) (AgentGitSSHKey, error)
- func (c *Client) AuthMethods(ctx context.Context) (AuthMethods, error)
- func (c *Client) AuthWorkspaceAWSInstanceIdentity(ctx context.Context) (WorkspaceAgentAuthenticateResponse, error)
- func (c *Client) AuthWorkspaceAzureInstanceIdentity(ctx context.Context) (WorkspaceAgentAuthenticateResponse, error)
- func (c *Client) AuthWorkspaceGoogleInstanceIdentity(ctx context.Context, serviceAccount string, gcpClient *metadata.Client) (WorkspaceAgentAuthenticateResponse, error)
- func (c *Client) BuildInfo(ctx context.Context) (BuildInfoResponse, error)
- func (c *Client) CancelTemplateVersion(ctx context.Context, version uuid.UUID) error
- func (c *Client) CancelTemplateVersionDryRun(ctx context.Context, version, job uuid.UUID) error
- func (c *Client) CancelWorkspaceBuild(ctx context.Context, id uuid.UUID) error
- func (c *Client) CheckPermissions(ctx context.Context, checks UserAuthorizationRequest) (UserAuthorizationResponse, error)
- func (c *Client) CreateAPIKey(ctx context.Context, user string) (*GenerateAPIKeyResponse, error)
- func (c *Client) CreateFirstUser(ctx context.Context, req CreateFirstUserRequest) (CreateFirstUserResponse, error)
- func (c *Client) CreateOrganization(ctx context.Context, req CreateOrganizationRequest) (Organization, error)
- func (c *Client) CreateParameter(ctx context.Context, scope ParameterScope, id uuid.UUID, ...) (Parameter, error)
- func (c *Client) CreateTemplate(ctx context.Context, organizationID uuid.UUID, request CreateTemplateRequest) (Template, error)
- func (c *Client) CreateTemplateVersion(ctx context.Context, organizationID uuid.UUID, ...) (TemplateVersion, error)
- func (c *Client) CreateTemplateVersionDryRun(ctx context.Context, version uuid.UUID, req CreateTemplateVersionDryRunRequest) (ProvisionerJob, error)
- func (c *Client) CreateUser(ctx context.Context, req CreateUserRequest) (User, error)
- func (c *Client) CreateWorkspace(ctx context.Context, organizationID uuid.UUID, request CreateWorkspaceRequest) (Workspace, error)
- func (c *Client) CreateWorkspaceBuild(ctx context.Context, workspace uuid.UUID, request CreateWorkspaceBuildRequest) (WorkspaceBuild, error)
- func (c *Client) DeleteLicense(ctx context.Context, id int32) error
- func (c *Client) DeleteParameter(ctx context.Context, scope ParameterScope, id uuid.UUID, name string) error
- func (c *Client) DeleteTemplate(ctx context.Context, template uuid.UUID) error
- func (c *Client) DeletedWorkspace(ctx context.Context, id uuid.UUID) (Workspace, error)
- func (c *Client) DialWorkspaceAgent(ctx context.Context, agentID uuid.UUID, options *peer.ConnOptions) (*agent.Conn, error)
- func (c *Client) Download(ctx context.Context, hash string) ([]byte, string, error)
- func (c *Client) Entitlements(ctx context.Context) (Entitlements, error)
- func (c *Client) GetAPIKey(ctx context.Context, user string, id string) (*APIKey, error)
- func (c *Client) GetUserRoles(ctx context.Context, user string) (UserRoles, error)
- func (c *Client) GitSSHKey(ctx context.Context, user string) (GitSSHKey, error)
- func (c *Client) HasFirstUser(ctx context.Context) (bool, error)
- func (c *Client) Licenses(ctx context.Context) ([]License, error)
- func (c *Client) ListOrganizationRoles(ctx context.Context, org uuid.UUID) ([]AssignableRoles, error)
- func (c *Client) ListSiteRoles(ctx context.Context) ([]AssignableRoles, error)
- func (c *Client) ListenWorkspaceAgent(ctx context.Context, logger slog.Logger) (agent.Metadata, *peerbroker.Listener, error)
- func (c *Client) LoginWithPassword(ctx context.Context, req LoginWithPasswordRequest) (LoginWithPasswordResponse, error)
- func (c *Client) Logout(ctx context.Context) error
- func (c *Client) Organization(ctx context.Context, id uuid.UUID) (Organization, error)
- func (c *Client) OrganizationByName(ctx context.Context, user string, name string) (Organization, error)
- func (c *Client) OrganizationsByUser(ctx context.Context, user string) ([]Organization, error)
- func (c *Client) Parameters(ctx context.Context, scope ParameterScope, id uuid.UUID) ([]Parameter, error)
- func (c *Client) PostWireguardPeer(ctx context.Context, workspaceID uuid.UUID, peerMsg peerwg.Handshake) error
- func (c *Client) ProvisionerDaemons(ctx context.Context) ([]ProvisionerDaemon, error)
- func (c *Client) PutExtendWorkspace(ctx context.Context, id uuid.UUID, req PutExtendWorkspaceRequest) error
- func (c *Client) RegenerateGitSSHKey(ctx context.Context, user string) (GitSSHKey, error)
- func (c *Client) Request(ctx context.Context, method, path string, body interface{}, ...) (*http.Response, error)
- func (c *Client) Template(ctx context.Context, template uuid.UUID) (Template, error)
- func (c *Client) TemplateByName(ctx context.Context, organizationID uuid.UUID, name string) (Template, error)
- func (c *Client) TemplateVersion(ctx context.Context, id uuid.UUID) (TemplateVersion, error)
- func (c *Client) TemplateVersionByName(ctx context.Context, template uuid.UUID, name string) (TemplateVersion, error)
- func (c *Client) TemplateVersionDryRun(ctx context.Context, version, job uuid.UUID) (ProvisionerJob, error)
- func (c *Client) TemplateVersionDryRunLogsAfter(ctx context.Context, version, job uuid.UUID, after time.Time) (<-chan ProvisionerJobLog, error)
- func (c *Client) TemplateVersionDryRunLogsBefore(ctx context.Context, version, job uuid.UUID, before time.Time) ([]ProvisionerJobLog, error)
- func (c *Client) TemplateVersionDryRunResources(ctx context.Context, version, job uuid.UUID) ([]WorkspaceResource, error)
- func (c *Client) TemplateVersionLogsAfter(ctx context.Context, version uuid.UUID, after time.Time) (<-chan ProvisionerJobLog, error)
- func (c *Client) TemplateVersionLogsBefore(ctx context.Context, version uuid.UUID, before time.Time) ([]ProvisionerJobLog, error)
- func (c *Client) TemplateVersionParameters(ctx context.Context, version uuid.UUID) ([]ComputedParameter, error)
- func (c *Client) TemplateVersionResources(ctx context.Context, version uuid.UUID) ([]WorkspaceResource, error)
- func (c *Client) TemplateVersionSchema(ctx context.Context, version uuid.UUID) ([]ParameterSchema, error)
- func (c *Client) TemplateVersionsByTemplate(ctx context.Context, req TemplateVersionsByTemplateRequest) ([]TemplateVersion, error)
- func (c *Client) TemplatesByOrganization(ctx context.Context, organizationID uuid.UUID) ([]Template, error)
- func (c *Client) UpdateActiveTemplateVersion(ctx context.Context, template uuid.UUID, req UpdateActiveTemplateVersion) error
- func (c *Client) UpdateOrganizationMemberRoles(ctx context.Context, organizationID uuid.UUID, user string, req UpdateRoles) (OrganizationMember, error)
- func (c *Client) UpdateTemplateMeta(ctx context.Context, templateID uuid.UUID, req UpdateTemplateMeta) (Template, error)
- func (c *Client) UpdateUserPassword(ctx context.Context, user string, req UpdateUserPasswordRequest) error
- func (c *Client) UpdateUserProfile(ctx context.Context, user string, req UpdateUserProfileRequest) (User, error)
- func (c *Client) UpdateUserRoles(ctx context.Context, user string, req UpdateRoles) (User, error)
- func (c *Client) UpdateUserStatus(ctx context.Context, user string, status UserStatus) (User, error)
- func (c *Client) UpdateWorkspace(ctx context.Context, id uuid.UUID, req UpdateWorkspaceRequest) error
- func (c *Client) UpdateWorkspaceAutostart(ctx context.Context, id uuid.UUID, req UpdateWorkspaceAutostartRequest) error
- func (c *Client) UpdateWorkspaceTTL(ctx context.Context, id uuid.UUID, req UpdateWorkspaceTTLRequest) error
- func (c *Client) Upload(ctx context.Context, contentType string, content []byte) (UploadResponse, error)
- func (c *Client) UploadWorkspaceAgentKeys(ctx context.Context, keys agent.WireguardPublicKeys) error
- func (c *Client) User(ctx context.Context, userIdent string) (User, error)
- func (c *Client) Users(ctx context.Context, req UsersRequest) ([]User, error)
- func (c *Client) WatchWorkspace(ctx context.Context, id uuid.UUID) (<-chan Workspace, error)
- func (c *Client) WireguardPeerListener(ctx context.Context, logger slog.Logger) (<-chan peerwg.Handshake, func(), error)
- func (c *Client) Workspace(ctx context.Context, id uuid.UUID) (Workspace, error)
- func (c *Client) WorkspaceAgent(ctx context.Context, id uuid.UUID) (WorkspaceAgent, error)
- func (c *Client) WorkspaceAgentReconnectingPTY(ctx context.Context, agentID, reconnect uuid.UUID, height, width int, ...) (net.Conn, error)
- func (c *Client) WorkspaceBuild(ctx context.Context, id uuid.UUID) (WorkspaceBuild, error)
- func (c *Client) WorkspaceBuildByName(ctx context.Context, workspace uuid.UUID, name string) (WorkspaceBuild, error)
- func (c *Client) WorkspaceBuildByUsernameAndWorkspaceNameAndBuildNumber(ctx context.Context, username string, workspaceName string, buildNumber string) (WorkspaceBuild, error)
- func (c *Client) WorkspaceBuildLogsAfter(ctx context.Context, build uuid.UUID, after time.Time) (<-chan ProvisionerJobLog, error)
- func (c *Client) WorkspaceBuildLogsBefore(ctx context.Context, build uuid.UUID, before time.Time) ([]ProvisionerJobLog, error)
- func (c *Client) WorkspaceBuildState(ctx context.Context, build uuid.UUID) ([]byte, error)
- func (c *Client) WorkspaceBuilds(ctx context.Context, req WorkspaceBuildsRequest) ([]WorkspaceBuild, error)
- func (c *Client) WorkspaceByOwnerAndName(ctx context.Context, owner string, name string, params WorkspaceOptions) (Workspace, error)
- func (c *Client) WorkspaceResource(ctx context.Context, id uuid.UUID) (WorkspaceResource, error)
- func (c *Client) WorkspaceResourcesByBuild(ctx context.Context, build uuid.UUID) ([]WorkspaceResource, error)
- func (c *Client) Workspaces(ctx context.Context, filter WorkspaceFilter) ([]Workspace, error)
- type ComputedParameter
- type CreateFirstUserRequest
- type CreateFirstUserResponse
- type CreateOrganizationRequest
- type CreateParameterRequest
- type CreateTemplateRequest
- type CreateTemplateVersionDryRunRequest
- type CreateTemplateVersionRequest
- type CreateUserRequest
- type CreateWorkspaceBuildRequest
- type CreateWorkspaceRequest
- type Entitlement
- type Entitlements
- type Error
- type Feature
- type GenerateAPIKeyResponse
- type GitSSHKey
- type GoogleInstanceIdentityToken
- type License
- type LogLevel
- type LogSource
- type LoginType
- type LoginWithPasswordRequest
- type LoginWithPasswordResponse
- type NullTime
- type Organization
- type OrganizationMember
- type Pagination
- type Parameter
- type ParameterDestinationScheme
- type ParameterSchema
- type ParameterScope
- type ParameterSourceScheme
- type ParameterTypeSystem
- type ProvisionerDaemon
- type ProvisionerJob
- type ProvisionerJobLog
- type ProvisionerJobStatus
- type ProvisionerStorageMethod
- type ProvisionerType
- type PutExtendWorkspaceRequest
- type Response
- type Role
- type Template
- type TemplateVersion
- type TemplateVersionsByTemplateRequest
- type UpdateActiveTemplateVersion
- type UpdateRoles
- type UpdateTemplateMeta
- type UpdateUserPasswordRequest
- type UpdateUserProfileRequest
- type UpdateWorkspaceAutostartRequest
- type UpdateWorkspaceRequest
- type UpdateWorkspaceTTLRequest
- type UploadResponse
- type User
- type UserAuthorization
- type UserAuthorizationObject
- type UserAuthorizationRequest
- type UserAuthorizationResponse
- type UserRoles
- type UserStatus
- type UsersRequest
- type ValidationError
- type Workspace
- type WorkspaceAgent
- type WorkspaceAgentAuthenticateResponse
- type WorkspaceAgentInstanceMetadata
- type WorkspaceAgentResourceMetadata
- type WorkspaceAgentStatus
- type WorkspaceApp
- type WorkspaceBuild
- type WorkspaceBuildsRequest
- type WorkspaceFilter
- type WorkspaceOptions
- type WorkspaceResource
- type WorkspaceResourceMetadata
- type WorkspaceTransition
Constants ¶
const ( // SessionTokenKey represents the name of the cookie or query parameter the API key is stored in. SessionTokenKey = "session_token" OAuth2StateKey = "oauth_state" OAuth2RedirectKey = "oauth_redirect" )
These cookies are Coder-specific. If a new one is added or changed, the name shouldn't be likely to conflict with any user-application set cookies. Be sure to strip additional cookies in httpapi.StripCoder Cookies!
const ( FeatureUserLimit = "user_limit" FeatureAuditLog = "audit_log" )
const (
ContentTypeTar = "application/x-tar"
)
Variables ¶
var FeatureNames = []string{FeatureUserLimit, FeatureAuditLog}
var Me = "me"
Me is used as a replacement for your own ID.
Functions ¶
func IsConnectionErr ¶ added in v0.8.1
IsConnectionErr is a convenience function for checking if the source of an error is due to a 'connection refused', 'no such host', etc.
func WorkspaceDisplayStatus ¶ added in v0.7.7
func WorkspaceDisplayStatus(jobStatus ProvisionerJobStatus, transition WorkspaceTransition) string
WorkspaceDisplayStatus computes a status to display on CLI/UI based on the workspace transition and the status of the provisioner job. This code is in sync with how we compute the status on frontend. Ref: site/src/util/workspace.ts (getWorkspaceStatus)
Types ¶
type APIKey ¶ added in v0.7.6
type APIKey struct { ID string `json:"id" validate:"required"` UserID uuid.UUID `json:"user_id" validate:"required"` LastUsed time.Time `json:"last_used" validate:"required"` ExpiresAt time.Time `json:"expires_at" validate:"required"` CreatedAt time.Time `json:"created_at" validate:"required"` UpdatedAt time.Time `json:"updated_at" validate:"required"` LoginType LoginType `json:"login_type" validate:"required"` LifetimeSeconds int64 `json:"lifetime_seconds" validate:"required"` }
type AddLicenseRequest ¶ added in v0.8.7
type AddLicenseRequest struct {
License string `json:"license" validate:"required"`
}
type AgentGitSSHKey ¶ added in v0.4.0
type AssignableRoles ¶ added in v0.8.6
type AuthMethods ¶ added in v0.4.4
type AuthMethods struct { Password bool `json:"password"` Github bool `json:"github"` OIDC bool `json:"oidc"` }
AuthMethods contains whether authentication types are enabled or not.
type AzureInstanceIdentityToken ¶ added in v0.4.4
type BuildInfoResponse ¶ added in v0.4.1
type BuildInfoResponse struct { // ExternalURL is a URL referencing the current Coder version. For production // builds, this will link directly to a release. For development builds, this // will link to a commit. ExternalURL string `json:"external_url"` // Version returns the semantic version of the build. Version string `json:"version"` }
BuildInfoResponse contains build information for this instance of Coder.
func (BuildInfoResponse) CanonicalVersion ¶ added in v0.7.7
func (b BuildInfoResponse) CanonicalVersion() string
CanonicalVersion trims build information from the version. E.g. 'v0.7.4-devel+11573034' -> 'v0.7.4'.
type BuildReason ¶ added in v0.7.2
type BuildReason string
const ( // "initiator" is used when a workspace build is triggered by a user. // Combined with the initiator id/username, it indicates which user initiated the build. BuildReasonInitiator BuildReason = "initiator" // "autostart" is used when a build to start a workspace is triggered by Autostart. // The initiator id/username in this case is the workspace owner and can be ignored. BuildReasonAutostart BuildReason = "autostart" // "autostop" is used when a build to stop a workspace is triggered by Autostop. // The initiator id/username in this case is the workspace owner and can be ignored. BuildReasonAutostop BuildReason = "autostop" )
type Client ¶
Client is an HTTP caller for methods to the Coder API. @typescript-ignore Client
func (*Client) AddLicense ¶ added in v0.8.7
func (*Client) AgentGitSSHKey ¶ added in v0.4.0
func (c *Client) AgentGitSSHKey(ctx context.Context) (AgentGitSSHKey, error)
AgentGitSSHKey will return the user's SSH key pair for the workspace.
func (*Client) AuthMethods ¶ added in v0.4.4
func (c *Client) AuthMethods(ctx context.Context) (AuthMethods, error)
AuthMethods returns types of authentication available to the user.
func (*Client) AuthWorkspaceAWSInstanceIdentity ¶
func (c *Client) AuthWorkspaceAWSInstanceIdentity(ctx context.Context) (WorkspaceAgentAuthenticateResponse, error)
AuthWorkspaceAWSInstanceIdentity uses the Amazon Metadata API to fetch a signed payload, and exchange it for a session token for a workspace agent.
The requesting instance must be registered as a resource in the latest history for a workspace.
func (*Client) AuthWorkspaceAzureInstanceIdentity ¶ added in v0.4.4
func (c *Client) AuthWorkspaceAzureInstanceIdentity(ctx context.Context) (WorkspaceAgentAuthenticateResponse, error)
AuthWorkspaceAzureInstanceIdentity uses the Azure Instance Metadata Service to fetch a signed payload, and exchange it for a session token for a workspace agent.
func (*Client) AuthWorkspaceGoogleInstanceIdentity ¶
func (c *Client) AuthWorkspaceGoogleInstanceIdentity(ctx context.Context, serviceAccount string, gcpClient *metadata.Client) (WorkspaceAgentAuthenticateResponse, error)
AuthWorkspaceGoogleInstanceIdentity uses the Google Compute Engine Metadata API to fetch a signed JWT, and exchange it for a session token for a workspace agent.
The requesting instance must be registered as a resource in the latest history for a workspace.
func (*Client) BuildInfo ¶ added in v0.4.1
func (c *Client) BuildInfo(ctx context.Context) (BuildInfoResponse, error)
BuildInfo returns build information for this instance of Coder.
func (*Client) CancelTemplateVersion ¶ added in v0.4.0
CancelTemplateVersion marks a template version job as canceled.
func (*Client) CancelTemplateVersionDryRun ¶ added in v0.6.1
CancelTemplateVersionDryRun marks a template version dry-run job as canceled.
func (*Client) CancelWorkspaceBuild ¶
CancelWorkspaceBuild marks a workspace build job as canceled.
func (*Client) CheckPermissions ¶ added in v0.5.7
func (c *Client) CheckPermissions(ctx context.Context, checks UserAuthorizationRequest) (UserAuthorizationResponse, error)
func (*Client) CreateAPIKey ¶
CreateAPIKey generates an API key for the user ID provided.
func (*Client) CreateFirstUser ¶
func (c *Client) CreateFirstUser(ctx context.Context, req CreateFirstUserRequest) (CreateFirstUserResponse, error)
CreateFirstUser attempts to create the first user on a Coder deployment. This initial user has superadmin privileges. If >0 users exist, this request will fail.
func (*Client) CreateOrganization ¶
func (c *Client) CreateOrganization(ctx context.Context, req CreateOrganizationRequest) (Organization, error)
CreateOrganization creates an organization and adds the provided user as an admin.
func (*Client) CreateParameter ¶
func (c *Client) CreateParameter(ctx context.Context, scope ParameterScope, id uuid.UUID, req CreateParameterRequest) (Parameter, error)
func (*Client) CreateTemplate ¶ added in v0.4.0
func (c *Client) CreateTemplate(ctx context.Context, organizationID uuid.UUID, request CreateTemplateRequest) (Template, error)
CreateTemplate creates a new template inside an organization.
func (*Client) CreateTemplateVersion ¶ added in v0.4.0
func (c *Client) CreateTemplateVersion(ctx context.Context, organizationID uuid.UUID, req CreateTemplateVersionRequest) (TemplateVersion, error)
CreateTemplateVersion processes source-code and optionally associates the version with a template. Executing without a template is useful for validating source-code.
func (*Client) CreateTemplateVersionDryRun ¶ added in v0.6.1
func (c *Client) CreateTemplateVersionDryRun(ctx context.Context, version uuid.UUID, req CreateTemplateVersionDryRunRequest) (ProvisionerJob, error)
CreateTemplateVersionDryRun begins a dry-run provisioner job against the given template version with the given parameter values.
func (*Client) CreateUser ¶
CreateUser creates a new user.
func (*Client) CreateWorkspace ¶
func (c *Client) CreateWorkspace(ctx context.Context, organizationID uuid.UUID, request CreateWorkspaceRequest) (Workspace, error)
CreateWorkspace creates a new workspace for the template specified.
func (*Client) CreateWorkspaceBuild ¶
func (c *Client) CreateWorkspaceBuild(ctx context.Context, workspace uuid.UUID, request CreateWorkspaceBuildRequest) (WorkspaceBuild, error)
CreateWorkspaceBuild queues a new build to occur for a workspace.
func (*Client) DeleteLicense ¶ added in v0.8.7
func (*Client) DeleteParameter ¶
func (*Client) DeleteTemplate ¶ added in v0.4.0
func (*Client) DeletedWorkspace ¶ added in v0.6.0
DeletedWorkspace returns a single workspace that was deleted.
func (*Client) DialWorkspaceAgent ¶
func (c *Client) DialWorkspaceAgent(ctx context.Context, agentID uuid.UUID, options *peer.ConnOptions) (*agent.Conn, error)
DialWorkspaceAgent creates a connection to the specified resource.
func (*Client) Entitlements ¶ added in v0.8.6
func (c *Client) Entitlements(ctx context.Context) (Entitlements, error)
func (*Client) GetUserRoles ¶ added in v0.5.2
GetUserRoles returns all roles the user has
func (*Client) HasFirstUser ¶
HasFirstUser returns whether the first user has been created.
func (*Client) ListOrganizationRoles ¶ added in v0.5.4
func (c *Client) ListOrganizationRoles(ctx context.Context, org uuid.UUID) ([]AssignableRoles, error)
ListOrganizationRoles lists all assignable roles for a given organization.
func (*Client) ListSiteRoles ¶ added in v0.5.4
func (c *Client) ListSiteRoles(ctx context.Context) ([]AssignableRoles, error)
ListSiteRoles lists all assignable site wide roles.
func (*Client) ListenWorkspaceAgent ¶
func (c *Client) ListenWorkspaceAgent(ctx context.Context, logger slog.Logger) (agent.Metadata, *peerbroker.Listener, error)
ListenWorkspaceAgent connects as a workspace agent identifying with the session token. On each inbound connection request, connection info is fetched.
func (*Client) LoginWithPassword ¶
func (c *Client) LoginWithPassword(ctx context.Context, req LoginWithPasswordRequest) (LoginWithPasswordResponse, error)
LoginWithPassword creates a session token authenticating with an email and password. Call `SetSessionToken()` to apply the newly acquired token to the client.
func (*Client) Logout ¶
Logout calls the /logout API Call `ClearSessionToken()` to clear the session token of the client.
func (*Client) Organization ¶
func (*Client) OrganizationByName ¶
func (*Client) OrganizationsByUser ¶
OrganizationsByUser returns all organizations the user is a member of.
func (*Client) Parameters ¶
func (*Client) PostWireguardPeer ¶ added in v0.7.5
func (c *Client) PostWireguardPeer(ctx context.Context, workspaceID uuid.UUID, peerMsg peerwg.Handshake) error
PostWireguardPeer announces your public keys and IPv6 address to the specified recipient.
func (*Client) ProvisionerDaemons ¶ added in v0.6.1
func (c *Client) ProvisionerDaemons(ctx context.Context) ([]ProvisionerDaemon, error)
ProvisionerDaemonsByOrganization returns provisioner daemons available for an organization.
func (*Client) PutExtendWorkspace ¶ added in v0.6.1
func (c *Client) PutExtendWorkspace(ctx context.Context, id uuid.UUID, req PutExtendWorkspaceRequest) error
PutExtendWorkspace updates the deadline for resources of the latest workspace build.
func (*Client) RegenerateGitSSHKey ¶ added in v0.4.0
RegenerateGitSSHKey will create a new SSH key pair for the user and return it.
func (*Client) Request ¶ added in v0.5.10
func (c *Client) Request(ctx context.Context, method, path string, body interface{}, opts ...requestOption) (*http.Response, error)
Request performs an HTTP request with the body provided. The caller is responsible for closing the response body.
func (*Client) TemplateByName ¶ added in v0.4.0
func (c *Client) TemplateByName(ctx context.Context, organizationID uuid.UUID, name string) (Template, error)
TemplateByName finds a template inside the organization provided with a case-insensitive name.
func (*Client) TemplateVersion ¶ added in v0.4.0
TemplateVersion returns a template version by ID.
func (*Client) TemplateVersionByName ¶ added in v0.4.0
func (c *Client) TemplateVersionByName(ctx context.Context, template uuid.UUID, name string) (TemplateVersion, error)
TemplateVersionByName returns a template version by it's friendly name. This is used for path-based routing. Like: /templates/example/versions/helloworld
func (*Client) TemplateVersionDryRun ¶ added in v0.6.1
func (c *Client) TemplateVersionDryRun(ctx context.Context, version, job uuid.UUID) (ProvisionerJob, error)
TemplateVersionDryRun returns the current state of a template version dry-run job.
func (*Client) TemplateVersionDryRunLogsAfter ¶ added in v0.6.1
func (c *Client) TemplateVersionDryRunLogsAfter(ctx context.Context, version, job uuid.UUID, after time.Time) (<-chan ProvisionerJobLog, error)
TemplateVersionDryRunLogsAfter streams logs for a template version dry-run that occurred after a specific time.
func (*Client) TemplateVersionDryRunLogsBefore ¶ added in v0.6.1
func (c *Client) TemplateVersionDryRunLogsBefore(ctx context.Context, version, job uuid.UUID, before time.Time) ([]ProvisionerJobLog, error)
TemplateVersionDryRunLogsBefore returns logs for a template version dry-run that occurred before a specific time.
func (*Client) TemplateVersionDryRunResources ¶ added in v0.6.1
func (c *Client) TemplateVersionDryRunResources(ctx context.Context, version, job uuid.UUID) ([]WorkspaceResource, error)
TemplateVersionDryRunResources returns the resources of a finished template version dry-run job.
func (*Client) TemplateVersionLogsAfter ¶ added in v0.4.0
func (c *Client) TemplateVersionLogsAfter(ctx context.Context, version uuid.UUID, after time.Time) (<-chan ProvisionerJobLog, error)
TemplateVersionLogsAfter streams logs for a template version that occurred after a specific time.
func (*Client) TemplateVersionLogsBefore ¶ added in v0.4.0
func (c *Client) TemplateVersionLogsBefore(ctx context.Context, version uuid.UUID, before time.Time) ([]ProvisionerJobLog, error)
TemplateVersionLogsBefore returns logs that occurred before a specific time.
func (*Client) TemplateVersionParameters ¶ added in v0.4.0
func (c *Client) TemplateVersionParameters(ctx context.Context, version uuid.UUID) ([]ComputedParameter, error)
TemplateVersionParameters returns computed parameters for a template version.
func (*Client) TemplateVersionResources ¶ added in v0.4.0
func (c *Client) TemplateVersionResources(ctx context.Context, version uuid.UUID) ([]WorkspaceResource, error)
TemplateVersionResources returns resources a template version declares.
func (*Client) TemplateVersionSchema ¶ added in v0.4.0
func (c *Client) TemplateVersionSchema(ctx context.Context, version uuid.UUID) ([]ParameterSchema, error)
TemplateVersionSchema returns schemas for a template version by ID.
func (*Client) TemplateVersionsByTemplate ¶ added in v0.4.0
func (c *Client) TemplateVersionsByTemplate(ctx context.Context, req TemplateVersionsByTemplateRequest) ([]TemplateVersion, error)
TemplateVersionsByTemplate lists versions associated with a template.
func (*Client) TemplatesByOrganization ¶ added in v0.4.0
func (c *Client) TemplatesByOrganization(ctx context.Context, organizationID uuid.UUID) ([]Template, error)
TemplatesByOrganization lists all templates inside of an organization.
func (*Client) UpdateActiveTemplateVersion ¶ added in v0.4.0
func (c *Client) UpdateActiveTemplateVersion(ctx context.Context, template uuid.UUID, req UpdateActiveTemplateVersion) error
UpdateActiveTemplateVersion updates the active template version to the ID provided. The template version must be attached to the template.
func (*Client) UpdateOrganizationMemberRoles ¶ added in v0.5.2
func (c *Client) UpdateOrganizationMemberRoles(ctx context.Context, organizationID uuid.UUID, user string, req UpdateRoles) (OrganizationMember, error)
UpdateOrganizationMemberRoles grants the userID the specified roles in an org. Include ALL roles the user has.
func (*Client) UpdateTemplateMeta ¶ added in v0.6.3
func (*Client) UpdateUserPassword ¶ added in v0.5.5
func (c *Client) UpdateUserPassword(ctx context.Context, user string, req UpdateUserPasswordRequest) error
UpdateUserPassword updates a user password. It calls PUT /users/{user}/password
func (*Client) UpdateUserProfile ¶ added in v0.4.2
func (c *Client) UpdateUserProfile(ctx context.Context, user string, req UpdateUserProfileRequest) (User, error)
UpdateUserProfile enables callers to update profile information
func (*Client) UpdateUserRoles ¶ added in v0.5.2
UpdateUserRoles grants the userID the specified roles. Include ALL roles the user has.
func (*Client) UpdateUserStatus ¶ added in v0.5.8
func (c *Client) UpdateUserStatus(ctx context.Context, user string, status UserStatus) (User, error)
UpdateUserStatus sets the user status to the given status
func (*Client) UpdateWorkspace ¶ added in v0.8.7
func (*Client) UpdateWorkspaceAutostart ¶ added in v0.4.1
func (c *Client) UpdateWorkspaceAutostart(ctx context.Context, id uuid.UUID, req UpdateWorkspaceAutostartRequest) error
UpdateWorkspaceAutostart sets the autostart schedule for workspace by id. If the provided schedule is empty, autostart is disabled for the workspace.
func (*Client) UpdateWorkspaceTTL ¶ added in v0.6.0
func (c *Client) UpdateWorkspaceTTL(ctx context.Context, id uuid.UUID, req UpdateWorkspaceTTLRequest) error
UpdateWorkspaceTTL sets the ttl for workspace by id. If the provided duration is nil, autostop is disabled for the workspace.
func (*Client) Upload ¶
func (c *Client) Upload(ctx context.Context, contentType string, content []byte) (UploadResponse, error)
Upload uploads an arbitrary file with the content type provided. This is used to upload a source-code archive.
func (*Client) UploadWorkspaceAgentKeys ¶ added in v0.7.5
func (c *Client) UploadWorkspaceAgentKeys(ctx context.Context, keys agent.WireguardPublicKeys) error
UploadWorkspaceAgentKeys uploads the public keys of the workspace agent that were generated on startup. These keys are used by clients to communicate with the workspace agent over the wireguard interface.
func (*Client) Users ¶ added in v0.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) WatchWorkspace ¶ added in v0.6.0
func (*Client) WireguardPeerListener ¶ added in v0.7.5
func (c *Client) WireguardPeerListener(ctx context.Context, logger slog.Logger) (<-chan peerwg.Handshake, func(), error)
WireguardPeerListener listens for wireguard peer messages. Peer messages are sent when a new client wants to connect. Once receiving a peer message, the peer should be added to the NetworkMap of the wireguard interface.
func (*Client) WorkspaceAgent ¶ added in v0.4.1
WorkspaceAgent returns an agent by ID.
func (*Client) WorkspaceAgentReconnectingPTY ¶ added in v0.5.2
func (c *Client) WorkspaceAgentReconnectingPTY(ctx context.Context, agentID, reconnect uuid.UUID, height, width int, command string) (net.Conn, error)
WorkspaceAgentReconnectingPTY spawns a PTY that reconnects using the token provided. It communicates using `agent.ReconnectingPTYRequest` marshaled as JSON. Responses are PTY output that can be rendered.
func (*Client) WorkspaceBuild ¶
WorkspaceBuild returns a single workspace build for a workspace. If history is "", the latest version is returned.
func (*Client) WorkspaceBuildByName ¶
func (*Client) WorkspaceBuildByUsernameAndWorkspaceNameAndBuildNumber ¶ added in v0.6.6
func (*Client) WorkspaceBuildLogsAfter ¶
func (c *Client) WorkspaceBuildLogsAfter(ctx context.Context, build uuid.UUID, after time.Time) (<-chan ProvisionerJobLog, error)
WorkspaceBuildLogsAfter streams logs for a workspace build that occurred after a specific time.
func (*Client) WorkspaceBuildLogsBefore ¶
func (c *Client) WorkspaceBuildLogsBefore(ctx context.Context, build uuid.UUID, before time.Time) ([]ProvisionerJobLog, error)
WorkspaceBuildLogsBefore returns logs that occurred before a specific time.
func (*Client) WorkspaceBuildState ¶ added in v0.5.3
WorkspaceBuildState returns the provisioner state of the build.
func (*Client) WorkspaceBuilds ¶
func (c *Client) WorkspaceBuilds(ctx context.Context, req WorkspaceBuildsRequest) ([]WorkspaceBuild, error)
func (*Client) WorkspaceByOwnerAndName ¶ added in v0.5.0
func (c *Client) WorkspaceByOwnerAndName(ctx context.Context, owner string, name string, params WorkspaceOptions) (Workspace, error)
WorkspaceByOwnerAndName returns a workspace by the owner's UUID and the workspace's name.
func (*Client) WorkspaceResource ¶
func (*Client) WorkspaceResourcesByBuild ¶
func (c *Client) WorkspaceResourcesByBuild(ctx context.Context, build uuid.UUID) ([]WorkspaceResource, error)
WorkspaceResourcesByBuild returns resources for a workspace build.
func (*Client) Workspaces ¶ added in v0.6.0
Workspaces returns all workspaces the authenticated user has access to.
type ComputedParameter ¶ added in v0.7.2
type CreateFirstUserRequest ¶
type CreateFirstUserResponse ¶
type CreateFirstUserResponse struct { UserID uuid.UUID `json:"user_id"` OrganizationID uuid.UUID `json:"organization_id"` }
CreateFirstUserResponse contains IDs for newly created user info.
type CreateOrganizationRequest ¶
type CreateOrganizationRequest struct {
Name string `json:"name" validate:"required,username"`
}
type CreateParameterRequest ¶
type CreateParameterRequest struct { // CloneID allows copying the value of another parameter. // The other param must be related to the same template_id for this to // succeed. // No other fields are required if using this, as all fields will be copied // from the other parameter. CloneID uuid.UUID `json:"copy_from_parameter,omitempty" validate:""` Name string `json:"name" validate:"required"` SourceValue string `json:"source_value" validate:"required"` SourceScheme ParameterSourceScheme `json:"source_scheme" validate:"oneof=data,required"` DestinationScheme ParameterDestinationScheme `json:"destination_scheme" validate:"oneof=environment_variable provisioner_variable,required"` }
CreateParameterRequest is used to create a new parameter value for a scope.
type CreateTemplateRequest ¶ added in v0.4.0
type CreateTemplateRequest struct { // Name is the name of the template. Name string `json:"name" validate:"template_name,required"` // Description is a description of what the template contains. It must be // less than 128 bytes. Description string `json:"description,omitempty" validate:"lt=128"` // Icon is a relative path or external URL that specifies // an icon to be displayed in the dashboard. Icon string `json:"icon,omitempty"` // VersionID is an in-progress or completed job to use as an initial version // of the template. // // This is required on creation to enable a user-flow of validating a // template works. There is no reason the data-model cannot support empty // templates, but it doesn't make sense for users. VersionID uuid.UUID `json:"template_version_id" validate:"required"` ParameterValues []CreateParameterRequest `json:"parameter_values,omitempty"` // MaxTTLMillis allows optionally specifying the maximum allowable TTL // for all workspaces created from this template. MaxTTLMillis *int64 `json:"max_ttl_ms,omitempty"` // MinAutostartIntervalMillis allows optionally specifying the minimum // allowable duration between autostarts for all workspaces created from // this template. MinAutostartIntervalMillis *int64 `json:"min_autostart_interval_ms,omitempty"` }
CreateTemplateRequest provides options when creating a template.
type CreateTemplateVersionDryRunRequest ¶ added in v0.6.1
type CreateTemplateVersionDryRunRequest struct { WorkspaceName string ParameterValues []CreateParameterRequest }
CreateTemplateVersionDryRunRequest defines the request parameters for CreateTemplateVersionDryRun.
type CreateTemplateVersionRequest ¶ added in v0.4.0
type CreateTemplateVersionRequest struct { // TemplateID optionally associates a version with a template. TemplateID uuid.UUID `json:"template_id,omitempty"` StorageMethod ProvisionerStorageMethod `json:"storage_method" validate:"oneof=file,required"` StorageSource string `json:"storage_source" validate:"required"` Provisioner ProvisionerType `json:"provisioner" validate:"oneof=terraform echo,required"` // ParameterValues allows for additional parameters to be provided // during the dry-run provision stage. ParameterValues []CreateParameterRequest `json:"parameter_values,omitempty"` }
CreateTemplateVersionRequest enables callers to create a new Template Version.
type CreateUserRequest ¶
type CreateWorkspaceBuildRequest ¶
type CreateWorkspaceBuildRequest struct { TemplateVersionID uuid.UUID `json:"template_version_id,omitempty"` Transition WorkspaceTransition `json:"transition" validate:"oneof=create start stop delete,required"` DryRun bool `json:"dry_run,omitempty"` ProvisionerState []byte `json:"state,omitempty"` // ParameterValues are optional. It will write params to the 'workspace' scope. // This will overwrite any existing parameters with the same name. // This will not delete old params not included in this list. ParameterValues []CreateParameterRequest `json:"parameter_values,omitempty"` }
CreateWorkspaceBuildRequest provides options to update the latest workspace build.
type CreateWorkspaceRequest ¶
type CreateWorkspaceRequest struct { TemplateID uuid.UUID `json:"template_id" validate:"required"` Name string `json:"name" validate:"workspace_name,required"` AutostartSchedule *string `json:"autostart_schedule"` TTLMillis *int64 `json:"ttl_ms,omitempty"` // ParameterValues allows for additional parameters to be provided // during the initial provision. ParameterValues []CreateParameterRequest `json:"parameter_values,omitempty"` }
CreateWorkspaceRequest provides options for creating a new workspace.
type Entitlement ¶ added in v0.8.6
type Entitlement string
const ( EntitlementEntitled Entitlement = "entitled" EntitlementGracePeriod Entitlement = "grace_period" EntitlementNotEntitled Entitlement = "not_entitled" )
type Entitlements ¶ added in v0.8.6
type Error ¶
Error represents an unaccepted or invalid request to the API. @typescript-ignore Error
func (*Error) StatusCode ¶
type Feature ¶ added in v0.8.6
type Feature struct { Entitlement Entitlement `json:"entitlement"` Enabled bool `json:"enabled"` Limit *int64 `json:"limit"` Actual *int64 `json:"actual"` }
type GenerateAPIKeyResponse ¶
type GenerateAPIKeyResponse struct {
Key string `json:"key"`
}
GenerateAPIKeyResponse contains an API key for a user.
type GoogleInstanceIdentityToken ¶
type GoogleInstanceIdentityToken struct {
JSONWebToken string `json:"json_web_token" validate:"required"`
}
type License ¶ added in v0.8.7
type License struct { ID int32 `json:"id"` UploadedAt time.Time `json:"uploaded_at"` // Claims are the JWT claims asserted by the license. Here we use // a generic string map to ensure that all data from the server is // parsed verbatim, not just the fields this version of Coder // understands. Claims map[string]interface{} `json:"claims"` }
type LoginWithPasswordRequest ¶
type LoginWithPasswordRequest struct { Email string `json:"email" validate:"required,email"` Password string `json:"password" validate:"required"` }
LoginWithPasswordRequest enables callers to authenticate with email and password.
type LoginWithPasswordResponse ¶
type LoginWithPasswordResponse struct {
SessionToken string `json:"session_token" validate:"required"`
}
LoginWithPasswordResponse contains a session token for the newly authenticated user.
type NullTime ¶ added in v0.8.7
NullTime represents a nullable time.Time. @typescript-ignore NullTime
func NewNullTime ¶ added in v0.8.7
NewNullTime returns a new NullTime with the given time.Time.
func (NullTime) MarshalJSON ¶ added in v0.8.7
MarshalJSON implements json.Marshaler.
func (*NullTime) UnmarshalJSON ¶ added in v0.8.7
UnmarshalJSON implements json.Unmarshaler.
type Organization ¶
type Organization struct { ID uuid.UUID `json:"id" validate:"required"` Name string `json:"name" validate:"required"` CreatedAt time.Time `json:"created_at" validate:"required"` UpdatedAt time.Time `json:"updated_at" validate:"required"` }
Organization is the JSON representation of a Coder organization.
type OrganizationMember ¶ added in v0.5.2
type OrganizationMember struct { UserID uuid.UUID `db:"user_id" json:"user_id"` OrganizationID uuid.UUID `db:"organization_id" json:"organization_id"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` Roles []Role `db:"roles" json:"roles"` }
type Pagination ¶ added in v0.5.6
type Pagination struct { // AfterID returns all or up to Limit results after the given // UUID. This option can be used with or as an alternative to // Offset for better performance. To use it as an alternative, // set AfterID to the last UUID returned by the previous // request. AfterID uuid.UUID `json:"after_id,omitempty"` // Limit sets the maximum number of users to be returned // in a single page. If the limit is <= 0, there is no limit // and all users are returned. Limit int `json:"limit,omitempty"` // Offset is used to indicate which page to return. An offset of 0 // returns the first 'limit' number of users. // To get the next page, use offset=<limit>*<page_number>. // Offset is 0 indexed, so the first record sits at offset 0. Offset int `json:"offset,omitempty"` }
Pagination sets pagination options for the endpoints that support it.
type Parameter ¶
type Parameter struct { ID uuid.UUID `json:"id" table:"id"` Scope ParameterScope `json:"scope" table:"scope"` ScopeID uuid.UUID `json:"scope_id" table:"scope id"` Name string `json:"name" table:"name"` SourceScheme ParameterSourceScheme `json:"source_scheme" table:"source scheme"` DestinationScheme ParameterDestinationScheme `json:"destination_scheme" table:"destination scheme"` CreatedAt time.Time `json:"created_at" table:"created at"` UpdatedAt time.Time `json:"updated_at" table:"updated at"` }
Parameter represents a set value for the scope.
type ParameterDestinationScheme ¶ added in v0.6.0
type ParameterDestinationScheme string
const ( ParameterDestinationSchemeNone ParameterDestinationScheme = "none" ParameterDestinationSchemeEnvironmentVariable ParameterDestinationScheme = "environment_variable" ParameterDestinationSchemeProvisionerVariable ParameterDestinationScheme = "provisioner_variable" )
type ParameterSchema ¶ added in v0.6.0
type ParameterSchema struct { ID uuid.UUID `json:"id"` CreatedAt time.Time `json:"created_at"` JobID uuid.UUID `json:"job_id"` Name string `json:"name"` Description string `json:"description"` DefaultSourceScheme ParameterSourceScheme `json:"default_source_scheme"` DefaultSourceValue string `json:"default_source_value"` AllowOverrideSource bool `json:"allow_override_source"` DefaultDestinationScheme ParameterDestinationScheme `json:"default_destination_scheme"` AllowOverrideDestination bool `json:"allow_override_destination"` DefaultRefresh string `json:"default_refresh"` RedisplayValue bool `json:"redisplay_value"` ValidationError string `json:"validation_error"` ValidationCondition string `json:"validation_condition"` ValidationTypeSystem string `json:"validation_type_system"` ValidationValueType string `json:"validation_value_type"` // This is a special array of items provided if the validation condition // explicitly states the value must be one of a set. ValidationContains []string `json:"validation_contains,omitempty"` }
type ParameterScope ¶
type ParameterScope string
const ( ParameterTemplate ParameterScope = "template" ParameterWorkspace ParameterScope = "workspace" ParameterImportJob ParameterScope = "import_job" )
type ParameterSourceScheme ¶ added in v0.6.0
type ParameterSourceScheme string
const ( ParameterSourceSchemeNone ParameterSourceScheme = "none" ParameterSourceSchemeData ParameterSourceScheme = "data" )
type ParameterTypeSystem ¶ added in v0.6.0
type ParameterTypeSystem string
const ( ParameterTypeSystemNone ParameterTypeSystem = "none" ParameterTypeSystemHCL ParameterTypeSystem = "hcl" )
type ProvisionerDaemon ¶
type ProvisionerJob ¶
type ProvisionerJob struct { ID uuid.UUID `json:"id"` CreatedAt time.Time `json:"created_at"` StartedAt *time.Time `json:"started_at,omitempty"` CompletedAt *time.Time `json:"completed_at,omitempty"` Error string `json:"error,omitempty"` Status ProvisionerJobStatus `json:"status"` WorkerID *uuid.UUID `json:"worker_id,omitempty"` StorageSource string `json:"storage_source"` }
type ProvisionerJobLog ¶
type ProvisionerJobStatus ¶
type ProvisionerJobStatus string
ProvisionerJobStatus represents the at-time state of a job.
const ( ProvisionerJobPending ProvisionerJobStatus = "pending" ProvisionerJobRunning ProvisionerJobStatus = "running" ProvisionerJobSucceeded ProvisionerJobStatus = "succeeded" ProvisionerJobCanceling ProvisionerJobStatus = "canceling" ProvisionerJobCanceled ProvisionerJobStatus = "canceled" ProvisionerJobFailed ProvisionerJobStatus = "failed" )
func (ProvisionerJobStatus) Active ¶ added in v0.4.4
func (p ProvisionerJobStatus) Active() bool
Active returns whether the job is still active or not. It returns true if canceling as well, since the job isn't in an entirely inactive state yet.
type ProvisionerStorageMethod ¶ added in v0.6.0
type ProvisionerStorageMethod string
const (
ProvisionerStorageMethodFile ProvisionerStorageMethod = "file"
)
type ProvisionerType ¶ added in v0.6.0
type ProvisionerType string
const ( ProvisionerTypeEcho ProvisionerType = "echo" ProvisionerTypeTerraform ProvisionerType = "terraform" )
type PutExtendWorkspaceRequest ¶ added in v0.6.1
PutExtendWorkspaceRequest is a request to extend the deadline of the active workspace build.
type Response ¶ added in v0.7.12
type Response struct { // Message is an actionable message that depicts actions the request took. // These messages should be fully formed sentences with proper punctuation. // Examples: // - "A user has been created." // - "Failed to create a user." Message string `json:"message"` // Detail is a debug message that provides further insight into why the // action failed. This information can be technical and a regular golang // err.Error() text. // - "database: too many open connections" // - "stat: too many open files" Detail string `json:"detail,omitempty"` // Validations are form field-specific friendly error messages. They will be // shown on a form field in the UI. These can also be used to add additional // context if there is a set of errors in the primary 'Message'. Validations []ValidationError `json:"validations,omitempty"` }
Response represents a generic HTTP response.
type Template ¶ added in v0.4.0
type Template struct { ID uuid.UUID `json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` OrganizationID uuid.UUID `json:"organization_id"` Name string `json:"name"` Provisioner ProvisionerType `json:"provisioner"` ActiveVersionID uuid.UUID `json:"active_version_id"` WorkspaceOwnerCount uint32 `json:"workspace_owner_count"` Description string `json:"description"` Icon string `json:"icon"` MaxTTLMillis int64 `json:"max_ttl_ms"` MinAutostartIntervalMillis int64 `json:"min_autostart_interval_ms"` CreatedByID uuid.UUID `json:"created_by_id"` CreatedByName string `json:"created_by_name"` }
Template is the JSON representation of a Coder template. This type matches the database object for now, but is abstracted for ease of change later on.
type TemplateVersion ¶ added in v0.4.0
type TemplateVersion struct { ID uuid.UUID `json:"id"` TemplateID *uuid.UUID `json:"template_id,omitempty"` OrganizationID uuid.UUID `json:"organization_id,omitempty"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Name string `json:"name"` Job ProvisionerJob `json:"job"` Readme string `json:"readme"` CreatedByID uuid.UUID `json:"created_by_id"` CreatedByName string `json:"created_by_name"` }
TemplateVersion represents a single version of a template.
type TemplateVersionsByTemplateRequest ¶ added in v0.5.6
type TemplateVersionsByTemplateRequest struct { TemplateID uuid.UUID `json:"template_id" validate:"required"` Pagination }
TemplateVersionsByTemplateRequest defines the request parameters for TemplateVersionsByTemplate.
type UpdateActiveTemplateVersion ¶ added in v0.4.0
type UpdateRoles ¶ added in v0.5.2
type UpdateRoles struct {
Roles []string `json:"roles" validate:""`
}
type UpdateTemplateMeta ¶ added in v0.6.3
type UpdateTemplateMeta struct { Name string `json:"name,omitempty" validate:"omitempty,username"` Description string `json:"description,omitempty"` Icon string `json:"icon,omitempty"` MaxTTLMillis int64 `json:"max_ttl_ms,omitempty"` MinAutostartIntervalMillis int64 `json:"min_autostart_interval_ms,omitempty"` }
type UpdateUserPasswordRequest ¶ added in v0.5.5
type UpdateUserProfileRequest ¶ added in v0.4.2
type UpdateUserProfileRequest struct {
Username string `json:"username" validate:"required,username"`
}
type UpdateWorkspaceAutostartRequest ¶ added in v0.4.1
type UpdateWorkspaceAutostartRequest struct {
Schedule *string `json:"schedule"`
}
UpdateWorkspaceAutostartRequest is a request to update a workspace's autostart schedule.
type UpdateWorkspaceRequest ¶ added in v0.8.7
type UpdateWorkspaceRequest struct {
Name string `json:"name,omitempty" validate:"username"`
}
type UpdateWorkspaceTTLRequest ¶ added in v0.6.0
type UpdateWorkspaceTTLRequest struct {
TTLMillis *int64 `json:"ttl_ms"`
}
UpdateWorkspaceTTLRequest is a request to update a workspace's TTL.
type UploadResponse ¶
type UploadResponse struct {
Hash string `json:"hash"`
}
UploadResponse contains the hash to reference the uploaded file.
type User ¶
type User struct { ID uuid.UUID `json:"id" validate:"required" table:"id"` Username string `json:"username" validate:"required" table:"username"` Email string `json:"email" validate:"required" table:"email"` CreatedAt time.Time `json:"created_at" validate:"required" table:"created at"` Status UserStatus `json:"status" table:"status"` OrganizationIDs []uuid.UUID `json:"organization_ids"` Roles []Role `json:"roles"` }
User represents a user in Coder.
type UserAuthorization ¶ added in v0.5.7
type UserAuthorization struct { // Object can represent a "set" of objects, such as: // - All workspaces in an organization // - All workspaces owned by me // - All workspaces across the entire product // When defining an object, use the most specific language when possible to // produce the smallest set. Meaning to set as many fields on 'Object' as // you can. Example, if you want to check if you can update all workspaces // owned by 'me', try to also add an 'OrganizationID' to the settings. // Omitting the 'OrganizationID' could produce the incorrect value, as // workspaces have both `user` and `organization` owners. Object UserAuthorizationObject `json:"object"` // Action can be 'create', 'read', 'update', or 'delete' Action string `json:"action"` }
UserAuthorization is used to check if a user can do a given action to a given set of objects.
type UserAuthorizationObject ¶ added in v0.5.7
type UserAuthorizationObject struct { // ResourceType is the name of the resource. // './coderd/rbac/object.go' has the list of valid resource types. ResourceType string `json:"resource_type"` // OwnerID (optional) is a user_id. It adds the set constraint to all resources owned // by a given user. OwnerID string `json:"owner_id,omitempty"` // OrganizationID (optional) is an organization_id. It adds the set constraint to // all resources owned by a given organization. OrganizationID string `json:"organization_id,omitempty"` // ResourceID (optional) reduces the set to a singular resource. This assigns // a resource ID to the resource type, eg: a single workspace. // The rbac library will not fetch the resource from the database, so if you // are using this option, you should also set the 'OwnerID' and 'OrganizationID' // if possible. Be as specific as possible using all the fields relevant. ResourceID string `json:"resource_id,omitempty"` }
type UserAuthorizationRequest ¶ added in v0.5.7
type UserAuthorizationRequest 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]UserAuthorization `json:"checks"` }
UserAuthorizationRequest is a structure instead of a map because go-playground/validate can only validate structs. If you attempt to pass a map into 'httpapi.Read', you will get an invalid type error.
type UserAuthorizationResponse ¶ added in v0.5.7
type UserStatus ¶ added in v0.5.1
type UserStatus string
const ( UserStatusActive UserStatus = "active" UserStatusSuspended UserStatus = "suspended" )
type UsersRequest ¶ added in v0.4.4
type UsersRequest struct { Search string `json:"search,omitempty" typescript:"-"` // Filter users by status. Status UserStatus `json:"status,omitempty" typescript:"-"` // Filter users that have the given role. Role string `json:"role,omitempty" typescript:"-"` SearchQuery string `json:"q,omitempty"` Pagination }
type ValidationError ¶ added in v0.7.12
type ValidationError struct { Field string `json:"field" validate:"required"` Detail string `json:"detail" validate:"required"` }
ValidationError represents a scoped error to a user input.
func (ValidationError) Error ¶ added in v0.8.2
func (e ValidationError) Error() string
type Workspace ¶
type Workspace struct { ID uuid.UUID `json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` OwnerID uuid.UUID `json:"owner_id"` OwnerName string `json:"owner_name"` TemplateID uuid.UUID `json:"template_id"` TemplateName string `json:"template_name"` TemplateIcon string `json:"template_icon"` LatestBuild WorkspaceBuild `json:"latest_build"` Outdated bool `json:"outdated"` Name string `json:"name"` AutostartSchedule *string `json:"autostart_schedule,omitempty"` TTLMillis *int64 `json:"ttl_ms,omitempty"` }
Workspace is a deployment of a template. It references a specific version and can be updated.
type WorkspaceAgent ¶
type WorkspaceAgent struct { ID uuid.UUID `json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` FirstConnectedAt *time.Time `json:"first_connected_at,omitempty"` LastConnectedAt *time.Time `json:"last_connected_at,omitempty"` DisconnectedAt *time.Time `json:"disconnected_at,omitempty"` Status WorkspaceAgentStatus `json:"status"` Name string `json:"name"` ResourceID uuid.UUID `json:"resource_id"` InstanceID string `json:"instance_id,omitempty"` Architecture string `json:"architecture"` EnvironmentVariables map[string]string `json:"environment_variables"` OperatingSystem string `json:"operating_system"` StartupScript string `json:"startup_script,omitempty"` Directory string `json:"directory,omitempty"` Apps []WorkspaceApp `json:"apps"` WireguardPublicKey key.NodePublic `json:"wireguard_public_key"` DiscoPublicKey key.DiscoPublic `json:"disco_public_key"` IPv6 netaddr.IPPrefix `json:"ipv6"` }
type WorkspaceAgentAuthenticateResponse ¶
type WorkspaceAgentAuthenticateResponse struct {
SessionToken string `json:"session_token"`
}
WorkspaceAgentAuthenticateResponse is returned when an instance ID has been exchanged for a session token.
type WorkspaceAgentInstanceMetadata ¶
type WorkspaceAgentInstanceMetadata struct { JailOrchestrator string `json:"jail_orchestrator"` OperatingSystem string `json:"operating_system"` Platform string `json:"platform"` PlatformFamily string `json:"platform_family"` KernelVersion string `json:"kernel_version"` KernelArchitecture string `json:"kernel_architecture"` Cloud string `json:"cloud"` Jail string `json:"jail"` VNC bool `json:"vnc"` }
type WorkspaceAgentStatus ¶
type WorkspaceAgentStatus string
const ( WorkspaceAgentConnecting WorkspaceAgentStatus = "connecting" WorkspaceAgentConnected WorkspaceAgentStatus = "connected" WorkspaceAgentDisconnected WorkspaceAgentStatus = "disconnected" )
type WorkspaceApp ¶ added in v0.6.2
type WorkspaceApp struct { ID uuid.UUID `json:"id"` // Name is a unique identifier attached to an agent. Name string `json:"name"` Command string `json:"command,omitempty"` // Icon is a relative path or external URL that specifies // an icon to be displayed in the dashboard. Icon string `json:"icon,omitempty"` }
type WorkspaceBuild ¶
type WorkspaceBuild struct { ID uuid.UUID `json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` WorkspaceID uuid.UUID `json:"workspace_id"` WorkspaceName string `json:"workspace_name"` WorkspaceOwnerID uuid.UUID `json:"workspace_owner_id"` WorkspaceOwnerName string `json:"workspace_owner_name"` TemplateVersionID uuid.UUID `json:"template_version_id"` BuildNumber int32 `json:"build_number"` Name string `json:"name"` Transition WorkspaceTransition `json:"transition"` InitiatorID uuid.UUID `json:"initiator_id"` InitiatorUsername string `json:"initiator_name"` Job ProvisionerJob `json:"job"` Deadline NullTime `json:"deadline,omitempty"` Reason BuildReason `db:"reason" json:"reason"` }
WorkspaceBuild is an at-point representation of a workspace state. BuildNumbers start at 1 and increase by 1 for each subsequent build
type WorkspaceBuildsRequest ¶ added in v0.6.0
type WorkspaceBuildsRequest struct { WorkspaceID uuid.UUID Pagination }
type WorkspaceFilter ¶ added in v0.6.0
type WorkspaceFilter struct { // Owner can be "me" or a username Owner string `json:"owner,omitempty" typescript:"-"` // Template is a template name Template string `json:"template,omitempty" typescript:"-"` // Name will return partial matches Name string `json:"name,omitempty" typescript:"-"` // FilterQuery supports a raw filter query string FilterQuery string `json:"q,omitempty"` }
type WorkspaceOptions ¶ added in v0.6.3
type WorkspaceOptions struct {
IncludeDeleted bool `json:"include_deleted,omitempty"`
}
type WorkspaceResource ¶
type WorkspaceResource struct { ID uuid.UUID `json:"id"` CreatedAt time.Time `json:"created_at"` JobID uuid.UUID `json:"job_id"` Transition WorkspaceTransition `json:"workspace_transition"` Type string `json:"type"` Name string `json:"name"` Agents []WorkspaceAgent `json:"agents,omitempty"` Metadata []WorkspaceResourceMetadata `json:"metadata,omitempty"` }
type WorkspaceResourceMetadata ¶ added in v0.8.3
type WorkspaceTransition ¶ added in v0.6.0
type WorkspaceTransition string
const ( WorkspaceTransitionStart WorkspaceTransition = "start" WorkspaceTransitionStop WorkspaceTransition = "stop" WorkspaceTransitionDelete WorkspaceTransition = "delete" )
Source Files ¶
- buildinfo.go
- client.go
- error.go
- features.go
- files.go
- gitsshkey.go
- licenses.go
- organizationmember.go
- organizations.go
- pagination.go
- parameters.go
- provisionerdaemons.go
- roles.go
- templates.go
- templateversions.go
- time.go
- users.go
- workspaceagents.go
- workspaceapps.go
- workspacebuilds.go
- workspacedisplaystatus.go
- workspaceresources.go
- workspaces.go