agentapi
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¶
- func WatchWorkspaceAgentMetadataChannel(id uuid.UUID) string
- func WithAPIVersion(ctx context.Context, version string) context.Context
- type API
- type AnnouncementBannerAPI
- func (a *AnnouncementBannerAPI) GetAnnouncementBanners(ctx context.Context, _ *proto.GetAnnouncementBannersRequest) (*proto.GetAnnouncementBannersResponse, error)
- func (a *AnnouncementBannerAPI) GetServiceBanner(ctx context.Context, _ *proto.GetServiceBannerRequest) (*proto.ServiceBanner, error)deprecated
- type AppsAPI
- type CachedWorkspaceFields
- type ConnLogAPI
- type LifecycleAPI
- type LogsAPI
- type ManifestAPI
- type MetadataAPI
- type Options
- type ResourcesMonitoringAPI
- func (a *ResourcesMonitoringAPI) GetResourcesMonitoringConfiguration(_ context.Context, _ *proto.GetResourcesMonitoringConfigurationRequest) (*proto.GetResourcesMonitoringConfigurationResponse, error)
- func (a *ResourcesMonitoringAPI) InitMonitors(ctx context.Context) error
- func (a *ResourcesMonitoringAPI) PushResourcesMonitoringUsage(ctx context.Context, req *proto.PushResourcesMonitoringUsageRequest) (*proto.PushResourcesMonitoringUsageResponse, error)
- type ScriptsAPI
- type StatsAPI
- type SubAgentAPI
- func (a *SubAgentAPI) CreateSubAgent(ctx context.Context, req *agentproto.CreateSubAgentRequest) (*agentproto.CreateSubAgentResponse, error)
- func (a *SubAgentAPI) DeleteSubAgent(ctx context.Context, req *agentproto.DeleteSubAgentRequest) (*agentproto.DeleteSubAgentResponse, error)
- func (a *SubAgentAPI) ListSubAgents(ctx context.Context, _ *agentproto.ListSubAgentsRequest) (*agentproto.ListSubAgentsResponse, error)
- type WorkspaceAgentMetadataChannelPayload
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
Types¶
typeAPI¶
type API struct {*ManifestAPI*AnnouncementBannerAPI*StatsAPI*LifecycleAPI*AppsAPI*MetadataAPI*ResourcesMonitoringAPI*LogsAPI*ScriptsAPI*ConnLogAPI*SubAgentAPI*tailnet.DRPCService// contains filtered or unexported fields}API implements the DRPC agent API interface from agent/proto. This struct isinstantiated once per agent connection and kept alive for the duration of thesession.
typeAnnouncementBannerAPI¶added inv2.12.0
type AnnouncementBannerAPI struct {// contains filtered or unexported fields}func (*AnnouncementBannerAPI)GetAnnouncementBanners¶added inv2.12.0
func (a *AnnouncementBannerAPI) GetAnnouncementBanners(ctxcontext.Context, _ *proto.GetAnnouncementBannersRequest) (*proto.GetAnnouncementBannersResponse,error)
func (*AnnouncementBannerAPI)GetServiceBannerdeprecatedadded inv2.12.0
func (a *AnnouncementBannerAPI) GetServiceBanner(ctxcontext.Context, _ *proto.GetServiceBannerRequest) (*proto.ServiceBanner,error)
Deprecated: GetServiceBanner has been deprecated in favor of GetAnnouncementBanners.
typeAppsAPI¶
type AppsAPI struct {AgentFn func(context.Context) (database.WorkspaceAgent,error)Databasedatabase.StoreLogslog.LoggerPublishWorkspaceUpdateFn func(context.Context, *database.WorkspaceAgent,wspubsub.WorkspaceEventKind)error}func (*AppsAPI)BatchUpdateAppHealths¶
func (a *AppsAPI) BatchUpdateAppHealths(ctxcontext.Context, req *agentproto.BatchUpdateAppHealthRequest) (*agentproto.BatchUpdateAppHealthResponse,error)
typeCachedWorkspaceFields¶added inv2.29.0
type CachedWorkspaceFields struct {// contains filtered or unexported fields}CachedWorkspaceFields contains workspace data that is safe to cache for theduration of an agent connection. These fields are used to reduce database callsin high-frequency operations like stats reporting and metadata updates.Prebuild workspaces should not be cached using this struct within the API struct,however some of these fields for a workspace can be updated live so there is aroutine in the API for refreshing the workspace on a timed interval.
IMPORTANT: ACL fields (GroupACL, UserACL) are NOT cached because they can bemodified in the database and we must use fresh data for authorization checks.
func (*CachedWorkspaceFields)AsWorkspaceIdentity¶added inv2.29.0
func (cws *CachedWorkspaceFields) AsWorkspaceIdentity() (database.WorkspaceIdentity,bool)
Returns the Workspace, true, unless the workspace has not been cached (nuked or was a prebuild).
func (*CachedWorkspaceFields)Clear¶added inv2.29.0
func (cws *CachedWorkspaceFields) Clear()
func (*CachedWorkspaceFields)UpdateValues¶added inv2.29.0
func (cws *CachedWorkspaceFields) UpdateValues(wsdatabase.Workspace)
typeConnLogAPI¶added inv2.25.0
type ConnLogAPI struct {AgentFn func(context.Context) (database.WorkspaceAgent,error)ConnectionLogger *atomic.Pointer[connectionlog.ConnectionLogger]Databasedatabase.StoreLogslog.Logger}func (*ConnLogAPI)ReportConnection¶added inv2.25.0
func (a *ConnLogAPI) ReportConnection(ctxcontext.Context, req *agentproto.ReportConnectionRequest) (*emptypb.Empty,error)
typeLifecycleAPI¶
type LifecycleAPI struct {AgentFn func(context.Context) (database.WorkspaceAgent,error)WorkspaceIDuuid.UUIDDatabasedatabase.StoreLogslog.LoggerPublishWorkspaceUpdateFn func(context.Context, *database.WorkspaceAgent,wspubsub.WorkspaceEventKind)errorTimeNowFn func()time.Time// defaults to dbtime.Now()}func (*LifecycleAPI)UpdateLifecycle¶
func (a *LifecycleAPI) UpdateLifecycle(ctxcontext.Context, req *agentproto.UpdateLifecycleRequest) (*agentproto.Lifecycle,error)
func (*LifecycleAPI)UpdateStartup¶
func (a *LifecycleAPI) UpdateStartup(ctxcontext.Context, req *agentproto.UpdateStartupRequest) (*agentproto.Startup,error)
typeLogsAPI¶
type LogsAPI struct {AgentFn func(context.Context) (database.WorkspaceAgent,error)Databasedatabase.StoreLogslog.LoggerPublishWorkspaceUpdateFn func(context.Context, *database.WorkspaceAgent,wspubsub.WorkspaceEventKind)errorPublishWorkspaceAgentLogsUpdateFn func(ctxcontext.Context, workspaceAgentIDuuid.UUID, msgagentsdk.LogsNotifyMessage)TimeNowFn func()time.Time// defaults to dbtime.Now()}func (*LogsAPI)BatchCreateLogs¶
func (a *LogsAPI) BatchCreateLogs(ctxcontext.Context, req *agentproto.BatchCreateLogsRequest) (*agentproto.BatchCreateLogsResponse,error)
typeManifestAPI¶
type ManifestAPI struct {AccessURL *url.URLAppHostnamestringExternalAuthConfigs []*externalauth.ConfigDisableDirectConnectionsboolDerpForceWebSocketsboolWorkspaceIDuuid.UUIDAgentFn func(context.Context) (database.WorkspaceAgent,error)Databasedatabase.StoreDerpMapFn func() *tailcfg.DERPMap}func (*ManifestAPI)GetManifest¶
func (a *ManifestAPI) GetManifest(ctxcontext.Context, _ *agentproto.GetManifestRequest) (*agentproto.Manifest,error)
typeMetadataAPI¶
type MetadataAPI struct {AgentFn func(context.Context) (database.WorkspaceAgent,error)Workspace *CachedWorkspaceFieldsDatabasedatabase.StorePubsubpubsub.PubsubLogslog.LoggerTimeNowFn func()time.Time// defaults to dbtime.Now()}func (*MetadataAPI)BatchUpdateMetadata¶
func (a *MetadataAPI) BatchUpdateMetadata(ctxcontext.Context, req *agentproto.BatchUpdateMetadataRequest) (*agentproto.BatchUpdateMetadataResponse,error)
typeOptions¶
type Options struct {AgentIDuuid.UUIDOwnerIDuuid.UUIDWorkspaceIDuuid.UUIDOrganizationIDuuid.UUIDAuthenticatedCtxcontext.ContextLogslog.LoggerClockquartz.ClockDatabasedatabase.StoreNotificationsEnqueuernotifications.EnqueuerPubsubpubsub.PubsubConnectionLogger *atomic.Pointer[connectionlog.ConnectionLogger]DerpMapFn func() *tailcfg.DERPMapTailnetCoordinator *atomic.Pointer[tailnet.Coordinator]StatsReporter *workspacestats.ReporterAppearanceFetcher *atomic.Pointer[appearance.Fetcher]PublishWorkspaceUpdateFn func(ctxcontext.Context, userIDuuid.UUID, eventwspubsub.WorkspaceEvent)PublishWorkspaceAgentLogsUpdateFn func(ctxcontext.Context, workspaceAgentIDuuid.UUID, msgagentsdk.LogsNotifyMessage)NetworkTelemetryHandler func(batch []*tailnetproto.TelemetryEvent)AccessURL *url.URLAppHostnamestringAgentStatsRefreshIntervaltime.DurationDisableDirectConnectionsboolDerpForceWebSocketsboolDerpMapUpdateFrequencytime.DurationExternalAuthConfigs []*externalauth.ConfigExperimentscodersdk.ExperimentsUpdateAgentMetricsFn func(ctxcontext.Context, labelsprometheusmetrics.AgentMetricLabels, metrics []*agentproto.Stats_Metric)}typeResourcesMonitoringAPI¶added inv2.20.0
type ResourcesMonitoringAPI struct {AgentIDuuid.UUIDWorkspaceIDuuid.UUIDLogslog.LoggerClockquartz.ClockDatabasedatabase.StoreNotificationsEnqueuernotifications.EnqueuerDebouncetime.DurationConfigresourcesmonitor.Config// contains filtered or unexported fields}func (*ResourcesMonitoringAPI)GetResourcesMonitoringConfiguration¶added inv2.20.0
func (a *ResourcesMonitoringAPI) GetResourcesMonitoringConfiguration(_context.Context, _ *proto.GetResourcesMonitoringConfigurationRequest) (*proto.GetResourcesMonitoringConfigurationResponse,error)
func (*ResourcesMonitoringAPI)InitMonitors¶added inv2.28.0
func (a *ResourcesMonitoringAPI) InitMonitors(ctxcontext.Context)error
InitMonitors fetches resource monitors from the database and caches them.This must be called once after creating a ResourcesMonitoringAPI, the context should bethe agent per-RPC connection context. If fetching fails with a real error (not sql.ErrNoRows), theconnection should be torn down.
func (*ResourcesMonitoringAPI)PushResourcesMonitoringUsage¶added inv2.20.0
func (a *ResourcesMonitoringAPI) PushResourcesMonitoringUsage(ctxcontext.Context, req *proto.PushResourcesMonitoringUsageRequest) (*proto.PushResourcesMonitoringUsageResponse,error)
typeScriptsAPI¶added inv2.16.0
func (*ScriptsAPI)ScriptCompleted¶added inv2.16.0
func (s *ScriptsAPI) ScriptCompleted(ctxcontext.Context, req *agentproto.WorkspaceAgentScriptCompletedRequest) (*agentproto.WorkspaceAgentScriptCompletedResponse,error)
typeStatsAPI¶
type StatsAPI struct {AgentFn func(context.Context) (database.WorkspaceAgent,error)Workspace *CachedWorkspaceFieldsDatabasedatabase.StoreLogslog.LoggerStatsReporter *workspacestats.ReporterAgentStatsRefreshIntervaltime.DurationExperimentscodersdk.ExperimentsTimeNowFn func()time.Time// defaults to dbtime.Now()}func (*StatsAPI)UpdateStats¶
func (a *StatsAPI) UpdateStats(ctxcontext.Context, req *agentproto.UpdateStatsRequest) (*agentproto.UpdateStatsResponse,error)
typeSubAgentAPI¶added inv2.24.0
type SubAgentAPI struct {OwnerIDuuid.UUIDOrganizationIDuuid.UUIDAgentIDuuid.UUIDAgentFn func(context.Context) (database.WorkspaceAgent,error)Logslog.LoggerClockquartz.ClockDatabasedatabase.Store}func (*SubAgentAPI)CreateSubAgent¶added inv2.24.0
func (a *SubAgentAPI) CreateSubAgent(ctxcontext.Context, req *agentproto.CreateSubAgentRequest) (*agentproto.CreateSubAgentResponse,error)
func (*SubAgentAPI)DeleteSubAgent¶added inv2.24.0
func (a *SubAgentAPI) DeleteSubAgent(ctxcontext.Context, req *agentproto.DeleteSubAgentRequest) (*agentproto.DeleteSubAgentResponse,error)
func (*SubAgentAPI)ListSubAgents¶added inv2.24.0
func (a *SubAgentAPI) ListSubAgents(ctxcontext.Context, _ *agentproto.ListSubAgentsRequest) (*agentproto.ListSubAgentsResponse,error)