Documentation
¶
Overview ¶
Package coder provides simple APIs for integrating Go applications with Coder Enterprise.
Index ¶
- Constants
- Variables
- func String(s string) *string
- type APIToken
- type AuthProviderType
- type BuildLog
- type BuildLogFollowMsg
- type BuildLogType
- type Client
- func (c Client) APITokenByID(ctx context.Context, userID, tokenID string) (*APIToken, error)
- func (c Client) APITokens(ctx context.Context, userID string) ([]APIToken, error)
- func (c Client) APIVersion(ctx context.Context) (string, error)
- func (c Client) CreateAPIToken(ctx context.Context, userID string, req CreateAPITokenReq) (token string, _ error)
- func (c Client) CreateDevURL(ctx context.Context, envID string, req CreateDevURLReq) error
- func (c Client) CreateEnvironment(ctx context.Context, orgID string, req CreateEnvironmentRequest) (*Environment, error)
- func (c Client) CreateImageTag(ctx context.Context, imageID string, req CreateImageTagReq) (*ImageTag, error)
- func (c Client) CreateOrganization(ctx context.Context, req CreateOrganizationReq) error
- func (c Client) CreateUser(ctx context.Context, req CreateUserReq) error
- func (c Client) DeleteAPIToken(ctx context.Context, userID, tokenID string) error
- func (c Client) DeleteDevURL(ctx context.Context, envID, urlID string) error
- func (c Client) DeleteEnvironment(ctx context.Context, envID string) error
- func (c Client) DeleteImageTag(ctx context.Context, imageID, tag string) error
- func (c Client) DeleteOrganization(ctx context.Context, orgID string) error
- func (c Client) DeleteRegistry(ctx context.Context, orgID, registryID string) error
- func (c Client) DeleteSecretByName(ctx context.Context, name, userID string) errordeprecated
- func (c Client) DeleteUser(ctx context.Context, userID string) error
- func (c Client) DevURLs(ctx context.Context, envID string) ([]DevURL, error)
- func (c Client) DialEnvironmentBuildLog(ctx context.Context, envID string) (*websocket.Conn, error)
- func (c Client) DialEnvironmentStats(ctx context.Context, envID string) (*websocket.Conn, error)
- func (c Client) DialExecutor(ctx context.Context, envID string) (wsep.Execer, error)
- func (c Client) DialIDEStatus(ctx context.Context, envID string) (*websocket.Conn, error)
- func (c Client) DialResourceLoad(ctx context.Context, envID string) (*websocket.Conn, error)
- func (c Client) DialWsep(ctx context.Context, envID string) (*websocket.Conn, error)
- func (c Client) EditEnvironment(ctx context.Context, envID string, req UpdateEnvironmentReq) error
- func (c Client) Environments(ctx context.Context) ([]Environment, error)
- func (c Client) EnvironmentsByOrganization(ctx context.Context, userID, orgID string) ([]Environment, error)
- func (c Client) FollowEnvironmentBuildLog(ctx context.Context, envID string) (<-chan BuildLogFollowMsg, error)
- func (c Client) ImageTagByID(ctx context.Context, imageID, tagID string) (*ImageTag, error)
- func (c Client) ImageTags(ctx context.Context, imageID string) ([]ImageTag, error)
- func (c Client) ImportImage(ctx context.Context, orgID string, req ImportImageReq) (*Image, error)
- func (c Client) InsertSecret(ctx context.Context, userID string, req InsertSecretReq) errordeprecated
- func (c Client) Me(ctx context.Context) (*User, error)
- func (c Client) OrganizationByID(ctx context.Context, orgID string) (*Organization, error)
- func (c Client) OrganizationImages(ctx context.Context, orgID string) ([]Image, error)
- func (c Client) OrganizationMembers(ctx context.Context, orgID string) ([]OrganizationUser, error)
- func (c Client) Organizations(ctx context.Context) ([]Organization, error)
- func (c Client) PushActivity(ctx context.Context, source, envID string) error
- func (c Client) PutDevURL(ctx context.Context, envID, urlID string, req PutDevURLReq) error
- func (c Client) PutSiteConfigAuth(ctx context.Context, req ConfigAuth) error
- func (c Client) PutSiteConfigExtensionMarketplace(ctx context.Context, req ConfigExtensionMarketplace) error
- func (c Client) PutSiteConfigOAuth(ctx context.Context, req ConfigOAuth) error
- func (c Client) RebuildEnvironment(ctx context.Context, envID string) error
- func (c Client) RegenerateAPIToken(ctx context.Context, userID, tokenID string) (token string, _ error)
- func (c Client) Registries(ctx context.Context, orgID string) ([]Registry, error)
- func (c Client) RegistryByID(ctx context.Context, orgID, registryID string) (*Registry, error)
- func (c Client) SSHKey(ctx context.Context) (*SSHKey, error)
- func (c Client) SecretByName(ctx context.Context, name, userID string) (*Secret, error)deprecated
- func (c Client) SecretWithValueByID(ctx context.Context, id, userID string) (*Secret, error)deprecated
- func (c Client) SecretWithValueByName(ctx context.Context, name, userID string) (*Secret, error)deprecated
- func (c Client) Secrets(ctx context.Context, userID string) ([]Secret, error)deprecated
- func (c Client) SiteConfigAuth(ctx context.Context) (*ConfigAuth, error)
- func (c Client) SiteConfigExtensionMarketplace(ctx context.Context) (*ConfigExtensionMarketplace, error)
- func (c Client) SiteConfigOAuth(ctx context.Context) (*ConfigOAuth, error)
- func (c Client) SiteSetupModeEnabled(ctx context.Context) (bool, error)
- func (c Client) StopEnvironment(ctx context.Context, envID string) error
- func (c Client) UpdateImage(ctx context.Context, imageID string, req UpdateImageReq) error
- func (c Client) UpdateImageTags(ctx context.Context, imageID string) error
- func (c Client) UpdateOrganization(ctx context.Context, orgID string, req UpdateOrganizationReq) error
- func (c Client) UpdateRegistry(ctx context.Context, orgID, registryID string, req UpdateRegistryReq) error
- func (c Client) UpdateUXState(ctx context.Context, userID string, uxsPartial map[string]interface{}) error
- func (c Client) UpdateUser(ctx context.Context, userID string, req UpdateUserReq) error
- func (c Client) UserByEmail(ctx context.Context, email string) (*User, error)
- func (c Client) UserByID(ctx context.Context, id string) (*User, error)
- func (c Client) Users(ctx context.Context) ([]User, error)
- func (c Client) WaitForEnvironmentReady(ctx context.Context, envID string) error
- 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 DevURL
- type Duration
- type Environment
- type EnvironmentStat
- type EnvironmentStatus
- type ExtensionMarketplaceType
- type HTTPError
- type Image
- type ImageTag
- type ImportImageReq
- type InsertSecretReqdeprecated
- type LoginType
- type NewRegistryRequest
- type OSRelease
- type Organization
- type OrganizationUser
- type PutDevURLReq
- type RebuildMessage
- type Registry
- type Role
- type SSHKey
- type Secretdeprecated
- type UpdateEnvironmentReq
- type UpdateImageReq
- type UpdateOrganizationReq
- type UpdateRegistryReq
- type UpdateUserReq
- type User
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 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 ¶
Client wraps the Coder HTTP API.
func (Client) APITokenByID ¶ added in v1.13.0
APITokenByID fetches the metadata for a given APIToken.
func (Client) APIVersion ¶ added in v1.12.3
APIVersion parses the coder-version http header from an authenticated request.
func (Client) CreateAPIToken ¶ added in v1.13.0
func (c Client) CreateAPIToken(ctx context.Context, userID string, req CreateAPITokenReq) (token string, _ error)
CreateAPIToken creates a new APIToken for making authenticated requests to Coder Enterprise.
func (Client) CreateDevURL ¶ added in v1.13.0
CreateDevURL inserts a new devurl for the authenticated user.
func (Client) CreateEnvironment ¶ added in v1.11.0
func (c Client) CreateEnvironment(ctx context.Context, orgID string, req CreateEnvironmentRequest) (*Environment, error)
CreateEnvironment sends a request to create an environment.
func (Client) CreateImageTag ¶ added in v1.13.0
func (c Client) CreateImageTag(ctx context.Context, imageID string, req CreateImageTagReq) (*ImageTag, error)
CreateImageTag creates a new image tag resource.
func (Client) CreateOrganization ¶ added in v1.13.0
func (c Client) CreateOrganization(ctx context.Context, req CreateOrganizationReq) error
CreateOrganization creates a new Organization in Coder Enterprise.
func (Client) CreateUser ¶ added in v1.13.0
func (c Client) CreateUser(ctx context.Context, req CreateUserReq) error
CreateUser creates a new user account.
func (Client) DeleteAPIToken ¶ added in v1.13.0
DeleteAPIToken deletes an APIToken.
func (Client) DeleteDevURL ¶ added in v1.13.0
DeleteDevURL deletes the specified devurl.
func (Client) DeleteEnvironment ¶ added in v1.11.0
DeleteEnvironment deletes the environment.
func (Client) DeleteImageTag ¶ added in v1.13.0
DeleteImageTag deletes an image tag resource.
func (Client) DeleteOrganization ¶ added in v1.13.0
DeleteOrganization deletes an organization.
func (Client) DeleteRegistry ¶ added in v1.13.0
DeleteRegistry deletes a registry resource by its ID.
func (Client) DeleteUser ¶ added in v1.13.0
DeleteUser deletes a user account.
func (Client) DialEnvironmentBuildLog ¶ added in v1.11.0
DialEnvironmentBuildLog opens a websocket connection for the environment build log messages.
func (Client) DialEnvironmentStats ¶ added in v1.11.0
DialEnvironmentStats opens a websocket connection for environment stats.
func (Client) DialExecutor ¶ added in v1.13.0
DialExecutor gives a remote execution interface for performing commands inside an environment.
func (Client) DialIDEStatus ¶ added in v1.11.0
DialIDEStatus opens a websocket connection for cpu load metrics on the environment.
func (Client) DialResourceLoad ¶ added in v1.11.0
DialResourceLoad opens a websocket connection for cpu load metrics on the environment.
func (Client) DialWsep ¶
DialWsep dials an environments command execution interface See https://github.com/cdr/wsep for details.
func (Client) EditEnvironment ¶ added in v1.12.0
EditEnvironment modifies the environment specification and initiates a rebuild.
func (Client) Environments ¶ added in v1.12.0
func (c Client) Environments(ctx context.Context) ([]Environment, error)
Environments lists environments returned by the given filter. TODO: add the filter options, explore performance issue.
func (Client) EnvironmentsByOrganization ¶
func (c Client) EnvironmentsByOrganization(ctx context.Context, userID, orgID string) ([]Environment, error)
EnvironmentsByOrganization gets the list of environments owned by the given user.
func (Client) FollowEnvironmentBuildLog ¶ added in v1.12.0
func (c Client) FollowEnvironmentBuildLog(ctx context.Context, envID string) (<-chan BuildLogFollowMsg, error)
FollowEnvironmentBuildLog trails the build log of a Coder environment.
func (Client) ImageTagByID ¶ added in v1.13.0
ImageTagByID fetch an image tag by ID.
func (Client) ImportImage ¶ added in v1.11.0
ImportImage creates a new image and optionally a new registry.
func (Client) InsertSecret
deprecated
func (Client) OrganizationByID ¶ added in v1.13.0
OrganizationByID get the Organization by its ID.
func (Client) OrganizationImages ¶ added in v1.12.3
OrganizationImages returns all of the images imported for orgID.
func (Client) OrganizationMembers ¶ added in v1.13.0
OrganizationMembers get all members of the given organization.
func (Client) Organizations ¶ added in v1.12.0
func (c Client) Organizations(ctx context.Context) ([]Organization, error)
Organizations gets all Organizations.
func (Client) PushActivity ¶
PushActivity pushes CLI activity to Coder.
func (Client) PutDevURL ¶ added in v1.13.0
PutDevURL updates an existing devurl for the authenticated user.
func (Client) PutSiteConfigAuth ¶ added in v1.13.0
func (c Client) PutSiteConfigAuth(ctx context.Context, req ConfigAuth) error
PutSiteConfigAuth sets the sitewide authentication configuration.
func (Client) PutSiteConfigExtensionMarketplace ¶ added in v1.13.0
func (c Client) PutSiteConfigExtensionMarketplace(ctx context.Context, req ConfigExtensionMarketplace) error
PutSiteConfigExtensionMarketplace sets the extension marketplace configuration.
func (Client) PutSiteConfigOAuth ¶ added in v1.13.0
func (c Client) PutSiteConfigOAuth(ctx context.Context, req ConfigOAuth) error
PutSiteConfigOAuth sets the sitewide git provider OAuth configuration.
func (Client) RebuildEnvironment ¶ added in v1.12.0
RebuildEnvironment requests that the given envID is rebuilt with no changes to its specification.
func (Client) RegenerateAPIToken ¶ added in v1.13.0
func (c Client) RegenerateAPIToken(ctx context.Context, userID, tokenID string) (token string, _ error)
RegenerateAPIToken regenerates the given APIToken and returns the new value.
func (Client) Registries ¶ added in v1.13.0
Registries fetches all registries in an organization.
func (Client) RegistryByID ¶ added in v1.13.0
RegistryByID fetches a registry resource by its ID.
func (Client) SecretWithValueByName
deprecated
func (Client) SiteConfigAuth ¶ added in v1.13.0
func (c Client) SiteConfigAuth(ctx context.Context) (*ConfigAuth, error)
SiteConfigAuth fetches the sitewide authentication configuration.
func (Client) SiteConfigExtensionMarketplace ¶ added in v1.13.0
func (c Client) SiteConfigExtensionMarketplace(ctx context.Context) (*ConfigExtensionMarketplace, error)
SiteConfigExtensionMarketplace fetches the extension marketplace configuration.
func (Client) SiteConfigOAuth ¶ added in v1.13.0
func (c Client) SiteConfigOAuth(ctx context.Context) (*ConfigOAuth, error)
SiteConfigOAuth fetches the sitewide git provider OAuth configuration.
func (Client) SiteSetupModeEnabled ¶ added in v1.13.0
SiteSetupModeEnabled fetches the current setup_mode state of a Coder Enterprise deployment.
func (Client) StopEnvironment ¶ added in v1.12.0
StopEnvironment stops the stops.
func (Client) UpdateImage ¶ added in v1.13.2
UpdateImage applies a partial update to an image resource.
func (Client) UpdateImageTags ¶ added in v1.14.0
UpdateImageTags refreshes the latest digests for all tags of the image.
func (Client) UpdateOrganization ¶ added in v1.13.0
func (c Client) UpdateOrganization(ctx context.Context, orgID string, req UpdateOrganizationReq) error
UpdateOrganization applys a partial update of an Organization resource.
func (Client) UpdateRegistry ¶ added in v1.13.0
func (c Client) UpdateRegistry(ctx context.Context, orgID, registryID string, req UpdateRegistryReq) error
UpdateRegistry applies a partial update to a registry resource.
func (Client) UpdateUXState ¶ added in v1.14.0
func (c Client) UpdateUXState(ctx context.Context, userID string, uxsPartial map[string]interface{}) error
UpdateUXState applies a partial update of the user's UX State.
func (Client) UpdateUser ¶ added in v1.13.0
UpdateUser applyes the partial update to the given user.
func (Client) UserByEmail ¶
UserByEmail gets a user by email.
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"`
ImageTag string `json:"image_tag"`
CPUCores float32 `json:"cpu_cores"`
MemoryGB float32 `json:"memory_gb"`
DiskGB int `json:"disk_gb"`
GPUs int `json:"gpus"`
Services []string `json:"services"`
UseContainerVM bool `json:"use_container_vm"`
}
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 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:"GPUs"`
Updating bool `json:"updating" table:"Updating"`
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:"-"`
SSHAvailable bool `json:"ssh_available" table:"-"`
UseContainerVM bool `json:"use_container_vm" table:"CVM"`
}
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".
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 InsertSecretReq
deprecated
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 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 Secret
deprecated
type Secret struct {
ID string `json:"id" table:"-"`
Name string `json:"name" table:"Name"`
Value string `json:"value,omitempty" table:"Value"`
Description string `json:"description" table:"Description"`
CreatedAt time.Time `json:"created_at" table:"CreatedAt"`
UpdatedAt time.Time `json:"updated_at" table:"-"`
}
Secret describes a Coder secret.
Deprecated: Coder Secrets will be removed from Coder Enterprise in a future release.
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"`
Services *[]string `json:"services"`
CodeServerReleaseURL *string `json:"code_server_release_url"`
}
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 {
// TODO(@cmoog) add update password option
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.