Documentation
¶
Index ¶
- func StartupLogsNotifyChannel(agentID uuid.UUID) string
- type AWSInstanceIdentityToken
- type AgentMetric
- type AgentMetricLabel
- type AgentMetricType
- type AuthenticateResponse
- type AzureInstanceIdentityToken
- 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) GitAuth(ctx context.Context, gitURL string, listen bool) (GitAuthResponse, error)
- func (c *Client) GitSSHKey(ctx context.Context) (GitSSHKey, error)
- func (c *Client) Listen(ctx context.Context) (net.Conn, error)
- func (c *Client) Manifest(ctx context.Context) (Manifest, error)
- func (c *Client) PatchStartupLogs(ctx context.Context, req PatchStartupLogs) error
- func (c *Client) PostAppHealth(ctx context.Context, req PostAppHealthsRequest) error
- func (c *Client) PostLifecycle(ctx context.Context, req PostLifecycleRequest) error
- func (c *Client) PostMetadata(ctx context.Context, key string, req PostMetadataRequest) error
- func (c *Client) PostStartup(ctx context.Context, req PostStartupRequest) error
- func (c *Client) PostStats(ctx context.Context, stats *Stats) (StatsResponse, error)
- func (c *Client) ReportStats(ctx context.Context, log slog.Logger, statsChan <-chan *Stats, ...) (io.Closer, error)
- func (c *Client) SetSessionToken(token string)
- type GitAuthResponse
- type GitSSHKey
- type GoogleInstanceIdentityToken
- type Manifest
- type PatchStartupLogs
- type PostAppHealthsRequest
- type PostLifecycleRequest
- type PostMetadataRequest
- type PostStartupRequest
- type StartupLog
- type StartupLogsNotifyMessage
- type Stats
- type StatsResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartupLogsNotifyChannel ¶ added in v0.21.0
StartupLogsNotifyChannel returns the channel name responsible for notifying of new startup logs.
Types ¶
type AgentMetric ¶ added in v0.23.1
type AgentMetric struct {
Name string `json:"name" validate:"required"`
Type AgentMetricType `json:"type" validate:"required" enums:"counter,gauge"`
Value float64 `json:"value" validate:"required"`
Labels []AgentMetricLabel `json:"labels,omitempty"`
}
type AgentMetricLabel ¶ added in v0.24.0
type AgentMetricType ¶ added in v0.23.1
type AgentMetricType string
const ( AgentMetricTypeCounter AgentMetricType = "counter" AgentMetricTypeGauge AgentMetricType = "gauge" )
type AuthenticateResponse ¶
type AuthenticateResponse struct {
SessionToken string `json:"session_token"`
}
AuthenticateResponse is returned when an instance ID has been exchanged for a session token. @typescript-ignore AuthenticateResponse
type Client ¶
Client wraps `codersdk.Client` with specific functions scoped to a workspace agent.
func (*Client) AuthAWSInstanceIdentity ¶
func (c *Client) AuthAWSInstanceIdentity(ctx context.Context) (AuthenticateResponse, error)
AuthWorkspaceAWSInstanceIdentity uses the Amazon Metadata API to fetch a signed payload, and exchange it for a session token for a workspace agent.
The requesting instance must be registered as a resource in the latest history for a workspace.
func (*Client) AuthAzureInstanceIdentity ¶
func (c *Client) AuthAzureInstanceIdentity(ctx context.Context) (AuthenticateResponse, error)
AuthWorkspaceAzureInstanceIdentity uses the Azure Instance Metadata Service to fetch a signed payload, and exchange it for a session token for a workspace agent.
func (*Client) AuthGoogleInstanceIdentity ¶
func (c *Client) AuthGoogleInstanceIdentity(ctx context.Context, serviceAccount string, gcpClient *metadata.Client) (AuthenticateResponse, error)
AuthWorkspaceGoogleInstanceIdentity uses the Google Compute Engine Metadata API to fetch a signed JWT, and exchange it for a session token for a workspace agent.
The requesting instance must be registered as a resource in the latest history for a workspace.
func (*Client) GitAuth ¶
GitAuth submits a URL to fetch a GIT_ASKPASS username and password for. nolint:revive
func (*Client) Listen ¶
Listen connects to the workspace agent coordinate WebSocket that handles connection negotiation.
func (*Client) Manifest ¶ added in v0.21.3
Manifest fetches manifest for the currently authenticated workspace agent.
func (*Client) PatchStartupLogs ¶ added in v0.21.0
func (c *Client) PatchStartupLogs(ctx context.Context, req PatchStartupLogs) error
PatchStartupLogs writes log messages to the agent startup script. Log messages are limited to 1MB in total.
func (*Client) PostAppHealth ¶
func (c *Client) PostAppHealth(ctx context.Context, req PostAppHealthsRequest) error
PostAppHealth updates the workspace agent app health status.
func (*Client) PostLifecycle ¶
func (c *Client) PostLifecycle(ctx context.Context, req PostLifecycleRequest) error
func (*Client) PostMetadata ¶ added in v0.21.3
func (*Client) PostStartup ¶ added in v0.17.1
func (c *Client) PostStartup(ctx context.Context, req PostStartupRequest) error
func (*Client) ReportStats ¶
func (c *Client) ReportStats(ctx context.Context, log slog.Logger, statsChan <-chan *Stats, setInterval func(time.Duration)) (io.Closer, error)
ReportStats begins a stat streaming connection with the Coder server. It is resilient to network failures and intermittent coderd issues.
func (*Client) SetSessionToken ¶
type GitAuthResponse ¶
type GoogleInstanceIdentityToken ¶
type GoogleInstanceIdentityToken struct {
JSONWebToken string `json:"json_web_token" validate:"required"`
}
type Manifest ¶ added in v0.21.3
type Manifest struct {
// GitAuthConfigs stores the number of Git configurations
// the Coder deployment has. If this number is >0, we
// set up special configuration in the workspace.
GitAuthConfigs int `json:"git_auth_configs"`
VSCodePortProxyURI string `json:"vscode_port_proxy_uri"`
Apps []codersdk.WorkspaceApp `json:"apps"`
DERPMap *tailcfg.DERPMap `json:"derpmap"`
EnvironmentVariables map[string]string `json:"environment_variables"`
StartupScript string `json:"startup_script"`
StartupScriptTimeout time.Duration `json:"startup_script_timeout"`
Directory string `json:"directory"`
MOTDFile string `json:"motd_file"`
ShutdownScript string `json:"shutdown_script"`
ShutdownScriptTimeout time.Duration `json:"shutdown_script_timeout"`
Metadata []codersdk.WorkspaceAgentMetadataDescription `json:"metadata"`
}
type PatchStartupLogs ¶ added in v0.21.0
type PatchStartupLogs struct {
Logs []StartupLog `json:"logs"`
}
type PostAppHealthsRequest ¶
type PostAppHealthsRequest struct {
// Healths is a map of the workspace app name and the health of the app.
Healths map[uuid.UUID]codersdk.WorkspaceAppHealth
}
type PostLifecycleRequest ¶
type PostLifecycleRequest struct {
State codersdk.WorkspaceAgentLifecycle `json:"state"`
}
type PostMetadataRequest ¶ added in v0.21.3
type PostMetadataRequest = codersdk.WorkspaceAgentMetadataResult
In the future, we may want to support sending back multiple values for performance.
type PostStartupRequest ¶ added in v0.17.1
type PostStartupRequest struct {
Version string `json:"version"`
ExpandedDirectory string `json:"expanded_directory"`
Subsystem codersdk.AgentSubsystem `json:"subsystem"`
}
type StartupLog ¶ added in v0.21.0
type StartupLogsNotifyMessage ¶ added in v0.21.0
type Stats ¶
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.
ConnectionCount int64 `json:"connection_count"`
// ConnectionMedianLatencyMS is the median latency of all connections in milliseconds.
ConnectionMedianLatencyMS float64 `json:"connection_median_latency_ms"`
// RxPackets is the number of received packets.
RxPackets int64 `json:"rx_packets"`
// RxBytes is the number of received bytes.
RxBytes int64 `json:"rx_bytes"`
// TxPackets is the number of transmitted bytes.
TxPackets int64 `json:"tx_packets"`
// TxBytes is the number of transmitted bytes.
TxBytes int64 `json:"tx_bytes"`
// SessionCountVSCode is the number of connections received by an agent
// that are from our VS Code extension.
SessionCountVSCode int64 `json:"session_count_vscode"`
// SessionCountJetBrains is the number of connections received by an agent
// that are from our JetBrains extension.
SessionCountJetBrains int64 `json:"session_count_jetbrains"`
// SessionCountReconnectingPTY is the number of connections received by an agent
// that are from the reconnecting web terminal.
SessionCountReconnectingPTY int64 `json:"session_count_reconnecting_pty"`
// SessionCountSSH is the number of connections received by an agent
// that are normal, non-tagged SSH sessions.
SessionCountSSH int64 `json:"session_count_ssh"`
// Metrics collected by the agent
Metrics []AgentMetric `json:"metrics"`
}
Stats records the Agent's network connection statistics for use in user-facing metrics and debugging.