agentsdk
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
- Variables
- func AgentScriptFromProto(protoScript *proto.WorkspaceAgentScript) (codersdk.WorkspaceAgentScript, error)
- func AgentScriptsFromProto(protoScripts []*proto.WorkspaceAgentScript) ([]codersdk.WorkspaceAgentScript, error)
- func AppFromProto(protoApp *proto.WorkspaceApp) (codersdk.WorkspaceApp, error)
- func AppHealthPoster(aAPI BatchUpdateAppHealthsClient) func(ctx context.Context, req PostAppHealthsRequest) error
- func AppsFromProto(protoApps []*proto.WorkspaceApp) ([]codersdk.WorkspaceApp, error)
- func BannerConfigFromProto(sbp *proto.BannerConfig) codersdk.BannerConfig
- func DevcontainerFromProto(pdc *proto.WorkspaceAgentDevcontainer) (codersdk.WorkspaceAgentDevcontainer, error)
- func DevcontainersFromProto(pdcs []*proto.WorkspaceAgentDevcontainer) ([]codersdk.WorkspaceAgentDevcontainer, error)
- func LifecycleStateFromProto(s proto.Lifecycle_State) (codersdk.WorkspaceAgentLifecycle, error)
- func LogsNotifyChannel(agentID uuid.UUID) string
- func LogsSender(sourceID uuid.UUID, patchLogs func(ctx context.Context, req PatchLogs) error, ...) (sendLog func(ctx context.Context, log ...Log) error, ...)deprecated
- func LogsSenderFlushTimeout(timeout time.Duration) func(*logsSenderOptions)
- func LogsWriter(ctx context.Context, sender func(ctx context.Context, log ...Log) error, ...) io.WriteCloser
- func MetadataDescriptionFromProto(description *proto.WorkspaceAgentMetadata_Description) codersdk.WorkspaceAgentMetadataDescription
- func MetadataDescriptionsFromProto(descriptions []*proto.WorkspaceAgentMetadata_Description) []codersdk.WorkspaceAgentMetadataDescription
- func MetadataResultFromProto(r *proto.WorkspaceAgentMetadata_Result) codersdk.WorkspaceAgentMetadataResult
- func PrebuildClaimedChannel(id uuid.UUID) string
- func ProtoFromApp(a codersdk.WorkspaceApp) (*proto.WorkspaceApp, error)
- func ProtoFromAppHealthsRequest(req PostAppHealthsRequest) (*proto.BatchUpdateAppHealthRequest, error)
- func ProtoFromApps(apps []codersdk.WorkspaceApp) ([]*proto.WorkspaceApp, error)
- func ProtoFromBannerConfig(sb codersdk.BannerConfig) *proto.BannerConfig
- func ProtoFromConnectionType(typ ConnectionType) (proto.Connection_Type, error)
- func ProtoFromDevcontainer(dc codersdk.WorkspaceAgentDevcontainer) *proto.WorkspaceAgentDevcontainer
- func ProtoFromDevcontainers(dcs []codersdk.WorkspaceAgentDevcontainer) []*proto.WorkspaceAgentDevcontainer
- func ProtoFromLifecycle(req PostLifecycleRequest) (*proto.Lifecycle, error)
- func ProtoFromLifecycleState(s codersdk.WorkspaceAgentLifecycle) (proto.Lifecycle_State, error)
- func ProtoFromLog(log Log) (*proto.Log, error)
- func ProtoFromManifest(manifest Manifest) (*proto.Manifest, error)
- func ProtoFromMetadataDescription(d codersdk.WorkspaceAgentMetadataDescription) *proto.WorkspaceAgentMetadata_Description
- func ProtoFromMetadataDescriptions(descriptions []codersdk.WorkspaceAgentMetadataDescription) []*proto.WorkspaceAgentMetadata_Description
- func ProtoFromMetadataResult(r codersdk.WorkspaceAgentMetadataResult) *proto.WorkspaceAgentMetadata_Result
- func ProtoFromScript(s codersdk.WorkspaceAgentScript) *proto.WorkspaceAgentScript
- func ProtoFromScripts(scripts []codersdk.WorkspaceAgentScript) []*proto.WorkspaceAgentScript
- func ProtoFromServiceBanner(sb codersdk.BannerConfig) *proto.ServiceBanner
- func ProtoFromSubsystems(ss []codersdk.AgentSubsystem) ([]proto.Startup_Subsystem, error)
- func ServiceBannerFromProto(sbp *proto.ServiceBanner) codersdk.BannerConfig
- func WaitForReinitLoop(ctx context.Context, logger slog.Logger, client *Client) <-chan ReinitializationEvent
- type AWSInstanceIdentityToken
- type AgentMetric
- type AgentMetricLabel
- type AgentMetricType
- type AuthenticateResponse
- type AzureInstanceIdentityToken
- type BatchUpdateAppHealthsClient
- type Client
- func (c *Client) AuthAWSInstanceIdentity(ctx context.Context) (AuthenticateResponse, error)
- func (c *Client) AuthAzureInstanceIdentity(ctx context.Context) (AuthenticateResponse, error)
- func (c *Client) AuthGoogleInstanceIdentity(ctx context.Context, serviceAccount string, gcpClient *metadata.Client) (AuthenticateResponse, error)
- func (c *Client) ConnectRPC(ctx context.Context) (drpc.Conn, error)
- func (c *Client) ConnectRPC20(ctx context.Context) (proto.DRPCAgentClient20, error)
- func (c *Client) ConnectRPC20WithTailnet(ctx context.Context) (proto.DRPCAgentClient20, tailnetproto.DRPCTailnetClient20, error)
- func (c *Client) ConnectRPC21(ctx context.Context) (proto.DRPCAgentClient21, error)
- func (c *Client) ConnectRPC21WithTailnet(ctx context.Context) (proto.DRPCAgentClient21, tailnetproto.DRPCTailnetClient21, error)
- func (c *Client) ConnectRPC22(ctx context.Context) (proto.DRPCAgentClient22, tailnetproto.DRPCTailnetClient22, error)
- func (c *Client) ConnectRPC23(ctx context.Context) (proto.DRPCAgentClient23, tailnetproto.DRPCTailnetClient23, error)
- func (c *Client) ConnectRPC24(ctx context.Context) (proto.DRPCAgentClient24, tailnetproto.DRPCTailnetClient24, error)
- func (c *Client) ConnectRPC25(ctx context.Context) (proto.DRPCAgentClient25, tailnetproto.DRPCTailnetClient25, error)
- func (c *Client) ExternalAuth(ctx context.Context, req ExternalAuthRequest) (ExternalAuthResponse, error)
- func (c *Client) GitSSHKey(ctx context.Context) (GitSSHKey, error)
- func (c *Client) PatchAppStatus(ctx context.Context, req PatchAppStatus) error
- func (c *Client) PatchLogs(ctx context.Context, req PatchLogs) errordeprecated
- func (c *Client) PostLogSource(ctx context.Context, req PostLogSourceRequest) (codersdk.WorkspaceAgentLogSource, error)
- func (c *Client) RewriteDERPMap(derpMap *tailcfg.DERPMap)
- func (c *Client) SetSessionToken(token string)
- func (c *Client) WaitForReinit(ctx context.Context) (*ReinitializationEvent, error)
- type ConnectionType
- type ExternalAuthRequest
- type ExternalAuthResponse
- type GitSSHKey
- type GoogleInstanceIdentityToken
- type Log
- type LogDest
- type LogSender
- type LogSource
- type LogsNotifyMessage
- type Manifest
- type Metadata
- type PatchAppStatus
- type PatchLogs
- type PostAppHealthsRequest
- type PostLifecycleRequest
- type PostLogSourceRequest
- type PostMetadataRequest
- type PostMetadataRequestDeprecated
- type PostStartupRequest
- type ReinitializationEvent
- type ReinitializationReason
- type SSEAgentReinitReceiver
- type SSEAgentReinitTransmitter
- type Script
- type ScriptLogger
- type Stats
- type StatsResponse
Constants¶
This section is empty.
Variables¶
var (ErrTransmissionSourceClosed =xerrors.New("transmission source closed")ErrTransmissionTargetClosed =xerrors.New("transmission target closed"))
var ErrLogLimitExceeded =xerrors.New("Log limit exceeded")
var ExternalLogSourceID =uuid.MustParse("3b579bf4-1ed8-4b99-87a8-e9a1e3410410")
ExternalLogSourceID is the statically-defined ID of a log-source thatappears as "External" in the dashboard.
This is to support legacy API-consumers that do not create their ownlog-source. This should be removed in the future.
Functions¶
funcAgentScriptFromProto¶added inv2.8.0
func AgentScriptFromProto(protoScript *proto.WorkspaceAgentScript) (codersdk.WorkspaceAgentScript,error)
funcAgentScriptsFromProto¶added inv2.8.0
func AgentScriptsFromProto(protoScripts []*proto.WorkspaceAgentScript) ([]codersdk.WorkspaceAgentScript,error)
funcAppFromProto¶added inv2.8.0
func AppFromProto(protoApp *proto.WorkspaceApp) (codersdk.WorkspaceApp,error)
funcAppHealthPoster¶added inv2.8.0
func AppHealthPoster(aAPIBatchUpdateAppHealthsClient) func(ctxcontext.Context, reqPostAppHealthsRequest)error
funcAppsFromProto¶added inv2.8.0
func AppsFromProto(protoApps []*proto.WorkspaceApp) ([]codersdk.WorkspaceApp,error)
funcBannerConfigFromProto¶added inv2.12.0
func BannerConfigFromProto(sbp *proto.BannerConfig)codersdk.BannerConfig
funcDevcontainerFromProto¶added inv2.21.0
func DevcontainerFromProto(pdc *proto.WorkspaceAgentDevcontainer) (codersdk.WorkspaceAgentDevcontainer,error)
funcDevcontainersFromProto¶added inv2.21.0
func DevcontainersFromProto(pdcs []*proto.WorkspaceAgentDevcontainer) ([]codersdk.WorkspaceAgentDevcontainer,error)
funcLifecycleStateFromProto¶added inv2.9.0
func LifecycleStateFromProto(sproto.Lifecycle_State) (codersdk.WorkspaceAgentLifecycle,error)
funcLogsNotifyChannel¶
LogsNotifyChannel returns the channel name responsible for notifyingof new logs.
funcLogsSenderdeprecated
func LogsSender(sourceIDuuid.UUID, patchLogs func(ctxcontext.Context, reqPatchLogs)error, loggerslog.Logger, opts ...func(*logsSenderOptions)) (sendLog func(ctxcontext.Context, log ...Log)error, flushAndClose func(context.Context)error)
LogsSender will send agent startup logs to the server. Calls tosendLog are non-blocking and will return an error if flushAndClosehas been called. Calling sendLog concurrently is not supported. Ifthe context passed to flushAndClose is canceled, any remaining logswill be discarded.
Deprecated: Use NewLogSender instead, based on the v2 Agent API.
funcLogsSenderFlushTimeout¶added inv2.3.0
LogsSenderFlushTimeout changes the default flush timeout (250ms),this is mostly useful for tests.
funcLogsWriter¶added inv2.2.0
func LogsWriter(ctxcontext.Context, sender func(ctxcontext.Context, log ...Log)error, sourceuuid.UUID, levelcodersdk.LogLevel)io.WriteCloser
LogsWriter returns an io.WriteCloser that sends logs via theprovided sender. The sender is expected to be non-blocking. CallingClose flushes any remaining partially written log lines but isotherwise no-op. If the context passed to LogsWriter iscanceled, any remaining logs will be discarded.
Neither Write nor Close is safe for concurrent use and must be usedby a single goroutine.
funcMetadataDescriptionFromProto¶added inv2.8.0
func MetadataDescriptionFromProto(description *proto.WorkspaceAgentMetadata_Description)codersdk.WorkspaceAgentMetadataDescription
funcMetadataDescriptionsFromProto¶added inv2.8.0
func MetadataDescriptionsFromProto(descriptions []*proto.WorkspaceAgentMetadata_Description) []codersdk.WorkspaceAgentMetadataDescription
funcMetadataResultFromProto¶added inv2.9.0
func MetadataResultFromProto(r *proto.WorkspaceAgentMetadata_Result)codersdk.WorkspaceAgentMetadataResult
funcPrebuildClaimedChannel¶added inv2.22.0
funcProtoFromApp¶added inv2.8.0
func ProtoFromApp(acodersdk.WorkspaceApp) (*proto.WorkspaceApp,error)
funcProtoFromAppHealthsRequest¶added inv2.8.0
func ProtoFromAppHealthsRequest(reqPostAppHealthsRequest) (*proto.BatchUpdateAppHealthRequest,error)
funcProtoFromApps¶added inv2.8.0
func ProtoFromApps(apps []codersdk.WorkspaceApp) ([]*proto.WorkspaceApp,error)
funcProtoFromBannerConfig¶added inv2.12.0
func ProtoFromBannerConfig(sbcodersdk.BannerConfig) *proto.BannerConfig
funcProtoFromConnectionType¶added inv2.20.0
func ProtoFromConnectionType(typConnectionType) (proto.Connection_Type,error)
funcProtoFromDevcontainer¶added inv2.21.0
func ProtoFromDevcontainer(dccodersdk.WorkspaceAgentDevcontainer) *proto.WorkspaceAgentDevcontainer
funcProtoFromDevcontainers¶added inv2.21.0
func ProtoFromDevcontainers(dcs []codersdk.WorkspaceAgentDevcontainer) []*proto.WorkspaceAgentDevcontainer
funcProtoFromLifecycle¶added inv2.9.0
func ProtoFromLifecycle(reqPostLifecycleRequest) (*proto.Lifecycle,error)
funcProtoFromLifecycleState¶added inv2.13.0
func ProtoFromLifecycleState(scodersdk.WorkspaceAgentLifecycle) (proto.Lifecycle_State,error)
funcProtoFromManifest¶added inv2.8.0
funcProtoFromMetadataDescription¶added inv2.8.0
func ProtoFromMetadataDescription(dcodersdk.WorkspaceAgentMetadataDescription) *proto.WorkspaceAgentMetadata_Description
funcProtoFromMetadataDescriptions¶added inv2.8.0
func ProtoFromMetadataDescriptions(descriptions []codersdk.WorkspaceAgentMetadataDescription) []*proto.WorkspaceAgentMetadata_Description
funcProtoFromMetadataResult¶added inv2.9.0
func ProtoFromMetadataResult(rcodersdk.WorkspaceAgentMetadataResult) *proto.WorkspaceAgentMetadata_Result
funcProtoFromScript¶added inv2.8.0
func ProtoFromScript(scodersdk.WorkspaceAgentScript) *proto.WorkspaceAgentScript
funcProtoFromScripts¶added inv2.8.0
func ProtoFromScripts(scripts []codersdk.WorkspaceAgentScript) []*proto.WorkspaceAgentScript
funcProtoFromServiceBanner¶added inv2.8.0
func ProtoFromServiceBanner(sbcodersdk.BannerConfig) *proto.ServiceBanner
funcProtoFromSubsystems¶added inv2.8.0
func ProtoFromSubsystems(ss []codersdk.AgentSubsystem) ([]proto.Startup_Subsystem,error)
funcServiceBannerFromProto¶added inv2.8.0
func ServiceBannerFromProto(sbp *proto.ServiceBanner)codersdk.BannerConfig
funcWaitForReinitLoop¶added inv2.22.0
Types¶
typeAgentMetric¶
type AgentMetric struct {Namestring `json:"name" validate:"required"`TypeAgentMetricType `json:"type" validate:"required" enums:"counter,gauge"`Valuefloat64 `json:"value" validate:"required"`Labels []AgentMetricLabel `json:"labels,omitempty"`}
typeAgentMetricType¶
type AgentMetricTypestring
const (AgentMetricTypeCounterAgentMetricType = "counter"AgentMetricTypeGaugeAgentMetricType = "gauge")
typeAuthenticateResponse¶
type AuthenticateResponse struct {SessionTokenstring `json:"session_token"`}
AuthenticateResponse is returned when an instance IDhas been exchanged for a session token.@typescript-ignore AuthenticateResponse
typeBatchUpdateAppHealthsClient¶added inv2.9.0
type BatchUpdateAppHealthsClient interface {BatchUpdateAppHealths(ctxcontext.Context, req *proto.BatchUpdateAppHealthRequest) (*proto.BatchUpdateAppHealthResponse,error)}
BatchUpdateAppHealthsClient is a partial interface of proto.DRPCAgentClient.
typeClient¶
Client wraps `codersdk.Client` with specific functionsscoped to a workspace agent.
func (*Client)AuthAWSInstanceIdentity¶
func (c *Client) AuthAWSInstanceIdentity(ctxcontext.Context) (AuthenticateResponse,error)
AuthWorkspaceAWSInstanceIdentity uses the Amazon Metadata API tofetch 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)AuthAzureInstanceIdentity¶
func (c *Client) AuthAzureInstanceIdentity(ctxcontext.Context) (AuthenticateResponse,error)
AuthWorkspaceAzureInstanceIdentity uses the Azure Instance Metadata Service tofetch a signed payload, and exchange it for a session token for a workspace agent.
func (*Client)AuthGoogleInstanceIdentity¶
func (c *Client) AuthGoogleInstanceIdentity(ctxcontext.Context, serviceAccountstring, gcpClient *metadata.Client) (AuthenticateResponse,error)
AuthWorkspaceGoogleInstanceIdentity uses the Google Compute Engine Metadata API tofetch 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)ConnectRPC¶added inv2.8.0
ConnectRPC connects to the workspace agent API and tailnet API
func (*Client)ConnectRPC20¶added inv2.14.0
ConnectRPC20 returns a dRPC client to the Agent API v2.0. Notably, it is missingGetAnnouncementBanners, but is useful when you want to be maximally compatible with CoderdRelease Versions from 2.9+Deprecated: use ConnectRPC20WithTailnet
func (*Client)ConnectRPC20WithTailnet¶added inv2.18.0
func (c *Client) ConnectRPC20WithTailnet(ctxcontext.Context) (proto.DRPCAgentClient20,tailnetproto.DRPCTailnetClient20,error,)
ConnectRPC20WithTailnet returns a dRPC client to the Agent API v2.0. Notably, it is missingGetAnnouncementBanners, but is useful when you want to be maximally compatible with CoderdRelease Versions from 2.9+
func (*Client)ConnectRPC21¶added inv2.14.0
ConnectRPC21 returns a dRPC client to the Agent API v2.1. It is useful when you want to bemaximally compatible with Coderd Release Versions from 2.12+Deprecated: use ConnectRPC21WithTailnet
func (*Client)ConnectRPC21WithTailnet¶added inv2.18.0
func (c *Client) ConnectRPC21WithTailnet(ctxcontext.Context) (proto.DRPCAgentClient21,tailnetproto.DRPCTailnetClient21,error,)
ConnectRPC21WithTailnet returns a dRPC client to the Agent API v2.1. It is useful when you want to bemaximally compatible with Coderd Release Versions from 2.12+
func (*Client)ConnectRPC22¶added inv2.18.0
func (c *Client) ConnectRPC22(ctxcontext.Context) (proto.DRPCAgentClient22,tailnetproto.DRPCTailnetClient22,error,)
ConnectRPC22 returns a dRPC client to the Agent API v2.2. It is useful when you want to bemaximally compatible with Coderd Release Versions from 2.13+
func (*Client)ConnectRPC23¶added inv2.18.0
func (c *Client) ConnectRPC23(ctxcontext.Context) (proto.DRPCAgentClient23,tailnetproto.DRPCTailnetClient23,error,)
ConnectRPC23 returns a dRPC client to the Agent API v2.3. It is useful when you want to bemaximally compatible with Coderd Release Versions from 2.18+
func (*Client)ConnectRPC24¶added inv2.20.0
func (c *Client) ConnectRPC24(ctxcontext.Context) (proto.DRPCAgentClient24,tailnetproto.DRPCTailnetClient24,error,)
ConnectRPC24 returns a dRPC client to the Agent API v2.4. It is useful when you want to bemaximally compatible with Coderd Release Versions from 2.20+
func (*Client)ConnectRPC25¶added inv2.23.0
func (c *Client) ConnectRPC25(ctxcontext.Context) (proto.DRPCAgentClient25,tailnetproto.DRPCTailnetClient25,error,)
ConnectRPC25 returns a dRPC client to the Agent API v2.5. It is useful when you want to bemaximally compatible with Coderd Release Versions from 2.xx+ // TODO(DanielleMaywood): Update version
func (*Client)ExternalAuth¶added inv2.3.0
func (c *Client) ExternalAuth(ctxcontext.Context, reqExternalAuthRequest) (ExternalAuthResponse,error)
ExternalAuth submits a URL or provider ID to fetch an access token for.nolint:revive
func (*Client)PatchAppStatus¶added inv2.21.0
func (c *Client) PatchAppStatus(ctxcontext.Context, reqPatchAppStatus)error
func (*Client)PostLogSource¶added inv2.2.0
func (c *Client) PostLogSource(ctxcontext.Context, reqPostLogSourceRequest) (codersdk.WorkspaceAgentLogSource,error)
func (*Client)RewriteDERPMap¶added inv2.8.0
RewriteDERPMap rewrites the DERP map to use the access URL of the SDK as the"embedded relay" access URL. The passed derp map is modified in place.
Agents can provide an arbitrary access URL that may be different that theglobally configured one. This breaks the built-in DERP, which would continueto reference the global access URL.
func (*Client)SetSessionToken¶
func (*Client)WaitForReinit¶added inv2.22.0
func (c *Client) WaitForReinit(ctxcontext.Context) (*ReinitializationEvent,error)
WaitForReinit polls a SSE endpoint, and receives an event back under the following conditions:- ping: ignored, keepalive- prebuild claimed: a prebuilt workspace is claimed, so the agent must reinitialize.
typeConnectionType¶added inv2.20.0
type ConnectionTypestring
ConnectionType is the type of connection that the agent is receiving.
const (ConnectionTypeUnspecifiedConnectionType = "Unspecified"ConnectionTypeSSHConnectionType = "SSH"ConnectionTypeVSCodeConnectionType = "VS Code"ConnectionTypeJetBrainsConnectionType = "JetBrains"ConnectionTypeReconnectingPTYConnectionType = "Web Terminal")
Connection type enums.
funcConnectionTypeFromProto¶added inv2.20.0
func ConnectionTypeFromProto(typproto.Connection_Type) (ConnectionType,error)
typeExternalAuthRequest¶added inv2.3.0
type ExternalAuthRequest struct {// ID is the ID of a provider to request authentication for.IDstring// Match is an arbitrary string matched against the regex of the provider.Matchstring// Listen indicates that the request should be long-lived and listen for// a new token to be requested.Listenbool}
ExternalAuthRequest is used to request an access token for a provider.Either ID or Match must be specified, but not both.
typeExternalAuthResponse¶added inv2.3.0
type ExternalAuthResponse struct {AccessTokenstring `json:"access_token"`TokenExtra map[string]interface{} `json:"token_extra"`URLstring `json:"url"`Typestring `json:"type"`// Deprecated: Only supported on `/workspaceagents/me/gitauth`// for backwards compatibility.Usernamestring `json:"username"`Passwordstring `json:"password"`}
typeGoogleInstanceIdentityToken¶
type GoogleInstanceIdentityToken struct {JSONWebTokenstring `json:"json_web_token" validate:"required"`}
typeLogDest¶added inv2.14.0
type LogDest interface {BatchCreateLogs(ctxcontext.Context, request *proto.BatchCreateLogsRequest) (*proto.BatchCreateLogsResponse,error)}
typeLogSender¶added inv2.9.0
LogSender is a component that handles enqueuing logs and then sending them over the agent API.Things that need to log call Enqueue and Flush. When the agent API becomes available, callSendLoop to send pending logs.
funcNewLogSender¶added inv2.9.0
func (*LogSender)GetScriptLogger¶added inv2.9.0
func (l *LogSender) GetScriptLogger(logSourceIDuuid.UUID)ScriptLogger
typeLogsNotifyMessage¶
type LogsNotifyMessage struct {CreatedAfterint64 `json:"created_after"`}
typeManifest¶
type Manifest struct {AgentIDuuid.UUID `json:"agent_id"`AgentNamestring `json:"agent_name"`// OwnerName and WorkspaceID are used by an open-source user to identify the workspace.// We do not provide insurance that this will not be removed in the future,// but if it's easy to persist lets keep it around.OwnerNamestring `json:"owner_name"`WorkspaceIDuuid.UUID `json:"workspace_id"`WorkspaceNamestring `json:"workspace_name"`// GitAuthConfigs stores the number of Git configurations// the Coder deployment has. If this number is >0, we// set up special configuration in the workspace.GitAuthConfigsint `json:"git_auth_configs"`VSCodePortProxyURIstring `json:"vscode_port_proxy_uri"`Apps []codersdk.WorkspaceApp `json:"apps"`DERPMap *tailcfg.DERPMap `json:"derpmap"`DERPForceWebSocketsbool `json:"derp_force_websockets"`EnvironmentVariables map[string]string `json:"environment_variables"`Directorystring `json:"directory"`MOTDFilestring `json:"motd_file"`DisableDirectConnectionsbool `json:"disable_direct_connections"`Metadata []codersdk.WorkspaceAgentMetadataDescription `json:"metadata"`Scripts []codersdk.WorkspaceAgentScript `json:"scripts"`Devcontainers []codersdk.WorkspaceAgentDevcontainer `json:"devcontainers"`}
typeMetadata¶added inv2.3.1
type Metadata struct {Keystring `json:"key"`codersdk.WorkspaceAgentMetadataResult}
funcMetadataFromProto¶added inv2.9.0
typePatchAppStatus¶added inv2.21.0
type PatchAppStatus struct {AppSlugstring `json:"app_slug"`Statecodersdk.WorkspaceAppStatusState `json:"state"`Messagestring `json:"message"`URIstring `json:"uri"`// Deprecated: this field is unused and will be removed in a future version.Iconstring `json:"icon"`// Deprecated: this field is unused and will be removed in a future version.NeedsUserAttentionbool `json:"needs_user_attention"`}
PatchAppStatus updates the status of a workspace app.
typePostAppHealthsRequest¶
type PostAppHealthsRequest struct {// Healths is a map of the workspace app name and the health of the app.Healths map[uuid.UUID]codersdk.WorkspaceAppHealth}
typePostLifecycleRequest¶
type PostLifecycleRequest struct {Statecodersdk.WorkspaceAgentLifecycle `json:"state"`ChangedAttime.Time `json:"changed_at"`}
typePostLogSourceRequest¶added inv2.13.0
type PostLogSourceRequest struct {// ID is a unique identifier for the log source.// It is scoped to a workspace agent, and can be statically// defined inside code to prevent duplicate sources from being// created for the same agent.IDuuid.UUID `json:"id"`DisplayNamestring `json:"display_name"`Iconstring `json:"icon"`}
typePostMetadataRequest¶
type PostMetadataRequest struct {Metadata []Metadata `json:"metadata"`}
typePostMetadataRequestDeprecated¶added inv2.3.1
type PostMetadataRequestDeprecated =codersdk.WorkspaceAgentMetadataResult
In the future, we may want to support sending back multiple values forperformance.
typePostStartupRequest¶
type PostStartupRequest struct {Versionstring `json:"version"`ExpandedDirectorystring `json:"expanded_directory"`Subsystems []codersdk.AgentSubsystem `json:"subsystems"`}
typeReinitializationEvent¶added inv2.22.0
type ReinitializationEvent struct {WorkspaceIDuuid.UUIDReasonReinitializationReason `json:"reason"`}
typeReinitializationReason¶added inv2.22.0
type ReinitializationReasonstring
const (ReinitializeReasonPrebuildClaimedReinitializationReason = "prebuild_claimed")
typeSSEAgentReinitReceiver¶added inv2.22.0
type SSEAgentReinitReceiver struct {// contains filtered or unexported fields}
funcNewSSEAgentReinitReceiver¶added inv2.22.0
func NewSSEAgentReinitReceiver(rio.ReadCloser) *SSEAgentReinitReceiver
func (*SSEAgentReinitReceiver)Receive¶added inv2.22.0
func (s *SSEAgentReinitReceiver) Receive(ctxcontext.Context) (*ReinitializationEvent,error)
typeSSEAgentReinitTransmitter¶added inv2.22.0
type SSEAgentReinitTransmitter struct {// contains filtered or unexported fields}
funcNewSSEAgentReinitTransmitter¶added inv2.22.0
func NewSSEAgentReinitTransmitter(loggerslog.Logger, rwhttp.ResponseWriter, r *http.Request) *SSEAgentReinitTransmitter
func (*SSEAgentReinitTransmitter)Transmit¶added inv2.22.0
func (s *SSEAgentReinitTransmitter) Transmit(ctxcontext.Context, reinitEvents <-chanReinitializationEvent)error
Transmit will read from the given chan and send events for as long as:* the chan remains open* the context has not been canceled* not timed out* the connection to the receiver remains open
typeScriptLogger¶added inv2.9.0
type ScriptLogger struct {// contains filtered or unexported fields}
typeStats¶
type Stats struct {// ConnectionsByProto is a count of connections by protocol.ConnectionsByProto map[string]int64 `json:"connections_by_proto"`// ConnectionCount is the number of connections received by an agent.ConnectionCountint64 `json:"connection_count"`// ConnectionMedianLatencyMS is the median latency of all connections in milliseconds.ConnectionMedianLatencyMSfloat64 `json:"connection_median_latency_ms"`// RxPackets is the number of received packets.RxPacketsint64 `json:"rx_packets"`// RxBytes is the number of received bytes.RxBytesint64 `json:"rx_bytes"`// TxPackets is the number of transmitted bytes.TxPacketsint64 `json:"tx_packets"`// TxBytes is the number of transmitted bytes.TxBytesint64 `json:"tx_bytes"`// SessionCountVSCode is the number of connections received by an agent// that are from our VS Code extension.SessionCountVSCodeint64 `json:"session_count_vscode"`// SessionCountJetBrains is the number of connections received by an agent// that are from our JetBrains extension.SessionCountJetBrainsint64 `json:"session_count_jetbrains"`// SessionCountReconnectingPTY is the number of connections received by an agent// that are from the reconnecting web terminal.SessionCountReconnectingPTYint64 `json:"session_count_reconnecting_pty"`// SessionCountSSH is the number of connections received by an agent// that are normal, non-tagged SSH sessions.SessionCountSSHint64 `json:"session_count_ssh"`// Metrics collected by the agentMetrics []AgentMetric `json:"metrics"`}
Stats records the Agent's network connection statistics for use inuser-facing metrics and debugging.