Documentation ¶
Overview ¶
Package coder provides simple APIs for integrating Go applications with Coder Enterprise.
Index ¶
- Constants
- Variables
- func String(s string) *string
- type APIError
- type APIErrorMsg
- type APIToken
- type AuthProviderType
- type BuildLog
- type BuildLogFollowMsg
- type BuildLogType
- type Client
- type ClientOptions
- type ConfigAuth
- type ConfigExtensionMarketplace
- type ConfigOAuth
- type ConfigOAuthBitbucketServer
- type ConfigOAuthGitHub
- type ConfigOAuthGitLab
- type ConfigOIDC
- type ConfigSAML
- type CreateAPITokenReq
- type CreateDevURLReq
- type CreateEnvironmentRequest
- type CreateImageTagReq
- type CreateOrganizationReq
- type CreateUserReq
- type CreateWorkspaceProviderReq
- type CreateWorkspaceProviderRes
- type DefaultClient
- func (c *DefaultClient) APITokenByID(ctx context.Context, userID, tokenID string) (*APIToken, error)
- func (c *DefaultClient) APITokens(ctx context.Context, userID string) ([]APIToken, error)
- func (c *DefaultClient) APIVersion(ctx context.Context) (string, error)
- func (c *DefaultClient) BaseURL() url.URL
- func (c *DefaultClient) CreateAPIToken(ctx context.Context, userID string, req CreateAPITokenReq) (token string, _ error)
- func (c *DefaultClient) CreateDevURL(ctx context.Context, envID string, req CreateDevURLReq) error
- func (c *DefaultClient) CreateEnvironment(ctx context.Context, req CreateEnvironmentRequest) (*Environment, error)
- func (c *DefaultClient) CreateEnvironmentFromRepo(ctx context.Context, orgID string, req TemplateVersion) (*Environment, error)
- func (c *DefaultClient) CreateImageTag(ctx context.Context, imageID string, req CreateImageTagReq) (*ImageTag, error)
- func (c *DefaultClient) CreateOrganization(ctx context.Context, req CreateOrganizationReq) error
- func (c *DefaultClient) CreateUser(ctx context.Context, req CreateUserReq) error
- func (c *DefaultClient) CreateWorkspaceProvider(ctx context.Context, req CreateWorkspaceProviderReq) (*CreateWorkspaceProviderRes, error)
- func (c *DefaultClient) DeleteAPIToken(ctx context.Context, userID, tokenID string) error
- func (c *DefaultClient) DeleteDevURL(ctx context.Context, envID, urlID string) error
- func (c *DefaultClient) DeleteEnvironment(ctx context.Context, envID string) error
- func (c *DefaultClient) DeleteImageTag(ctx context.Context, imageID, tag string) error
- func (c *DefaultClient) DeleteOrganization(ctx context.Context, orgID string) error
- func (c *DefaultClient) DeleteRegistry(ctx context.Context, registryID string) error
- func (c *DefaultClient) DeleteUser(ctx context.Context, userID string) error
- func (c *DefaultClient) DeleteWorkspaceProviderByID(ctx context.Context, id string) error
- func (c *DefaultClient) DevURLs(ctx context.Context, envID string) ([]DevURL, error)
- func (c *DefaultClient) DialEnvironmentBuildLog(ctx context.Context, envID string) (*websocket.Conn, error)
- func (c *DefaultClient) DialEnvironmentStats(ctx context.Context, envID string) (*websocket.Conn, error)
- func (c *DefaultClient) DialExecutor(ctx context.Context, baseURL *url.URL, envID string) (wsep.Execer, error)
- func (c *DefaultClient) DialIDEStatus(ctx context.Context, baseURL *url.URL, envID string) (*websocket.Conn, error)
- func (c *DefaultClient) DialResourceLoad(ctx context.Context, envID string) (*websocket.Conn, error)
- func (c *DefaultClient) DialWsep(ctx context.Context, baseURL *url.URL, envID string) (*websocket.Conn, error)
- func (c *DefaultClient) EditEnvironment(ctx context.Context, envID string, req UpdateEnvironmentReq) error
- func (c *DefaultClient) EnvironmentByID(ctx context.Context, id string) (*Environment, error)
- func (c *DefaultClient) Environments(ctx context.Context) ([]Environment, error)
- func (c *DefaultClient) EnvironmentsByWorkspaceProvider(ctx context.Context, wpID string) ([]Environment, error)
- func (c *DefaultClient) FollowEnvironmentBuildLog(ctx context.Context, envID string) (<-chan BuildLogFollowMsg, error)
- func (c *DefaultClient) ImageByID(ctx context.Context, id string) (*Image, error)
- func (c *DefaultClient) ImageTagByID(ctx context.Context, imageID, tagID string) (*ImageTag, error)
- func (c *DefaultClient) ImageTags(ctx context.Context, imageID string) ([]ImageTag, error)
- func (c *DefaultClient) ImportImage(ctx context.Context, req ImportImageReq) (*Image, error)
- func (c *DefaultClient) Me(ctx context.Context) (*User, error)
- func (c *DefaultClient) OrganizationByID(ctx context.Context, orgID string) (*Organization, error)
- func (c *DefaultClient) OrganizationImages(ctx context.Context, orgID string) ([]Image, error)
- func (c *DefaultClient) OrganizationMembers(ctx context.Context, orgID string) ([]OrganizationUser, error)
- func (c *DefaultClient) Organizations(ctx context.Context) ([]Organization, error)
- func (c *DefaultClient) ParseTemplate(ctx context.Context, req ParseTemplateRequest) (*TemplateVersion, error)
- func (c *DefaultClient) PushActivity(ctx context.Context, source, envID string) error
- func (c *DefaultClient) PutDevURL(ctx context.Context, envID, urlID string, req PutDevURLReq) error
- func (c *DefaultClient) PutSiteConfigAuth(ctx context.Context, req ConfigAuth) error
- func (c *DefaultClient) PutSiteConfigExtensionMarketplace(ctx context.Context, req ConfigExtensionMarketplace) error
- func (c *DefaultClient) PutSiteConfigOAuth(ctx context.Context, req ConfigOAuth) error
- func (c *DefaultClient) RebuildEnvironment(ctx context.Context, envID string) error
- func (c *DefaultClient) RegenerateAPIToken(ctx context.Context, userID, tokenID string) (token string, _ error)
- func (c *DefaultClient) Registries(ctx context.Context, orgID string) ([]Registry, error)
- func (c *DefaultClient) RegistryByID(ctx context.Context, registryID string) (*Registry, error)
- func (c *DefaultClient) SSHKey(ctx context.Context) (*SSHKey, error)
- func (c *DefaultClient) SiteConfigAuth(ctx context.Context) (*ConfigAuth, error)
- func (c *DefaultClient) SiteConfigExtensionMarketplace(ctx context.Context) (*ConfigExtensionMarketplace, error)
- func (c *DefaultClient) SiteConfigOAuth(ctx context.Context) (*ConfigOAuth, error)
- func (c *DefaultClient) SiteSetupModeEnabled(ctx context.Context) (bool, error)
- func (c *DefaultClient) StopEnvironment(ctx context.Context, envID string) error
- func (c *DefaultClient) Token() string
- func (c *DefaultClient) UpdateImage(ctx context.Context, imageID string, req UpdateImageReq) error
- func (c *DefaultClient) UpdateImageTags(ctx context.Context, imageID string) error
- func (c *DefaultClient) UpdateOrganization(ctx context.Context, orgID string, req UpdateOrganizationReq) error
- func (c *DefaultClient) UpdateRegistry(ctx context.Context, registryID string, req UpdateRegistryReq) error
- func (c *DefaultClient) UpdateUXState(ctx context.Context, userID string, uxsPartial map[string]interface{}) error
- func (c *DefaultClient) UpdateUser(ctx context.Context, userID string, req UpdateUserReq) error
- func (c *DefaultClient) UserByEmail(ctx context.Context, email string) (*User, error)
- func (c *DefaultClient) UserByID(ctx context.Context, id string) (*User, error)
- func (c *DefaultClient) UserEnvironmentsByOrganization(ctx context.Context, userID, orgID string) ([]Environment, error)
- func (c *DefaultClient) Users(ctx context.Context) ([]User, error)
- func (c *DefaultClient) WaitForEnvironmentReady(ctx context.Context, envID string) error
- func (c *DefaultClient) WorkspaceProviderByID(ctx context.Context, id string) (*KubernetesProvider, error)
- func (c *DefaultClient) WorkspaceProviders(ctx context.Context) (*WorkspaceProviders, error)
- type DevURL
- type Duration
- type Environment
- type EnvironmentStat
- type EnvironmentStatus
- type ExtensionMarketplaceType
- type HTTPError
- type Image
- type ImageTag
- type ImportImageReq
- type KubeProviderConfig
- type KubernetesProvider
- type LoginRequest
- type LoginResponse
- type LoginType
- type NewRegistryRequest
- type OSRelease
- type Organization
- type OrganizationUser
- type ParseTemplateRequest
- type PutDevURLReq
- type RebuildMessage
- type Registry
- type Role
- type SSHKey
- type TemplateVersion
- type UpdateEnvironmentReq
- type UpdateImageReq
- type UpdateOrganizationReq
- type UpdateRegistryReq
- type UpdateUserReq
- type User
- type UserPasswordSettings
- type WorkspaceProviderStatus
- type WorkspaceProviderType
- type WorkspaceProviders
Constants ¶
const MarketplaceExtensionPublicURL = "https://extensions.coder.com/api"
MarketplaceExtensionPublicURL is the URL of the coder.com public marketplace that serves open source Code OSS extensions.
const Me = "me"
Me is the user ID of the authenticated user.
Variables ¶
var ErrAuthentication = xerrors.New("invalid authentication")
ErrAuthentication describes the error case in which the requester has invalid authentication.
var ErrNotFound = xerrors.New("resource not found")
ErrNotFound describes an error case in which the requested resource could not be found.
var ErrPermissions = xerrors.New("insufficient permissions")
ErrPermissions describes an error case in which the requester has insufficient permissions to access the requested resource.
Functions ¶
Types ¶
type APIError ¶ added in v1.12.1
type APIError struct {
Err APIErrorMsg `json:"error"`
}
APIError is the expected payload format for API errors.
type APIErrorMsg ¶ added in v1.17.0
type APIErrorMsg struct { Msg string `json:"msg"` Code string `json:"code"` Details json.RawMessage `json:"details"` }
APIErrorMsg contains the rich error information returned by API errors.
type APIToken ¶ added in v1.13.0
type APIToken struct { ID string `json:"id"` Name string `json:"name"` Application bool `json:"application"` UserID string `json:"user_id"` LastUsed time.Time `json:"last_used"` }
APIToken describes a Coder Enterprise APIToken resource for use in API requests.
type AuthProviderType ¶ added in v1.13.0
type AuthProviderType string
AuthProviderType is an enum of each valid auth provider.
const ( AuthProviderBuiltIn AuthProviderType = "built-in" AuthProviderSAML AuthProviderType = "saml" AuthProviderOIDC AuthProviderType = "oidc" )
AuthProviderType enum.
type BuildLog ¶ added in v1.12.0
type BuildLog struct { ID string `db:"id" json:"id"` EnvironmentID string `db:"environment_id" json:"environment_id"` // BuildID allows the frontend to separate the logs from the old build with the logs from the new. BuildID string `db:"build_id" json:"build_id"` Time time.Time `db:"time" json:"time"` Type BuildLogType `db:"type" json:"type"` Msg string `db:"msg" json:"msg"` }
BuildLog defines a build log record for a Coder environment.
type BuildLogFollowMsg ¶ added in v1.12.0
BuildLogFollowMsg wraps the base BuildLog and adds a field for collecting errors that may occur when follow or parsing.
type BuildLogType ¶ added in v1.11.0
type BuildLogType string
BuildLogType describes the type of an event.
const ( // BuildLogTypeStart signals that a new build log has begun. BuildLogTypeStart BuildLogType = "start" // BuildLogTypeStage is a stage-level event for an environment. // It can be thought of as a major step in the environment's // lifecycle. BuildLogTypeStage BuildLogType = "stage" // BuildLogTypeError describes an error that has occurred. BuildLogTypeError BuildLogType = "error" // BuildLogTypeSubstage describes a subevent that occurs as // part of a stage. This can be the output from a user's // personalization script, or a long running command. BuildLogTypeSubstage BuildLogType = "substage" // BuildLogTypeDone signals that the build has completed. BuildLogTypeDone BuildLogType = "done" )
type Client ¶
type Client interface { // PushActivity pushes CLI activity to Coder. PushActivity(ctx context.Context, source, envID string) error // Me gets the details of the authenticated user. Me(ctx context.Context) (*User, error) // UserByID get the details of a user by their id. UserByID(ctx context.Context, id string) (*User, error) // SSHKey gets the current SSH kepair of the authenticated user. SSHKey(ctx context.Context) (*SSHKey, error) // Users gets the list of user accounts. Users(ctx context.Context) ([]User, error) // UserByEmail gets a user by email. UserByEmail(ctx context.Context, email string) (*User, error) // UpdateUser applyes the partial update to the given user. UpdateUser(ctx context.Context, userID string, req UpdateUserReq) error // UpdateUXState applies a partial update of the user's UX State. UpdateUXState(ctx context.Context, userID string, uxsPartial map[string]interface{}) error // CreateUser creates a new user account. CreateUser(ctx context.Context, req CreateUserReq) error // DeleteUser deletes a user account. DeleteUser(ctx context.Context, userID string) error // SiteConfigAuth fetches the sitewide authentication configuration. SiteConfigAuth(ctx context.Context) (*ConfigAuth, error) // PutSiteConfigAuth sets the sitewide authentication configuration. PutSiteConfigAuth(ctx context.Context, req ConfigAuth) error // SiteConfigOAuth fetches the sitewide git provider OAuth configuration. SiteConfigOAuth(ctx context.Context) (*ConfigOAuth, error) // PutSiteConfigOAuth sets the sitewide git provider OAuth configuration. PutSiteConfigOAuth(ctx context.Context, req ConfigOAuth) error // SiteSetupModeEnabled fetches the current setup_mode state of a Coder Enterprise deployment. SiteSetupModeEnabled(ctx context.Context) (bool, error) // SiteConfigExtensionMarketplace fetches the extension marketplace configuration. SiteConfigExtensionMarketplace(ctx context.Context) (*ConfigExtensionMarketplace, error) // PutSiteConfigExtensionMarketplace sets the extension marketplace configuration. PutSiteConfigExtensionMarketplace(ctx context.Context, req ConfigExtensionMarketplace) error // DeleteDevURL deletes the specified devurl. DeleteDevURL(ctx context.Context, envID, urlID string) error // CreateDevURL inserts a new devurl for the authenticated user. CreateDevURL(ctx context.Context, envID string, req CreateDevURLReq) error // DevURLs fetches the Dev URLs for a given environment. DevURLs(ctx context.Context, envID string) ([]DevURL, error) // PutDevURL updates an existing devurl for the authenticated user. PutDevURL(ctx context.Context, envID, urlID string, req PutDevURLReq) error // CreateEnvironment sends a request to create an environment. CreateEnvironment(ctx context.Context, req CreateEnvironmentRequest) (*Environment, error) // ParseTemplate parses a template config. It support both remote repositories and local files. // If a local file is specified then all other values in the request are ignored. ParseTemplate(ctx context.Context, req ParseTemplateRequest) (*TemplateVersion, error) // CreateEnvironmentFromRepo sends a request to create an environment from a repository. CreateEnvironmentFromRepo(ctx context.Context, orgID string, req TemplateVersion) (*Environment, error) // Environments lists environments returned by the given filter. Environments(ctx context.Context) ([]Environment, error) // UserEnvironmentsByOrganization gets the list of environments owned by the given user. UserEnvironmentsByOrganization(ctx context.Context, userID, orgID string) ([]Environment, error) // DeleteEnvironment deletes the environment. DeleteEnvironment(ctx context.Context, envID string) error // StopEnvironment stops the environment. StopEnvironment(ctx context.Context, envID string) error // RebuildEnvironment requests that the given envID is rebuilt with no changes to its specification. RebuildEnvironment(ctx context.Context, envID string) error // EditEnvironment modifies the environment specification and initiates a rebuild. EditEnvironment(ctx context.Context, envID string, req UpdateEnvironmentReq) error // DialWsep dials an environments command execution interface // See https://github.com/cdr/wsep for details. DialWsep(ctx context.Context, baseURL *url.URL, envID string) (*websocket.Conn, error) // DialExecutor gives a remote execution interface for performing commands inside an environment. DialExecutor(ctx context.Context, baseURL *url.URL, envID string) (wsep.Execer, error) // DialIDEStatus opens a websocket connection for cpu load metrics on the environment. DialIDEStatus(ctx context.Context, baseURL *url.URL, envID string) (*websocket.Conn, error) // DialEnvironmentBuildLog opens a websocket connection for the environment build log messages. DialEnvironmentBuildLog(ctx context.Context, envID string) (*websocket.Conn, error) // FollowEnvironmentBuildLog trails the build log of a Coder environment. FollowEnvironmentBuildLog(ctx context.Context, envID string) (<-chan BuildLogFollowMsg, error) // DialEnvironmentStats opens a websocket connection for environment stats. DialEnvironmentStats(ctx context.Context, envID string) (*websocket.Conn, error) // DialResourceLoad opens a websocket connection for cpu load metrics on the environment. DialResourceLoad(ctx context.Context, envID string) (*websocket.Conn, error) // WaitForEnvironmentReady will watch the build log and return when done. WaitForEnvironmentReady(ctx context.Context, envID string) error // EnvironmentByID get the details of an environment by its id. EnvironmentByID(ctx context.Context, id string) (*Environment, error) // EnvironmentsByWorkspaceProvider returns environments that belong to a particular workspace provider. EnvironmentsByWorkspaceProvider(ctx context.Context, wpID string) ([]Environment, error) // ImportImage creates a new image and optionally a new registry. ImportImage(ctx context.Context, req ImportImageReq) (*Image, error) // ImageByID returns an image entity, fetched by its ID. ImageByID(ctx context.Context, id string) (*Image, error) // OrganizationImages returns all of the images imported for orgID. OrganizationImages(ctx context.Context, orgID string) ([]Image, error) // UpdateImage applies a partial update to an image resource. UpdateImage(ctx context.Context, imageID string, req UpdateImageReq) error // UpdateImageTags refreshes the latest digests for all tags of the image. UpdateImageTags(ctx context.Context, imageID string) error // Organizations gets all Organizations. Organizations(ctx context.Context) ([]Organization, error) // OrganizationByID get the Organization by its ID. OrganizationByID(ctx context.Context, orgID string) (*Organization, error) // OrganizationMembers get all members of the given organization. OrganizationMembers(ctx context.Context, orgID string) ([]OrganizationUser, error) // UpdateOrganization applys a partial update of an Organization resource. UpdateOrganization(ctx context.Context, orgID string, req UpdateOrganizationReq) error // CreateOrganization creates a new Organization in Coder Enterprise. CreateOrganization(ctx context.Context, req CreateOrganizationReq) error // DeleteOrganization deletes an organization. DeleteOrganization(ctx context.Context, orgID string) error // Registries fetches all registries in an organization. Registries(ctx context.Context, orgID string) ([]Registry, error) // RegistryByID fetches a registry resource by its ID. RegistryByID(ctx context.Context, registryID string) (*Registry, error) // UpdateRegistry applies a partial update to a registry resource. UpdateRegistry(ctx context.Context, registryID string, req UpdateRegistryReq) error // DeleteRegistry deletes a registry resource by its ID. DeleteRegistry(ctx context.Context, registryID string) error // CreateImageTag creates a new image tag resource. CreateImageTag(ctx context.Context, imageID string, req CreateImageTagReq) (*ImageTag, error) // DeleteImageTag deletes an image tag resource. DeleteImageTag(ctx context.Context, imageID, tag string) error // ImageTags fetch all image tags. ImageTags(ctx context.Context, imageID string) ([]ImageTag, error) // ImageTagByID fetch an image tag by ID. ImageTagByID(ctx context.Context, imageID, tagID string) (*ImageTag, error) // CreateAPIToken creates a new APIToken for making authenticated requests to Coder Enterprise. CreateAPIToken(ctx context.Context, userID string, req CreateAPITokenReq) (string, error) // APITokens fetches all APITokens owned by the given user. APITokens(ctx context.Context, userID string) ([]APIToken, error) // APITokenByID fetches the metadata for a given APIToken. APITokenByID(ctx context.Context, userID, tokenID string) (*APIToken, error) // DeleteAPIToken deletes an APIToken. DeleteAPIToken(ctx context.Context, userID, tokenID string) error // RegenerateAPIToken regenerates the given APIToken and returns the new value. RegenerateAPIToken(ctx context.Context, userID, tokenID string) (string, error) // APIVersion parses the coder-version http header from an authenticated request. APIVersion(ctx context.Context) (string, error) // WorkspaceProviderByID fetches a workspace provider entity by its unique ID. WorkspaceProviderByID(ctx context.Context, id string) (*KubernetesProvider, error) // WorkspaceProviders fetches all workspace providers known to the Coder control plane. WorkspaceProviders(ctx context.Context) (*WorkspaceProviders, error) // CreateWorkspaceProvider creates a new WorkspaceProvider entity. CreateWorkspaceProvider(ctx context.Context, req CreateWorkspaceProviderReq) (*CreateWorkspaceProviderRes, error) // DeleteWorkspaceProviderByID deletes a workspace provider entity from the Coder control plane. DeleteWorkspaceProviderByID(ctx context.Context, id string) error // Token returns the API Token used to authenticate. Token() string // BaseURL returns the BaseURL configured for this Client. BaseURL() url.URL }
Client wraps the Coder HTTP API. This is an interface to allow for mocking of coder-sdk client usage.
type ClientOptions ¶ added in v1.17.0
type ClientOptions struct { // BaseURL is the root URL of the Coder installation (required). BaseURL *url.URL // Client is the http.Client to use for requests (optional). // // If omitted, the http.DefaultClient will be used. HTTPClient *http.Client // Token is the API Token used to authenticate (optional). // // If Token is provided, the DefaultClient will use it to // authenticate. If it is not provided, the client requires // another type of credential, such as an Email/Password pair. Token string // Email used to authenticate with Coder. // // If you supply an Email and Password pair, NewClient will // exchange these credentials for a Token during initialization. // This is only applicable for the built-in authentication // provider. The client will not retain these credentials in // memory after NewClient returns. Email string // Password used to authenticate with Coder. // // If you supply an Email and Password pair, NewClient will // exchange these credentials for a Token during initialization. // This is only applicable for the built-in authentication // provider. The client will not retain these credentials in // memory after NewClient returns. Password string }
ClientOptions contains options for the Coder SDK Client.
type ConfigAuth ¶ added in v1.13.0
type ConfigAuth struct { ProviderType *AuthProviderType `json:"provider_type"` OIDC *ConfigOIDC `json:"oidc"` SAML *ConfigSAML `json:"saml"` }
ConfigAuth describes the authentication configuration for a Coder Enterprise deployment.
type ConfigExtensionMarketplace ¶ added in v1.13.0
type ConfigExtensionMarketplace struct { URL string `json:"url"` Type ExtensionMarketplaceType `json:"type"` }
ConfigExtensionMarketplace describes the sitewide extension marketplace configuration.
type ConfigOAuth ¶ added in v1.13.0
type ConfigOAuth struct { BitbucketServer ConfigOAuthBitbucketServer `json:"bitbucket_server"` GitHub ConfigOAuthGitHub `json:"github"` GitLab ConfigOAuthGitLab `json:"gitlab"` }
ConfigOAuth describes the aggregate git integration configuration for a Coder Enterprise deployment.
type ConfigOAuthBitbucketServer ¶ added in v1.13.0
type ConfigOAuthBitbucketServer struct {
BaseURL string `json:"base_url" diff:"oauth.bitbucket_server.base_url"`
}
ConfigOAuthBitbucketServer describes the Bitbucket integration configuration for a Coder Enterprise deployment.
type ConfigOAuthGitHub ¶ added in v1.13.0
type ConfigOAuthGitHub struct { BaseURL string `json:"base_url"` ClientID string `json:"client_id"` ClientSecret string `json:"client_secret"` }
ConfigOAuthGitHub describes the Github integration configuration for a Coder Enterprise deployment.
type ConfigOAuthGitLab ¶ added in v1.13.0
type ConfigOAuthGitLab struct { BaseURL string `json:"base_url"` ClientID string `json:"client_id" ` ClientSecret string `json:"client_secret"` }
ConfigOAuthGitLab describes the GitLab integration configuration for a Coder Enterprise deployment.
type ConfigOIDC ¶ added in v1.13.0
type ConfigOIDC struct { ClientID *string `json:"client_id"` ClientSecret *string `json:"client_secret"` Issuer *string `json:"issuer"` }
ConfigOIDC describes the OIDC configuration for single-signon support in Coder Enterprise.
type ConfigSAML ¶ added in v1.13.0
type ConfigSAML struct { IdentityProviderMetadataURL *string `json:"idp_metadata_url"` SignatureAlgorithm *string `json:"signature_algorithm"` NameIDFormat *string `json:"name_id_format"` PrivateKey *string `json:"private_key"` PublicKeyCertificate *string `json:"public_key_certificate"` }
ConfigSAML describes the SAML configuration values.
type CreateAPITokenReq ¶ added in v1.13.0
type CreateAPITokenReq struct {
Name string `json:"name"`
}
CreateAPITokenReq defines the paramemters for creating a new APIToken.
type CreateDevURLReq ¶ added in v1.13.0
type CreateDevURLReq struct { EnvID string `json:"environment_id"` Port int `json:"port"` Access string `json:"access"` Name string `json:"name"` Scheme string `json:"scheme"` }
CreateDevURLReq defines the request parameters for creating a new DevURL.
type CreateEnvironmentRequest ¶ added in v1.11.0
type CreateEnvironmentRequest struct { Name string `json:"name"` ImageID string `json:"image_id"` OrgID string `json:"org_id"` ImageTag string `json:"image_tag"` CPUCores float32 `json:"cpu_cores"` MemoryGB float32 `json:"memory_gb"` DiskGB int `json:"disk_gb"` GPUs int `json:"gpus"` UseContainerVM bool `json:"use_container_vm"` ResourcePoolID string `json:"resource_pool_id"` Namespace string `json:"namespace"` EnableAutoStart bool `json:"autostart_enabled"` // TemplateID comes from the parse template route on cemanager. TemplateID string `json:"template_id,omitempty"` }
CreateEnvironmentRequest is used to configure a new environment.
type CreateImageTagReq ¶ added in v1.13.0
CreateImageTagReq defines the request parameters for creating a new image tag.
type CreateOrganizationReq ¶ added in v1.13.0
type CreateOrganizationReq struct { Name string `json:"name"` Description string `json:"description"` Default bool `json:"default"` ResourceNamespace string `json:"resource_namespace"` AutoOffThreshold Duration `json:"auto_off_threshold"` CPUProvisioningRate float32 `json:"cpu_provisioning_rate"` MemoryProvisioningRate float32 `json:"memory_provisioning_rate"` }
CreateOrganizationReq describes the request parameters to create a new Organization.
type CreateUserReq ¶ added in v1.13.0
type CreateUserReq struct { Name string `json:"name"` Username string `json:"username"` Email string `json:"email"` Password string `json:"password"` TemporaryPassword bool `json:"temporary_password"` LoginType LoginType `json:"login_type"` OrganizationsIDs []string `json:"organizations"` }
CreateUserReq defines the request parameters for creating a new user resource.
type CreateWorkspaceProviderReq ¶ added in v1.16.0
type CreateWorkspaceProviderReq struct { Name string `json:"name"` Type WorkspaceProviderType `json:"type"` Hostname string `json:"hostname"` ClusterAddress string `json:"cluster_address"` }
CreateWorkspaceProviderReq defines the request parameters for creating a new workspace provider entity.
type CreateWorkspaceProviderRes ¶ added in v1.16.0
type CreateWorkspaceProviderRes struct { ID string `json:"id" table:"ID"` Name string `json:"name" table:"Name"` Status WorkspaceProviderStatus `json:"status" table:"Status"` EnvproxyToken string `json:"envproxy_token" table:"Envproxy Token"` }
CreateWorkspaceProviderRes defines the response from creating a new workspace provider entity.
type DefaultClient ¶ added in v1.17.0
type DefaultClient struct {
// contains filtered or unexported fields
}
DefaultClient is the default implementation of the coder.Client interface.
The empty value is meaningless and the fields are unexported; use NewClient to create an instance.
func NewClient ¶ added in v1.17.0
func NewClient(opts ClientOptions) (*DefaultClient, error)
NewClient creates a new default Coder SDK client.
func (*DefaultClient) APITokenByID ¶ added in v1.17.0
func (c *DefaultClient) APITokenByID(ctx context.Context, userID, tokenID string) (*APIToken, error)
APITokenByID fetches the metadata for a given APIToken.
func (*DefaultClient) APITokens ¶ added in v1.17.0
APITokens fetches all APITokens owned by the given user.
func (*DefaultClient) APIVersion ¶ added in v1.17.0
func (c *DefaultClient) APIVersion(ctx context.Context) (string, error)
APIVersion parses the coder-version http header from an authenticated request.
func (*DefaultClient) BaseURL ¶ added in v1.17.0
func (c *DefaultClient) BaseURL() url.URL
BaseURL returns the BaseURL configured for this Client.
func (*DefaultClient) CreateAPIToken ¶ added in v1.17.0
func (c *DefaultClient) CreateAPIToken(ctx context.Context, userID string, req CreateAPITokenReq) (token string, _ error)
CreateAPIToken creates a new APIToken for making authenticated requests to Coder Enterprise.
func (*DefaultClient) CreateDevURL ¶ added in v1.17.0
func (c *DefaultClient) CreateDevURL(ctx context.Context, envID string, req CreateDevURLReq) error
CreateDevURL inserts a new devurl for the authenticated user.
func (*DefaultClient) CreateEnvironment ¶ added in v1.17.0
func (c *DefaultClient) CreateEnvironment(ctx context.Context, req CreateEnvironmentRequest) (*Environment, error)
CreateEnvironment sends a request to create an environment.
func (*DefaultClient) CreateEnvironmentFromRepo ¶ added in v1.17.0
func (c *DefaultClient) CreateEnvironmentFromRepo(ctx context.Context, orgID string, req TemplateVersion) (*Environment, error)
CreateEnvironmentFromRepo sends a request to create an environment from a repository.
func (*DefaultClient) CreateImageTag ¶ added in v1.17.0
func (c *DefaultClient) CreateImageTag(ctx context.Context, imageID string, req CreateImageTagReq) (*ImageTag, error)
CreateImageTag creates a new image tag resource.
func (*DefaultClient) CreateOrganization ¶ added in v1.17.0
func (c *DefaultClient) CreateOrganization(ctx context.Context, req CreateOrganizationReq) error
CreateOrganization creates a new Organization in Coder Enterprise.
func (*DefaultClient) CreateUser ¶ added in v1.17.0
func (c *DefaultClient) CreateUser(ctx context.Context, req CreateUserReq) error
CreateUser creates a new user account.
func (*DefaultClient) CreateWorkspaceProvider ¶ added in v1.17.0
func (c *DefaultClient) CreateWorkspaceProvider(ctx context.Context, req CreateWorkspaceProviderReq) (*CreateWorkspaceProviderRes, error)
CreateWorkspaceProvider creates a new WorkspaceProvider entity.
func (*DefaultClient) DeleteAPIToken ¶ added in v1.17.0
func (c *DefaultClient) DeleteAPIToken(ctx context.Context, userID, tokenID string) error
DeleteAPIToken deletes an APIToken.
func (*DefaultClient) DeleteDevURL ¶ added in v1.17.0
func (c *DefaultClient) DeleteDevURL(ctx context.Context, envID, urlID string) error
DeleteDevURL deletes the specified devurl.
func (*DefaultClient) DeleteEnvironment ¶ added in v1.17.0
func (c *DefaultClient) DeleteEnvironment(ctx context.Context, envID string) error
DeleteEnvironment deletes the environment.
func (*DefaultClient) DeleteImageTag ¶ added in v1.17.0
func (c *DefaultClient) DeleteImageTag(ctx context.Context, imageID, tag string) error
DeleteImageTag deletes an image tag resource.
func (*DefaultClient) DeleteOrganization ¶ added in v1.17.0
func (c *DefaultClient) DeleteOrganization(ctx context.Context, orgID string) error
DeleteOrganization deletes an organization.
func (*DefaultClient) DeleteRegistry ¶ added in v1.17.0
func (c *DefaultClient) DeleteRegistry(ctx context.Context, registryID string) error
DeleteRegistry deletes a registry resource by its ID.
func (*DefaultClient) DeleteUser ¶ added in v1.17.0
func (c *DefaultClient) DeleteUser(ctx context.Context, userID string) error
DeleteUser deletes a user account.
func (*DefaultClient) DeleteWorkspaceProviderByID ¶ added in v1.17.0
func (c *DefaultClient) DeleteWorkspaceProviderByID(ctx context.Context, id string) error
DeleteWorkspaceProviderByID deletes a workspace provider entity from the Coder control plane.
func (*DefaultClient) DevURLs ¶ added in v1.17.0
DevURLs fetches the Dev URLs for a given environment.
func (*DefaultClient) DialEnvironmentBuildLog ¶ added in v1.17.0
func (c *DefaultClient) DialEnvironmentBuildLog(ctx context.Context, envID string) (*websocket.Conn, error)
DialEnvironmentBuildLog opens a websocket connection for the environment build log messages.
func (*DefaultClient) DialEnvironmentStats ¶ added in v1.17.0
func (c *DefaultClient) DialEnvironmentStats(ctx context.Context, envID string) (*websocket.Conn, error)
DialEnvironmentStats opens a websocket connection for environment stats.
func (*DefaultClient) DialExecutor ¶ added in v1.17.0
func (c *DefaultClient) DialExecutor(ctx context.Context, baseURL *url.URL, envID string) (wsep.Execer, error)
DialExecutor gives a remote execution interface for performing commands inside an environment.
func (*DefaultClient) DialIDEStatus ¶ added in v1.17.0
func (c *DefaultClient) DialIDEStatus(ctx context.Context, baseURL *url.URL, envID string) (*websocket.Conn, error)
DialIDEStatus opens a websocket connection for cpu load metrics on the environment.
func (*DefaultClient) DialResourceLoad ¶ added in v1.17.0
func (c *DefaultClient) DialResourceLoad(ctx context.Context, envID string) (*websocket.Conn, error)
DialResourceLoad opens a websocket connection for cpu load metrics on the environment.
func (*DefaultClient) DialWsep ¶ added in v1.17.0
func (c *DefaultClient) DialWsep(ctx context.Context, baseURL *url.URL, envID string) (*websocket.Conn, error)
DialWsep dials an environments command execution interface See https://github.com/cdr/wsep for details.
func (*DefaultClient) EditEnvironment ¶ added in v1.17.0
func (c *DefaultClient) EditEnvironment(ctx context.Context, envID string, req UpdateEnvironmentReq) error
EditEnvironment modifies the environment specification and initiates a rebuild.
func (*DefaultClient) EnvironmentByID ¶ added in v1.17.0
func (c *DefaultClient) EnvironmentByID(ctx context.Context, id string) (*Environment, error)
EnvironmentByID get the details of an environment by its id.
func (*DefaultClient) Environments ¶ added in v1.17.0
func (c *DefaultClient) Environments(ctx context.Context) ([]Environment, error)
Environments lists environments returned by the given filter. TODO: add the filter options, explore performance issue.
func (*DefaultClient) EnvironmentsByWorkspaceProvider ¶ added in v1.17.0
func (c *DefaultClient) EnvironmentsByWorkspaceProvider(ctx context.Context, wpID string) ([]Environment, error)
EnvironmentsByWorkspaceProvider returns all environments that belong to a particular workspace provider.
func (*DefaultClient) FollowEnvironmentBuildLog ¶ added in v1.17.0
func (c *DefaultClient) FollowEnvironmentBuildLog(ctx context.Context, envID string) (<-chan BuildLogFollowMsg, error)
FollowEnvironmentBuildLog trails the build log of a Coder environment.
func (*DefaultClient) ImageByID ¶ added in v1.17.0
ImageByID returns an image entity, fetched by its ID.
func (*DefaultClient) ImageTagByID ¶ added in v1.17.0
ImageTagByID fetch an image tag by ID.
func (*DefaultClient) ImportImage ¶ added in v1.17.0
func (c *DefaultClient) ImportImage(ctx context.Context, req ImportImageReq) (*Image, error)
ImportImage creates a new image and optionally a new registry.
func (*DefaultClient) Me ¶ added in v1.17.0
func (c *DefaultClient) Me(ctx context.Context) (*User, error)
Me gets the details of the authenticated user.
func (*DefaultClient) OrganizationByID ¶ added in v1.17.0
func (c *DefaultClient) OrganizationByID(ctx context.Context, orgID string) (*Organization, error)
OrganizationByID get the Organization by its ID.
func (*DefaultClient) OrganizationImages ¶ added in v1.17.0
OrganizationImages returns all of the images imported for orgID.
func (*DefaultClient) OrganizationMembers ¶ added in v1.17.0
func (c *DefaultClient) OrganizationMembers(ctx context.Context, orgID string) ([]OrganizationUser, error)
OrganizationMembers get all members of the given organization.
func (*DefaultClient) Organizations ¶ added in v1.17.0
func (c *DefaultClient) Organizations(ctx context.Context) ([]Organization, error)
Organizations gets all Organizations.
func (*DefaultClient) ParseTemplate ¶ added in v1.17.0
func (c *DefaultClient) ParseTemplate(ctx context.Context, req ParseTemplateRequest) (*TemplateVersion, error)
ParseTemplate parses a template config. It support both remote repositories and local files. If a local file is specified then all other values in the request are ignored.
func (*DefaultClient) PushActivity ¶ added in v1.17.0
func (c *DefaultClient) PushActivity(ctx context.Context, source, envID string) error
PushActivity pushes CLI activity to Coder.
func (*DefaultClient) PutDevURL ¶ added in v1.17.0
func (c *DefaultClient) PutDevURL(ctx context.Context, envID, urlID string, req PutDevURLReq) error
PutDevURL updates an existing devurl for the authenticated user.
func (*DefaultClient) PutSiteConfigAuth ¶ added in v1.17.0
func (c *DefaultClient) PutSiteConfigAuth(ctx context.Context, req ConfigAuth) error
PutSiteConfigAuth sets the sitewide authentication configuration.
func (*DefaultClient) PutSiteConfigExtensionMarketplace ¶ added in v1.17.0
func (c *DefaultClient) PutSiteConfigExtensionMarketplace(ctx context.Context, req ConfigExtensionMarketplace) error
PutSiteConfigExtensionMarketplace sets the extension marketplace configuration.
func (*DefaultClient) PutSiteConfigOAuth ¶ added in v1.17.0
func (c *DefaultClient) PutSiteConfigOAuth(ctx context.Context, req ConfigOAuth) error
PutSiteConfigOAuth sets the sitewide git provider OAuth configuration.
func (*DefaultClient) RebuildEnvironment ¶ added in v1.17.0
func (c *DefaultClient) RebuildEnvironment(ctx context.Context, envID string) error
RebuildEnvironment requests that the given envID is rebuilt with no changes to its specification.
func (*DefaultClient) RegenerateAPIToken ¶ added in v1.17.0
func (c *DefaultClient) RegenerateAPIToken(ctx context.Context, userID, tokenID string) (token string, _ error)
RegenerateAPIToken regenerates the given APIToken and returns the new value.
func (*DefaultClient) Registries ¶ added in v1.17.0
Registries fetches all registries in an organization.
func (*DefaultClient) RegistryByID ¶ added in v1.17.0
RegistryByID fetches a registry resource by its ID.
func (*DefaultClient) SSHKey ¶ added in v1.17.0
func (c *DefaultClient) SSHKey(ctx context.Context) (*SSHKey, error)
SSHKey gets the current SSH kepair of the authenticated user.
func (*DefaultClient) SiteConfigAuth ¶ added in v1.17.0
func (c *DefaultClient) SiteConfigAuth(ctx context.Context) (*ConfigAuth, error)
SiteConfigAuth fetches the sitewide authentication configuration.
func (*DefaultClient) SiteConfigExtensionMarketplace ¶ added in v1.17.0
func (c *DefaultClient) SiteConfigExtensionMarketplace(ctx context.Context) (*ConfigExtensionMarketplace, error)
SiteConfigExtensionMarketplace fetches the extension marketplace configuration.
func (*DefaultClient) SiteConfigOAuth ¶ added in v1.17.0
func (c *DefaultClient) SiteConfigOAuth(ctx context.Context) (*ConfigOAuth, error)
SiteConfigOAuth fetches the sitewide git provider OAuth configuration.
func (*DefaultClient) SiteSetupModeEnabled ¶ added in v1.17.0
func (c *DefaultClient) SiteSetupModeEnabled(ctx context.Context) (bool, error)
SiteSetupModeEnabled fetches the current setup_mode state of a Coder Enterprise deployment.
func (*DefaultClient) StopEnvironment ¶ added in v1.17.0
func (c *DefaultClient) StopEnvironment(ctx context.Context, envID string) error
StopEnvironment stops the environment.
func (*DefaultClient) Token ¶ added in v1.17.0
func (c *DefaultClient) Token() string
Token returns the API Token used to authenticate.
func (*DefaultClient) UpdateImage ¶ added in v1.17.0
func (c *DefaultClient) UpdateImage(ctx context.Context, imageID string, req UpdateImageReq) error
UpdateImage applies a partial update to an image resource.
func (*DefaultClient) UpdateImageTags ¶ added in v1.17.0
func (c *DefaultClient) UpdateImageTags(ctx context.Context, imageID string) error
UpdateImageTags refreshes the latest digests for all tags of the image.
func (*DefaultClient) UpdateOrganization ¶ added in v1.17.0
func (c *DefaultClient) UpdateOrganization(ctx context.Context, orgID string, req UpdateOrganizationReq) error
UpdateOrganization applys a partial update of an Organization resource.
func (*DefaultClient) UpdateRegistry ¶ added in v1.17.0
func (c *DefaultClient) UpdateRegistry(ctx context.Context, registryID string, req UpdateRegistryReq) error
UpdateRegistry applies a partial update to a registry resource.
func (*DefaultClient) UpdateUXState ¶ added in v1.17.0
func (c *DefaultClient) UpdateUXState(ctx context.Context, userID string, uxsPartial map[string]interface{}) error
UpdateUXState applies a partial update of the user's UX State.
func (*DefaultClient) UpdateUser ¶ added in v1.17.0
func (c *DefaultClient) UpdateUser(ctx context.Context, userID string, req UpdateUserReq) error
UpdateUser applyes the partial update to the given user.
func (*DefaultClient) UserByEmail ¶ added in v1.17.0
UserByEmail gets a user by email.
func (*DefaultClient) UserEnvironmentsByOrganization ¶ added in v1.17.0
func (c *DefaultClient) UserEnvironmentsByOrganization(ctx context.Context, userID, orgID string) ([]Environment, error)
UserEnvironmentsByOrganization gets the list of environments owned by the given user.
func (*DefaultClient) Users ¶ added in v1.17.0
func (c *DefaultClient) Users(ctx context.Context) ([]User, error)
Users gets the list of user accounts.
func (*DefaultClient) WaitForEnvironmentReady ¶ added in v1.17.0
func (c *DefaultClient) WaitForEnvironmentReady(ctx context.Context, envID string) error
WaitForEnvironmentReady will watch the build log and return when done.
func (*DefaultClient) WorkspaceProviderByID ¶ added in v1.17.0
func (c *DefaultClient) WorkspaceProviderByID(ctx context.Context, id string) (*KubernetesProvider, error)
WorkspaceProviderByID fetches a workspace provider entity by its unique ID.
func (*DefaultClient) WorkspaceProviders ¶ added in v1.17.0
func (c *DefaultClient) WorkspaceProviders(ctx context.Context) (*WorkspaceProviders, error)
WorkspaceProviders fetches all workspace providers known to the Coder control plane.
type DevURL ¶
type DevURL struct { ID string `json:"id" table:"-"` URL string `json:"url" table:"URL"` Port int `json:"port" table:"Port"` Access string `json:"access" table:"Access"` Name string `json:"name" table:"Name"` Scheme string `json:"scheme" table:"Scheme"` }
DevURL is the parsed json response record for a devURL from cemanager.
type Duration ¶ added in v1.13.0
Duration is a time.Duration wrapper that marshals to millisecond precision. While it looses precision, most javascript applications expect durations to be in milliseconds.
func (Duration) MarshalJSON ¶ added in v1.13.0
MarshalJSON marshals the duration to millisecond precision.
func (*Duration) UnmarshalJSON ¶ added in v1.13.0
UnmarshalJSON unmarshals a millisecond-precision integer to a time.Duration.
type Environment ¶
type Environment struct { ID string `json:"id" table:"-"` Name string `json:"name" table:"Name"` ImageID string `json:"image_id" table:"-"` ImageTag string `json:"image_tag" table:"ImageTag"` OrganizationID string `json:"organization_id" table:"-"` UserID string `json:"user_id" table:"-"` LastBuiltAt time.Time `json:"last_built_at" table:"-"` CPUCores float32 `json:"cpu_cores" table:"CPUCores"` MemoryGB float32 `json:"memory_gb" table:"MemoryGB"` DiskGB int `json:"disk_gb" table:"DiskGB"` GPUs int `json:"gpus" table:"-"` Updating bool `json:"updating" table:"-"` LatestStat EnvironmentStat `json:"latest_stat" table:"Status"` RebuildMessages []RebuildMessage `json:"rebuild_messages" table:"-"` CreatedAt time.Time `json:"created_at" table:"-"` UpdatedAt time.Time `json:"updated_at" table:"-"` LastOpenedAt time.Time `json:"last_opened_at" table:"-"` LastConnectionAt time.Time `json:"last_connection_at" table:"-"` AutoOffThreshold Duration `json:"auto_off_threshold" table:"-"` UseContainerVM bool `json:"use_container_vm" table:"CVM"` ResourcePoolID string `json:"resource_pool_id" table:"-"` }
Environment describes a Coder environment.
type EnvironmentStat ¶ added in v1.11.0
type EnvironmentStat struct { Time time.Time `json:"time"` LastOnline time.Time `json:"last_online"` ContainerStatus EnvironmentStatus `json:"container_status"` StatError string `json:"stat_error"` CPUUsage float32 `json:"cpu_usage"` MemoryTotal int64 `json:"memory_total"` MemoryUsage float32 `json:"memory_usage"` DiskTotal int64 `json:"disk_total"` DiskUsed int64 `json:"disk_used"` }
EnvironmentStat represents the state of an environment.
func (EnvironmentStat) String ¶ added in v1.11.0
func (e EnvironmentStat) String() string
type EnvironmentStatus ¶ added in v1.11.0
type EnvironmentStatus string
EnvironmentStatus refers to the states of an environment.
const ( EnvironmentCreating EnvironmentStatus = "CREATING" EnvironmentOff EnvironmentStatus = "OFF" EnvironmentOn EnvironmentStatus = "ON" EnvironmentFailed EnvironmentStatus = "FAILED" EnvironmentUnknown EnvironmentStatus = "UNKNOWN" )
The following represent the possible environment container states.
type ExtensionMarketplaceType ¶ added in v1.13.0
type ExtensionMarketplaceType string
ExtensionMarketplaceType is an enum of the valid extension marketplace configurations.
const ( ExtensionMarketplaceInternal ExtensionMarketplaceType = "internal" ExtensionMarketplaceCustom ExtensionMarketplaceType = "custom" ExtensionMarketplacePublic ExtensionMarketplaceType = "public" )
ExtensionMarketplaceType enum.
type Image ¶ added in v1.11.0
type Image struct { ID string `json:"id" table:"-"` OrganizationID string `json:"organization_id" table:"-"` Repository string `json:"repository" table:"Repository"` Description string `json:"description" table:"-"` URL string `json:"url" table:"-"` // User-supplied URL for image. Registry *Registry `json:"registry" table:"-"` DefaultTag *ImageTag `json:"default_tag" table:"DefaultTag"` DefaultCPUCores float32 `json:"default_cpu_cores" table:"DefaultCPUCores"` DefaultMemoryGB float32 `json:"default_memory_gb" table:"DefaultMemoryGB"` DefaultDiskGB int `json:"default_disk_gb" table:"DefaultDiskGB"` Deprecated bool `json:"deprecated" table:"-"` CreatedAt time.Time `json:"created_at" table:"-"` UpdatedAt time.Time `json:"updated_at" table:"-"` }
Image describes a Coder Image.
type ImageTag ¶ added in v1.13.0
type ImageTag struct { ImageID string `json:"image_id" table:"-"` Tag string `json:"tag" table:"Tag"` LatestHash string `json:"latest_hash" table:"-"` HashLastUpdatedAt time.Time `json:"hash_last_updated_at" table:"-"` OSRelease *OSRelease `json:"os_release" table:"OS"` Environments []*Environment `json:"environments" table:"-"` UpdatedAt time.Time `json:"updated_at" table:"UpdatedAt"` CreatedAt time.Time `json:"created_at" table:"-"` }
ImageTag is a Docker image tag.
type ImportImageReq ¶ added in v1.13.0
type ImportImageReq struct { RegistryID *string `json:"registry_id"` // Used to import images to existing registries. NewRegistry *NewRegistryRequest `json:"new_registry"` // Used when adding a new registry. Repository string `json:"repository"` // Refers to the image. Ex: "codercom/ubuntu". OrgID string `json:"org_id"` Tag string `json:"tag"` DefaultCPUCores float32 `json:"default_cpu_cores"` DefaultMemoryGB int `json:"default_memory_gb"` DefaultDiskGB int `json:"default_disk_gb"` Description string `json:"description"` URL string `json:"url"` }
ImportImageReq is used to import new images and registries into Coder.
type KubeProviderConfig ¶ added in v1.17.0
type KubeProviderConfig struct { ClusterAddress string `json:"cluster_address" table:"Cluster Address"` DefaultNamespace string `json:"default_namespace" table:"Namespace"` StorageClass string `json:"storage_class" table:"Storage Class"` ClusterDomainSuffix string `json:"cluster_domain_suffix" table:"Cluster Domain Suffix"` SSHEnabled bool `json:"ssh_enabled" table:"SSH Enabled"` NamespaceWhitelist []string `json:"namespace_whitelist" table:"Namespace Allowlist"` }
KubeProviderConfig defines Kubernetes-specific configuration options.
type KubernetesProvider ¶ added in v1.17.0
type KubernetesProvider struct { ID string `json:"id" table:"-"` Name string `json:"name" table:"Name"` Status WorkspaceProviderStatus `json:"status" table:"Status"` BuiltIn bool `json:"built_in" table:"-"` EnvproxyAccessURL string `json:"envproxy_access_url" table:"Access URL" validate:"required"` DevurlHost string `json:"devurl_host" table:"Devurl Host"` OrgWhitelist []string `json:"org_whitelist" table:"-"` KubeProviderConfig `json:"config" table:"_"` }
KubernetesProvider defines an entity capable of deploying and acting as an ingress for Coder environments.
type LoginRequest ¶ added in v1.17.0
LoginRequest is a request to authenticate using email and password credentials.
This is provided for use in tests, and we recommend users authenticate using an API Token.
type LoginResponse ¶ added in v1.17.0
type LoginResponse struct {
SessionToken string `json:"session_token"`
}
LoginResponse contains successful response data for an authentication request, including an API Token to be used for subsequent requests.
This is provided for use in tests, and we recommend users authenticate using an API Token.
func LoginWithPassword ¶ added in v1.17.0
func LoginWithPassword(ctx context.Context, client *http.Client, baseURL *url.URL, req *LoginRequest) (resp *LoginResponse, err error)
LoginWithPassword exchanges the email/password pair for a Session Token.
If client is nil, the http.DefaultClient will be used.
type LoginType ¶ added in v1.13.0
type LoginType string
LoginType defines the enum of valid user login types.
type NewRegistryRequest ¶ added in v1.11.0
type NewRegistryRequest struct { FriendlyName string `json:"friendly_name"` Registry string `json:"registry"` Username string `json:"username"` Password string `json:"password"` }
NewRegistryRequest describes a docker registry used in importing an image.
type OSRelease ¶ added in v1.13.0
type OSRelease struct { ID string `json:"id"` PrettyName string `json:"pretty_name"` HomeURL string `json:"home_url"` }
OSRelease is the marshalled /etc/os-release file.
type Organization ¶ added in v1.12.0
type Organization struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` Default bool `json:"default"` Members []OrganizationUser `json:"members"` EnvironmentCount int `json:"environment_count"` ResourceNamespace string `json:"resource_namespace"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` AutoOffThreshold Duration `json:"auto_off_threshold"` CPUProvisioningRate float32 `json:"cpu_provisioning_rate"` MemoryProvisioningRate float32 `json:"memory_provisioning_rate"` }
Organization describes an Organization in Coder.
type OrganizationUser ¶ added in v1.12.0
type OrganizationUser struct { User OrganizationRoles []Role `json:"organization_roles"` RolesUpdatedAt time.Time `json:"roles_updated_at"` }
OrganizationUser user wraps the basic User type and adds data specific to the user's membership of an organization.
type ParseTemplateRequest ¶ added in v1.16.0
type ParseTemplateRequest struct { RepoURL string `json:"repo_url"` Ref string `json:"ref"` Filepath string `json:"filepath"` OrgID string `json:"-"` Local io.Reader `json:"-"` }
ParseTemplateRequest parses a template. If Local is a non-nil reader it will obviate any other fields on the request.
type PutDevURLReq ¶ added in v1.13.0
type PutDevURLReq CreateDevURLReq
PutDevURLReq defines the request parameters for overwriting a DevURL.
type RebuildMessage ¶ added in v1.11.0
type RebuildMessage struct { Text string `json:"text"` Required bool `json:"required"` AutoOffThreshold Duration `json:"auto_off_threshold"` }
RebuildMessage defines the message shown when an Environment requires a rebuild for it can be accessed.
type Registry ¶ added in v1.13.0
type Registry struct { ID string `json:"id"` OrganizationID string `json:"organization_id"` FriendlyName string `json:"friendly_name"` Registry string `json:"registry"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
Registry defines an image registry configuration.
type Role ¶ added in v1.13.0
type Role string
Role defines a Coder Enterprise permissions role group.
type TemplateVersion ¶ added in v1.17.0
type TemplateVersion struct { ID string `json:"id"` TemplateID string `json:"template_id"` // FileHash is the sha256 hash of the template's file contents. FileHash string `json:"file_hash"` // Commit is the git commit from which the template was derived. Commit string `json:"commit"` CommitMessage string `json:"commit_message"` CreatedAt time.Time `json:"created_at"` }
TemplateVersion is a Workspaces As Code (WAC) template. For now, let's not interpret it on the CLI level. We just need to forward this as part of the create env request.
type UpdateEnvironmentReq ¶ added in v1.12.0
type UpdateEnvironmentReq struct { ImageID *string `json:"image_id"` ImageTag *string `json:"image_tag"` CPUCores *float32 `json:"cpu_cores"` MemoryGB *float32 `json:"memory_gb"` DiskGB *int `json:"disk_gb"` GPUs *int `json:"gpus"` }
UpdateEnvironmentReq defines the update operation, only setting nil-fields.
type UpdateImageReq ¶ added in v1.13.2
type UpdateImageReq struct { DefaultCPUCores *float32 `json:"default_cpu_cores"` DefaultMemoryGB *float32 `json:"default_memory_gb"` DefaultDiskGB *int `json:"default_disk_gb"` Description *string `json:"description"` URL *string `json:"url"` Deprecated *bool `json:"deprecated"` DefaultTag *string `json:"default_tag"` }
UpdateImageReq defines the requests parameters for a partial update of an image resource.
type UpdateOrganizationReq ¶ added in v1.13.0
type UpdateOrganizationReq struct { Name *string `json:"name"` Description *string `json:"description"` Default *bool `json:"default"` AutoOffThreshold *Duration `json:"auto_off_threshold"` CPUProvisioningRate *float32 `json:"cpu_provisioning_rate"` MemoryProvisioningRate *float32 `json:"memory_provisioning_rate"` }
UpdateOrganizationReq describes the patch request parameters to provide partial updates to an Organization resource.
type UpdateRegistryReq ¶ added in v1.13.0
type UpdateRegistryReq struct { Registry *string `json:"registry"` FriendlyName *string `json:"friendly_name"` Username *string `json:"username"` Password *string `json:"password"` }
UpdateRegistryReq defines the requests parameters for a partial update of a registry resource.
type UpdateUserReq ¶ added in v1.13.0
type UpdateUserReq struct { *UserPasswordSettings Revoked *bool `json:"revoked,omitempty"` Roles *[]Role `json:"roles,omitempty"` LoginType *LoginType `json:"login_type,omitempty"` Name *string `json:"name,omitempty"` Username *string `json:"username,omitempty"` Email *string `json:"email,omitempty"` DotfilesGitURL *string `json:"dotfiles_git_uri,omitempty"` }
UpdateUserReq defines a modification to the user, updating the value of all non-nil values.
type User ¶
type User struct { ID string `json:"id" table:"-"` Email string `json:"email" table:"Email"` Username string `json:"username" table:"Username"` Name string `json:"name" table:"Name"` Roles []Role `json:"roles" table:"-"` TemporaryPassword bool `json:"temporary_password" table:"-"` LoginType string `json:"login_type" table:"-"` KeyRegeneratedAt time.Time `json:"key_regenerated_at" table:"-"` CreatedAt time.Time `json:"created_at" table:"CreatedAt"` UpdatedAt time.Time `json:"updated_at" table:"-"` }
User describes a Coder user account.
type UserPasswordSettings ¶ added in v1.17.0
type UserPasswordSettings struct { // OldPassword is the account's current password. OldPassword string `json:"old_password,omitempty"` // Password is the new password, which may be a temporary password. Password string `json:"password,omitempty"` // Temporary indicates that API access should be restricted to the // password change API and a few other APIs. If set to true, Coder // will prompt the user to change their password upon their next // login through the web interface. Temporary bool `json:"temporary_password,omitempty"` }
UserPasswordSettings allows modification of the user's password settings.
These settings are only applicable to users managed using the built-in authentication provider; users authenticating using OAuth must change their password through the identity provider instead.
type WorkspaceProviderStatus ¶ added in v1.16.0
type WorkspaceProviderStatus string
WorkspaceProviderStatus represents the configuration state of a workspace provider.
const ( WorkspaceProviderPending WorkspaceProviderStatus = "pending" WorkspaceProviderReady WorkspaceProviderStatus = "ready" )
Workspace Provider statuses.
type WorkspaceProviderType ¶ added in v1.17.0
type WorkspaceProviderType string
WorkspaceProviderType represents the type of workspace provider.
const (
WorkspaceProviderKubernetes WorkspaceProviderType = "kubernetes"
)
Workspace Provider types.
type WorkspaceProviders ¶ added in v1.17.0
type WorkspaceProviders struct {
Kubernetes []KubernetesProvider `json:"kubernetes"`
}
WorkspaceProviders defines all available Coder workspace provider targets.