Documentation
¶
Overview ¶
Package environment owns environment persistence, remote runtime state, pairing, synchronization, and its HTTP and stream surfaces.
Index ¶
- Constants
- Variables
- func ApplyEnvironmentRuntimeState(env environment.Environment) environment.Environment
- func DisplayName(environmentID, storedName string) string
- func RegisterEnvironments(api huma.API, h *EnvironmentHandler)
- type CreateEnvironmentInput
- type DeleteEnvironmentInput
- type DeploymentSnippet
- type DeploymentSnippetFile
- type DeploymentSnippetMTLS
- type DeploymentSnippets
- type DownloadEdgeMTLSCAInput
- type DownloadEnvironmentMTLSBundleInput
- type DownloadEnvironmentMTLSFileInput
- type Environment
- type EnvironmentHandler
- func (h *EnvironmentHandler) CreateEnvironment(ctx context.Context, input *CreateEnvironmentInput) (*handlerutil.Out[EnvironmentWithApiKey], error)
- func (h *EnvironmentHandler) DeleteEnvironment(ctx context.Context, input *DeleteEnvironmentInput) (*handlerutil.Out[base.MessageResponse], error)
- func (h *EnvironmentHandler) DownloadEdgeMTLSCA(ctx context.Context, _ *DownloadEdgeMTLSCAInput) (*huma.StreamResponse, error)
- func (h *EnvironmentHandler) DownloadEnvironmentMTLSBundle(ctx context.Context, input *DownloadEnvironmentMTLSBundleInput) (*huma.StreamResponse, error)
- func (h *EnvironmentHandler) DownloadEnvironmentMTLSFile(ctx context.Context, input *DownloadEnvironmentMTLSFileInput) (*huma.StreamResponse, error)
- func (h *EnvironmentHandler) GetDeploymentSnippets(ctx context.Context, input *GetDeploymentSnippetsInput) (*handlerutil.Out[DeploymentSnippet], error)
- func (h *EnvironmentHandler) GetEnvironment(ctx context.Context, input *GetEnvironmentInput) (*handlerutil.Out[environment.Environment], error)
- func (h *EnvironmentHandler) GetEnvironmentVersion(ctx context.Context, input *GetEnvironmentVersionInput) (*handlerutil.Out[version.Info], error)
- func (h *EnvironmentHandler) ListEnvironments(ctx context.Context, input *ListEnvironmentsInput) (*handlerutil.Page[environment.Environment], error)
- func (h *EnvironmentHandler) PairAgent(ctx context.Context, input *PairAgentInput) (*handlerutil.Out[environment.AgentPairResponse], error)
- func (h *EnvironmentHandler) PairEnvironment(ctx context.Context, input *PairEnvironmentInput) (*handlerutil.Out[base.MessageResponse], error)
- func (h *EnvironmentHandler) RunStreamProducer(ctx context.Context, ps *authz.PermissionSet, ...)
- func (h *EnvironmentHandler) SyncEnvironment(ctx context.Context, input *SyncEnvironmentInput) (*handlerutil.Out[base.MessageResponse], error)
- func (h *EnvironmentHandler) TestConnection(ctx context.Context, input *TestConnectionInput) (*handlerutil.Out[environment.Test], error)
- func (h *EnvironmentHandler) UpdateEnvironment(ctx context.Context, input *UpdateEnvironmentInput) (*handlerutil.Out[environment.Environment], error)
- func (h *EnvironmentHandler) UpdateHeartbeat(ctx context.Context, input *UpdateHeartbeatInput) (*handlerutil.Out[base.MessageResponse], error)
- type EnvironmentService
- func (s *EnvironmentService) BindSwarmNodeEnvironment(ctx context.Context, parentEnvironmentID, nodeID, environmentID string, ...) (*Environment, error)
- func (s *EnvironmentService) CheckS3DestinationReferences(ctx context.Context, destinationID string) error
- func (s *EnvironmentService) CreateEnvironment(ctx context.Context, env *Environment, userID, username *string) (*Environment, error)
- func (s *EnvironmentService) DeleteEnvironment(ctx context.Context, id string, userID, username *string) error
- func (s *EnvironmentService) DeleteSwarmNodeAgentDeployment(ctx context.Context, parentEnvironmentID, nodeID string, ...) error
- func (s *EnvironmentService) DetachSwarmNodeEnvironment(ctx context.Context, parentEnvironmentID, nodeID string) error
- func (s *EnvironmentService) EnsureLocalEnvironment(ctx context.Context, appUrl string) error
- func (s *EnvironmentService) EnsureSwarmNodeAgentEnvironment(ctx context.Context, ...) (*Environment, string, error)
- func (s *EnvironmentService) ExecuteRemoteRequest(ctx context.Context, envID, method, path string, body []byte) (*remenv.Response, error)
- func (s *EnvironmentService) ForgetSyncState(environmentID string)
- func (s *EnvironmentService) GenerateDeploymentSnippets(ctx context.Context, envID, managerURL, agentURL, apiKey string) (*DeploymentSnippets, error)
- func (s *EnvironmentService) GenerateEdgeDeploymentSnippets(ctx context.Context, envID, managerURL, apiKey string, edgeCfg *edge.Config) (*DeploymentSnippets, error)
- func (s *EnvironmentService) GetActiveRemoteEnvironmentSnapshot(environmentID string) mo.Option[Environment]
- func (s *EnvironmentService) GetDB() *database.DB
- func (s *EnvironmentService) GetEnabledRegistryCredentials(ctx context.Context) ([]containerregistry.Credential, error)
- func (s *EnvironmentService) GetEnvironmentByID(ctx context.Context, id string) (*Environment, error)
- func (s *EnvironmentService) GetEnvironmentByIDCached(ctx context.Context, id string) (*Environment, error)
- func (s *EnvironmentService) IsKnownAccessToken(token string) bool
- func (s *EnvironmentService) ListActiveRemoteEnvironments(ctx context.Context) ([]Environment, error)
- func (s *EnvironmentService) ListEnabledEnvironmentIDs(ctx context.Context) ([]string, error)
- func (s *EnvironmentService) ListEnabledRemoteEnvironments(ctx context.Context) ([]Environment, error)
- func (s *EnvironmentService) ListEnvironmentsPaginated(ctx context.Context, params pagination.QueryParams, accessibleEnvIDs []string) ([]environment.Environment, pagination.Response, error)
- func (s *EnvironmentService) ListRemoteEnvironmentIDs(ctx context.Context) ([]string, error)
- func (s *EnvironmentService) ListRemoteEnvironments(ctx context.Context) ([]Environment, error)
- func (s *EnvironmentService) ListSwarmNodeAgentEnvironments(ctx context.Context, parentEnvironmentID string) ([]Environment, error)
- func (s *EnvironmentService) ListSwarmNodeCandidateEnvironments(ctx context.Context) ([]Environment, error)
- func (s *EnvironmentService) ListVisibleEnvironments(ctx context.Context) ([]environment.Environment, error)
- func (s *EnvironmentService) LoadAccessTokens(ctx context.Context) error
- func (s *EnvironmentService) NotifyRuntimeStateChanged()
- func (s *EnvironmentService) ProxyJSONRequest(ctx context.Context, envID, method, path string, body []byte, out any) error
- func (s *EnvironmentService) ProxyJSONRequestForEnvironment(ctx context.Context, env Environment, method, path string, body []byte, ...) error
- func (s *EnvironmentService) ProxyRequest(ctx context.Context, envID, method, path string, body []byte) ([]byte, int, error)
- func (s *EnvironmentService) QueueRemoteSync(ctx context.Context, kind string, syncAll func(context.Context) error)
- func (s *EnvironmentService) ReconcileEdgeStatusesOnStartup(ctx context.Context) error
- func (s *EnvironmentService) RegenerateEnvironmentApiKey(ctx context.Context, env *Environment, userID, username string) (string, error)
- func (s *EnvironmentService) RegisterMetrics()
- func (s *EnvironmentService) RescheduleHealthJobs(ctx context.Context)
- func (s *EnvironmentService) ResolveEdgeEnvironmentByToken(ctx context.Context, token string) (string, error)
- func (s *EnvironmentService) ResolveEnvironmentByAccessToken(ctx context.Context, token string) (*Environment, error)
- func (s *EnvironmentService) ResolveEnvironmentName(ctx context.Context, environmentID string) string
- func (s *EnvironmentService) RunHealthChecksNow(ctx context.Context) error
- func (s *EnvironmentService) SetScheduler(ctx context.Context, jobScheduler scheduler.DynamicScheduler, ...) error
- func (s *EnvironmentService) SetUserInvalidator(invalidate func(userID string))
- func (s *EnvironmentService) SetVariableSyncer(syncer VariableSyncer)
- func (s *EnvironmentService) SubscribeRuntimeChanges() (<-chan struct{}, func())
- func (s *EnvironmentService) SyncRegistriesToEnvironment(ctx context.Context, environmentID string) error
- func (s *EnvironmentService) SyncRegistriesToRemoteEnvironments(ctx context.Context) error
- func (s *EnvironmentService) SyncRepositoriesToEnvironment(ctx context.Context, environmentID string) error
- func (s *EnvironmentService) SyncResourcesToEnvironment(ctx context.Context, environmentID string, user *usertypes.Actor, ...) (string, error)
- func (s *EnvironmentService) SyncS3DestinationsToEnvironment(ctx context.Context, environmentID string) error
- func (s *EnvironmentService) SyncS3DestinationsToRemoteEnvironments(ctx context.Context) error
- func (s *EnvironmentService) TestConnection(ctx context.Context, id string, customApiUrl *string) (string, error)
- func (s *EnvironmentService) UpdateEnvironment(ctx context.Context, id string, updates map[string]any, ...) (*Environment, error)
- func (s *EnvironmentService) UpdateEnvironmentConnectionState(ctx context.Context, id string, connected bool) error
- func (s *EnvironmentService) UpdateEnvironmentHeartbeat(ctx context.Context, id string) error
- func (s *EnvironmentService) UpdateSwarmNodeIdentity(ctx context.Context, envID, swarmNodeID string) error
- type EnvironmentStatus
- type EnvironmentWithApiKey
- type GetDeploymentSnippetsInput
- type GetEnvironmentInput
- type GetEnvironmentVersionInput
- type ListEnvironmentsInput
- type Module
- type PairAgentInput
- type PairEnvironmentInput
- type SyncEnvironmentInput
- type TestConnectionInput
- type UpdateEnvironmentInput
- type UpdateHeartbeatInput
- type VariableSyncer
Constants ¶
const ( // LocalEnvironmentID is the reserved ID of the environment Arcane manages directly. LocalEnvironmentID = "0" // SyncDeliveryExpiry bounds how long an accepted config push is trusted, so a // rebuilt agent that stayed online is resynced without operator action. SyncDeliveryExpiry = time.Hour )
Variables ¶
Functions ¶
func ApplyEnvironmentRuntimeState ¶
func ApplyEnvironmentRuntimeState(env environment.Environment) environment.Environment
ApplyEnvironmentRuntimeState overlays in-memory tunnel and poll state onto an edge environment without mutating persisted state.
func DisplayName ¶
DisplayName returns the stored environment name or its readable fallback.
func RegisterEnvironments ¶
func RegisterEnvironments(api huma.API, h *EnvironmentHandler)
RegisterEnvironments registers all environment management endpoints.
Types ¶
type CreateEnvironmentInput ¶
type CreateEnvironmentInput struct {
Body environment.Create
}
type DeleteEnvironmentInput ¶
type DeleteEnvironmentInput struct {
ID string `path:"id" doc:"Environment ID"`
}
type DeploymentSnippet ¶
type DeploymentSnippet struct {
DockerRun string `json:"dockerRun" doc:"Docker run command snippet"`
DockerCompose string `json:"dockerCompose" doc:"Docker compose YAML snippet"`
MTLS *DeploymentSnippetMTLS `json:"mtls,omitempty" doc:"Optional Arcane-generated mTLS deployment assets for edge agents"`
}
type DeploymentSnippetFile ¶
type DeploymentSnippetFile struct {
Name string `json:"name" doc:"Suggested filename"`
Content string `json:"content,omitempty" doc:"PEM file contents. Omitted for sensitive files such as private keys; use downloadUrl instead."`
DownloadURL string `json:"downloadUrl,omitempty" doc:"Pairing-permission endpoint to download this file when content is withheld"`
Sensitive bool `json:"sensitive,omitempty" doc:"True when this file is sensitive and must be fetched via downloadUrl"`
ContainerPath string `json:"containerPath" doc:"Container mount path expected by the mTLS snippet"`
Permissions string `json:"permissions" doc:"Suggested file mode"`
}
type DeploymentSnippetMTLS ¶
type DeploymentSnippetMTLS struct {
DockerRun string `json:"dockerRun" doc:"Docker run snippet using Arcane-generated mTLS assets"`
DockerCompose string `json:"dockerCompose" doc:"Docker compose snippet using Arcane-generated mTLS assets"`
Files []DeploymentSnippetFile `json:"files" doc:"Generated PEM files to place on the edge host"`
HostDirHint string `json:"hostDirHint" doc:"Suggested host directory containing the generated PEM files"`
}
type DeploymentSnippets ¶
type DeploymentSnippets struct {
DockerRun string
DockerCompose string
MTLS *DeploymentSnippetMTLS
}
DeploymentSnippets contains deployment configuration snippets for an environment.
type DownloadEdgeMTLSCAInput ¶
type DownloadEdgeMTLSCAInput struct{}
type DownloadEnvironmentMTLSBundleInput ¶
type DownloadEnvironmentMTLSBundleInput struct {
ID string `path:"id" doc:"Environment ID"`
}
type Environment ¶ added in v2.8.1
type Environment struct {
database.BaseModel
Name string `json:"name" sortable:"true" unorm:"nfc" trim:"true"`
ApiUrl string `json:"apiUrl" gorm:"column:api_url" sortable:"true"`
Status string `json:"status" sortable:"true"`
Enabled bool `json:"enabled" sortable:"true"`
IsEdge bool `json:"isEdge" gorm:"column:is_edge;default:false"`
Hidden bool `json:"hidden" gorm:"column:hidden;default:false"`
LastSeen *time.Time `json:"lastSeen" gorm:"column:last_seen"`
LastEdgeTransport *string `json:"lastEdgeTransport" gorm:"column:last_edge_transport"`
AccessToken *string `json:"-" gorm:"column:access_token"`
ApiKeyID *string `json:"-" gorm:"column:api_key_id"`
ParentEnvironmentID *string `json:"-" gorm:"column:parent_environment_id"`
SwarmNodeID *string `json:"-" gorm:"column:swarm_node_id"`
}
func (Environment) TableName ¶ added in v2.8.1
func (Environment) TableName() string
type EnvironmentHandler ¶
type EnvironmentHandler struct {
// contains filtered or unexported fields
}
EnvironmentHandler handles environment management endpoints.
func NewHandler ¶
func NewHandler( environmentService *EnvironmentService, settingsService *settings.SettingsService, apiKeyService *apikey.ApiKeyService, eventService *event.EventService, cfg *config.Config, activityService activity.Service, ) *EnvironmentHandler
NewHandler builds the environment HTTP handler and its stream producer.
func (*EnvironmentHandler) CreateEnvironment ¶
func (h *EnvironmentHandler) CreateEnvironment(ctx context.Context, input *CreateEnvironmentInput) (*handlerutil.Out[EnvironmentWithApiKey], error)
CreateEnvironment creates a new environment.
func (*EnvironmentHandler) DeleteEnvironment ¶
func (h *EnvironmentHandler) DeleteEnvironment(ctx context.Context, input *DeleteEnvironmentInput) (*handlerutil.Out[base.MessageResponse], error)
DeleteEnvironment deletes an environment.
func (*EnvironmentHandler) DownloadEdgeMTLSCA ¶
func (h *EnvironmentHandler) DownloadEdgeMTLSCA(ctx context.Context, _ *DownloadEdgeMTLSCAInput) (*huma.StreamResponse, error)
DownloadEdgeMTLSCA downloads the Arcane-managed edge mTLS CA certificate.
func (*EnvironmentHandler) DownloadEnvironmentMTLSBundle ¶
func (h *EnvironmentHandler) DownloadEnvironmentMTLSBundle(ctx context.Context, input *DownloadEnvironmentMTLSBundleInput) (*huma.StreamResponse, error)
func (*EnvironmentHandler) DownloadEnvironmentMTLSFile ¶
func (h *EnvironmentHandler) DownloadEnvironmentMTLSFile(ctx context.Context, input *DownloadEnvironmentMTLSFileInput) (*huma.StreamResponse, error)
func (*EnvironmentHandler) GetDeploymentSnippets ¶
func (h *EnvironmentHandler) GetDeploymentSnippets(ctx context.Context, input *GetDeploymentSnippetsInput) (*handlerutil.Out[DeploymentSnippet], error)
GetDeploymentSnippets returns deployment snippets for an environment.
func (*EnvironmentHandler) GetEnvironment ¶
func (h *EnvironmentHandler) GetEnvironment(ctx context.Context, input *GetEnvironmentInput) (*handlerutil.Out[environment.Environment], error)
GetEnvironment returns an environment by ID.
func (*EnvironmentHandler) GetEnvironmentVersion ¶
func (h *EnvironmentHandler) GetEnvironmentVersion(ctx context.Context, input *GetEnvironmentVersionInput) (*handlerutil.Out[version.Info], error)
GetEnvironmentVersion returns the version of the local or a remote environment.
func (*EnvironmentHandler) ListEnvironments ¶
func (h *EnvironmentHandler) ListEnvironments(ctx context.Context, input *ListEnvironmentsInput) (*handlerutil.Page[environment.Environment], error)
ListEnvironments returns a paginated list of environments.
func (*EnvironmentHandler) PairAgent ¶
func (h *EnvironmentHandler) PairAgent(ctx context.Context, input *PairAgentInput) (*handlerutil.Out[environment.AgentPairResponse], error)
PairAgent generates or rotates the local agent pairing token.
func (*EnvironmentHandler) PairEnvironment ¶
func (h *EnvironmentHandler) PairEnvironment(ctx context.Context, input *PairEnvironmentInput) (*handlerutil.Out[base.MessageResponse], error)
PairEnvironment handles agent pairing callback with API key.
func (*EnvironmentHandler) RunStreamProducer ¶
func (h *EnvironmentHandler) RunStreamProducer(ctx context.Context, ps *authz.PermissionSet, events chan<- environment.StreamEvent)
func (*EnvironmentHandler) SyncEnvironment ¶
func (h *EnvironmentHandler) SyncEnvironment(ctx context.Context, input *SyncEnvironmentInput) (*handlerutil.Out[base.MessageResponse], error)
SyncEnvironment syncs manager-owned resources to an environment.
func (*EnvironmentHandler) TestConnection ¶
func (h *EnvironmentHandler) TestConnection(ctx context.Context, input *TestConnectionInput) (*handlerutil.Out[environment.Test], error)
TestConnection tests connectivity to an environment.
func (*EnvironmentHandler) UpdateEnvironment ¶
func (h *EnvironmentHandler) UpdateEnvironment(ctx context.Context, input *UpdateEnvironmentInput) (*handlerutil.Out[environment.Environment], error)
UpdateEnvironment updates an environment.
func (*EnvironmentHandler) UpdateHeartbeat ¶
func (h *EnvironmentHandler) UpdateHeartbeat(ctx context.Context, input *UpdateHeartbeatInput) (*handlerutil.Out[base.MessageResponse], error)
UpdateHeartbeat updates the heartbeat for an environment.
type EnvironmentService ¶
type EnvironmentService struct {
// contains filtered or unexported fields
}
func NewEnvironmentService ¶
func NewEnvironmentService( db *database.DB, httpClient *http.Client, dockerService *docker.DockerClientService, eventService *event.EventService, settingsService *settings.SettingsService, apiKeyService *apikey.ApiKeyService, ) *EnvironmentService
func (*EnvironmentService) BindSwarmNodeEnvironment ¶
func (s *EnvironmentService) BindSwarmNodeEnvironment( ctx context.Context, parentEnvironmentID, nodeID, environmentID string, rebind bool, ) (*Environment, error)
BindSwarmNodeEnvironment binds a visible environment to a swarm node, keeping its connection and token.
func (*EnvironmentService) CheckS3DestinationReferences ¶ added in v2.9.0
func (s *EnvironmentService) CheckS3DestinationReferences(ctx context.Context, destinationID string) error
CheckS3DestinationReferences fails while any synced environment references the destination or cannot be checked, since deleting it would strand remote backups.
func (*EnvironmentService) CreateEnvironment ¶
func (s *EnvironmentService) CreateEnvironment(ctx context.Context, env *Environment, userID, username *string) (*Environment, error)
func (*EnvironmentService) DeleteEnvironment ¶
func (*EnvironmentService) DeleteSwarmNodeAgentDeployment ¶
func (s *EnvironmentService) DeleteSwarmNodeAgentDeployment(ctx context.Context, parentEnvironmentID, nodeID string, userID, username *string) error
DeleteSwarmNodeAgentDeployment removes a dedicated hidden agent registration, leaving visible ones untouched.
func (*EnvironmentService) DetachSwarmNodeEnvironment ¶
func (s *EnvironmentService) DetachSwarmNodeEnvironment(ctx context.Context, parentEnvironmentID, nodeID string) error
DetachSwarmNodeEnvironment clears a visible environment binding from a node.
func (*EnvironmentService) EnsureLocalEnvironment ¶
func (s *EnvironmentService) EnsureLocalEnvironment(ctx context.Context, appUrl string) error
func (*EnvironmentService) EnsureSwarmNodeAgentEnvironment ¶
func (s *EnvironmentService) EnsureSwarmNodeAgentEnvironment( ctx context.Context, parentEnvironmentID, nodeID, hostname, userID, username string, rotate bool, ) (*Environment, string, error)
func (*EnvironmentService) ExecuteRemoteRequest ¶
func (*EnvironmentService) ForgetSyncState ¶ added in v2.15.0
func (s *EnvironmentService) ForgetSyncState(environmentID string)
ForgetSyncState makes the next sync of every resource group resend regardless of payload changes.
func (*EnvironmentService) GenerateDeploymentSnippets ¶
func (s *EnvironmentService) GenerateDeploymentSnippets(ctx context.Context, envID, managerURL, agentURL, apiKey string) (*DeploymentSnippets, error)
GenerateDeploymentSnippets generates Docker deployment snippets for an environment.
func (*EnvironmentService) GenerateEdgeDeploymentSnippets ¶
func (s *EnvironmentService) GenerateEdgeDeploymentSnippets(ctx context.Context, envID, managerURL, apiKey string, edgeCfg *edge.Config) (*DeploymentSnippets, error)
GenerateEdgeDeploymentSnippets generates Docker deployment snippets for an edge agent, which dials the manager and exposes no ports.
func (*EnvironmentService) GetActiveRemoteEnvironmentSnapshot ¶
func (s *EnvironmentService) GetActiveRemoteEnvironmentSnapshot(environmentID string) mo.Option[Environment]
GetActiveRemoteEnvironmentSnapshot returns the latest in-process snapshot for an enabled, visible, non-local remote environment.
func (*EnvironmentService) GetDB ¶
func (s *EnvironmentService) GetDB() *database.DB
func (*EnvironmentService) GetEnabledRegistryCredentials ¶
func (s *EnvironmentService) GetEnabledRegistryCredentials(ctx context.Context) ([]containerregistry.Credential, error)
func (*EnvironmentService) GetEnvironmentByID ¶
func (s *EnvironmentService) GetEnvironmentByID(ctx context.Context, id string) (*Environment, error)
func (*EnvironmentService) GetEnvironmentByIDCached ¶ added in v2.15.0
func (s *EnvironmentService) GetEnvironmentByIDCached(ctx context.Context, id string) (*Environment, error)
GetEnvironmentByIDCached is GetEnvironmentByID behind a short TTL cache that remembers unknown IDs; status and heartbeat fields may be stale.
func (*EnvironmentService) IsKnownAccessToken ¶ added in v2.17.0
func (s *EnvironmentService) IsKnownAccessToken(token string) bool
func (*EnvironmentService) ListActiveRemoteEnvironments ¶ added in v2.15.0
func (s *EnvironmentService) ListActiveRemoteEnvironments(ctx context.Context) ([]Environment, error)
ListActiveRemoteEnvironments returns every enabled, visible, non-local environment from memory, sorted by ID; the first call loads them from the database.
func (*EnvironmentService) ListEnabledEnvironmentIDs ¶
func (s *EnvironmentService) ListEnabledEnvironmentIDs(ctx context.Context) ([]string, error)
func (*EnvironmentService) ListEnabledRemoteEnvironments ¶ added in v2.17.0
func (s *EnvironmentService) ListEnabledRemoteEnvironments(ctx context.Context) ([]Environment, error)
func (*EnvironmentService) ListEnvironmentsPaginated ¶
func (s *EnvironmentService) ListEnvironmentsPaginated(ctx context.Context, params pagination.QueryParams, accessibleEnvIDs []string) ([]environment.Environment, pagination.Response, error)
func (*EnvironmentService) ListRemoteEnvironmentIDs ¶
func (s *EnvironmentService) ListRemoteEnvironmentIDs(ctx context.Context) ([]string, error)
ListRemoteEnvironmentIDs returns the IDs of enabled remote environments; it satisfies agg.RemoteEnvironmentLister for aggregated stream handlers.
func (*EnvironmentService) ListRemoteEnvironments ¶
func (s *EnvironmentService) ListRemoteEnvironments(ctx context.Context) ([]Environment, error)
ListRemoteEnvironments returns all non-local, enabled environments for syncing purposes.
func (*EnvironmentService) ListSwarmNodeAgentEnvironments ¶
func (s *EnvironmentService) ListSwarmNodeAgentEnvironments(ctx context.Context, parentEnvironmentID string) ([]Environment, error)
func (*EnvironmentService) ListSwarmNodeCandidateEnvironments ¶
func (s *EnvironmentService) ListSwarmNodeCandidateEnvironments(ctx context.Context) ([]Environment, error)
ListSwarmNodeCandidateEnvironments returns enabled visible environments that can cover a swarm node.
func (*EnvironmentService) ListVisibleEnvironments ¶
func (s *EnvironmentService) ListVisibleEnvironments(ctx context.Context) ([]environment.Environment, error)
ListVisibleEnvironments returns persisted rows; callers apply ApplyEnvironmentRuntimeState.
func (*EnvironmentService) LoadAccessTokens ¶ added in v2.17.0
func (s *EnvironmentService) LoadAccessTokens(ctx context.Context) error
func (*EnvironmentService) NotifyRuntimeStateChanged ¶
func (s *EnvironmentService) NotifyRuntimeStateChanged()
NotifyRuntimeStateChanged wakes every runtime watcher without blocking, so tunnel callbacks may call it.
func (*EnvironmentService) ProxyJSONRequest ¶
func (*EnvironmentService) ProxyJSONRequestForEnvironment ¶
func (s *EnvironmentService) ProxyJSONRequestForEnvironment(ctx context.Context, env Environment, method, path string, body []byte, out any) error
ProxyJSONRequestForEnvironment sends a JSON request for an already-loaded environment row.
func (*EnvironmentService) ProxyRequest ¶
func (s *EnvironmentService) ProxyRequest(ctx context.Context, envID, method, path string, body []byte) ([]byte, int, error)
ProxyRequest sends a request to a remote environment's API.
func (*EnvironmentService) QueueRemoteSync ¶ added in v2.17.0
func (*EnvironmentService) ReconcileEdgeStatusesOnStartup ¶
func (s *EnvironmentService) ReconcileEdgeStatusesOnStartup(ctx context.Context) error
ReconcileEdgeStatusesOnStartup marks non-pending edge environments offline at startup, since tunnels are process-local and persisted "online" flags are stale.
func (*EnvironmentService) RegenerateEnvironmentApiKey ¶
func (s *EnvironmentService) RegenerateEnvironmentApiKey(ctx context.Context, env *Environment, userID, username string) (string, error)
RegenerateEnvironmentApiKey rotates the key and updates its environment binding.
func (*EnvironmentService) RegisterMetrics ¶ added in v2.16.0
func (s *EnvironmentService) RegisterMetrics()
RegisterMetrics reports the arcane.environments gauge; only the manager calls it.
func (*EnvironmentService) RescheduleHealthJobs ¶
func (s *EnvironmentService) RescheduleHealthJobs(ctx context.Context)
RescheduleHealthJobs re-registers every enabled environment's health job, picking up a changed global interval.
func (*EnvironmentService) ResolveEdgeEnvironmentByToken ¶
func (*EnvironmentService) ResolveEnvironmentByAccessToken ¶
func (s *EnvironmentService) ResolveEnvironmentByAccessToken(ctx context.Context, token string) (*Environment, error)
func (*EnvironmentService) ResolveEnvironmentName ¶
func (s *EnvironmentService) ResolveEnvironmentName(ctx context.Context, environmentID string) string
ResolveEnvironmentName returns an environment's display label; names are user-editable, so never hardcode one for a known ID.
func (*EnvironmentService) RunHealthChecksNow ¶
func (s *EnvironmentService) RunHealthChecksNow(ctx context.Context) error
RunHealthChecksNow queues each enabled environment's health check. Child runs retain the parent identity so authorization is checked at execution.
func (*EnvironmentService) SetScheduler ¶
func (s *EnvironmentService) SetScheduler(ctx context.Context, jobScheduler scheduler.DynamicScheduler, admissionGate *runs.Admission) error
SetScheduler injects the job scheduler and app lifecycle context on the manager; agents leave it nil, making health-job registration a no-op.
func (*EnvironmentService) SetUserInvalidator ¶ added in v2.17.0
func (s *EnvironmentService) SetUserInvalidator(invalidate func(userID string))
func (*EnvironmentService) SetVariableSyncer ¶
func (s *EnvironmentService) SetVariableSyncer(syncer VariableSyncer)
SetVariableSyncer injects the global-variable syncer on the manager; agents leave it nil.
func (*EnvironmentService) SubscribeRuntimeChanges ¶
func (s *EnvironmentService) SubscribeRuntimeChanges() (<-chan struct{}, func())
SubscribeRuntimeChanges returns a channel that receives a coalesced wake-up whenever environment liveness may have changed, plus a function to release it.
func (*EnvironmentService) SyncRegistriesToEnvironment ¶
func (s *EnvironmentService) SyncRegistriesToEnvironment(ctx context.Context, environmentID string) error
SyncRegistriesToEnvironment syncs all registries from this manager to a remote environment.
func (*EnvironmentService) SyncRegistriesToRemoteEnvironments ¶
func (s *EnvironmentService) SyncRegistriesToRemoteEnvironments(ctx context.Context) error
SyncRegistriesToRemoteEnvironments syncs container registries to every remote environment with an access token.
func (*EnvironmentService) SyncRepositoriesToEnvironment ¶
func (s *EnvironmentService) SyncRepositoriesToEnvironment(ctx context.Context, environmentID string) error
SyncRepositoriesToEnvironment syncs all git repositories from this manager to a remote environment.
func (*EnvironmentService) SyncResourcesToEnvironment ¶ added in v2.11.0
func (s *EnvironmentService) SyncResourcesToEnvironment(ctx context.Context, environmentID string, user *usertypes.Actor, activityService activity.Service) (string, error)
SyncResourcesToEnvironment tracks a manual sync and attempts every resource group.
func (*EnvironmentService) SyncS3DestinationsToEnvironment ¶ added in v2.9.0
func (s *EnvironmentService) SyncS3DestinationsToEnvironment(ctx context.Context, environmentID string) error
SyncS3DestinationsToEnvironment sends manager-owned destinations to one remote environment.
func (*EnvironmentService) SyncS3DestinationsToRemoteEnvironments ¶ added in v2.9.0
func (s *EnvironmentService) SyncS3DestinationsToRemoteEnvironments(ctx context.Context) error
SyncS3DestinationsToRemoteEnvironments refreshes the destination cache on every remote environment with an access token.
func (*EnvironmentService) TestConnection ¶
func (*EnvironmentService) UpdateEnvironment ¶
func (s *EnvironmentService) UpdateEnvironment(ctx context.Context, id string, updates map[string]any, userID, username *string) (*Environment, error)
func (*EnvironmentService) UpdateEnvironmentConnectionState ¶
func (s *EnvironmentService) UpdateEnvironmentConnectionState(ctx context.Context, id string, connected bool) error
UpdateEnvironmentConnectionState records an edge tunnel connect or disconnect without emitting an "environment updated" event.
func (*EnvironmentService) UpdateEnvironmentHeartbeat ¶
func (s *EnvironmentService) UpdateEnvironmentHeartbeat(ctx context.Context, id string) error
func (*EnvironmentService) UpdateSwarmNodeIdentity ¶
func (s *EnvironmentService) UpdateSwarmNodeIdentity(ctx context.Context, envID, swarmNodeID string) error
type EnvironmentStatus ¶ added in v2.8.1
type EnvironmentStatus string
const ( EnvironmentStatusOnline EnvironmentStatus = "online" EnvironmentStatusStandby EnvironmentStatus = "standby" EnvironmentStatusOffline EnvironmentStatus = "offline" EnvironmentStatusError EnvironmentStatus = "error" EnvironmentStatusPending EnvironmentStatus = "pending" )
type EnvironmentWithApiKey ¶
type EnvironmentWithApiKey struct {
environment.Environment
ApiKey *string `json:"apiKey,omitempty" doc:"API key for pairing (only shown once during creation)"`
}
type GetDeploymentSnippetsInput ¶
type GetDeploymentSnippetsInput struct {
ID string `path:"id" doc:"Environment ID"`
}
type GetEnvironmentInput ¶
type GetEnvironmentInput struct {
ID string `path:"id" doc:"Environment ID"`
}
type GetEnvironmentVersionInput ¶
type GetEnvironmentVersionInput struct {
ID string `path:"id" doc:"Environment ID"`
}
type ListEnvironmentsInput ¶
type ListEnvironmentsInput struct {
Search string `query:"search" doc:"Search query for filtering by name or API URL"`
Sort string `query:"sort" doc:"Column to sort by"`
Order string `query:"order" default:"asc" doc:"Sort direction (asc or desc)"`
Start int `query:"start" default:"0" doc:"Start index for pagination"`
Limit int `query:"limit" default:"20" doc:"Items per page"`
Type string `query:"type" doc:"Filter by environment type (comma-separated: http,edge,websocket,grpc,polling)"`
}
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
func New ¶
func New( service *EnvironmentService, settingsService *settings.SettingsService, apiKey *apikey.ApiKeyService, eventService *event.EventService, cfg *config.Config, activityService activity.Service, ) *Module
func (*Module) Handler ¶
func (m *Module) Handler() *EnvironmentHandler
func (*Module) RegisterRoutes ¶
func (m *Module) RegisterRoutes(api huma.API, appCtx handlerutil.ActivityAppContext, localVersion func(context.Context) *version.Info)
RegisterRoutes registers the environment endpoints; localVersion answers version requests for the local environment.
func (*Module) Service ¶
func (m *Module) Service() *EnvironmentService
type PairAgentInput ¶
type PairAgentInput struct {
ID string `path:"id" doc:"Environment ID (must be 0 for local)"`
Body *environment.AgentPairRequest `json:"body,omitempty"`
}
type PairEnvironmentInput ¶
type PairEnvironmentInput struct {
XAPIKey string `header:"X-API-Key" doc:"API key for environment pairing"`
}
type SyncEnvironmentInput ¶
type SyncEnvironmentInput struct {
ID string `path:"id" doc:"Environment ID"`
}
type TestConnectionInput ¶
type TestConnectionInput struct {
ID string `path:"id" doc:"Environment ID"`
Body *environment.TestConnectionRequest `json:"body,omitempty"`
}
type UpdateEnvironmentInput ¶
type UpdateEnvironmentInput struct {
ID string `path:"id" doc:"Environment ID"`
Body environment.Update
}
type UpdateHeartbeatInput ¶
type UpdateHeartbeatInput struct {
ID string `path:"id" doc:"Environment ID"`
}
Directories
¶
| Path | Synopsis |
|---|---|
|
children
|
|
|
health
Package health probes environment connectivity over direct HTTP, edge tunnels or the local Docker socket.
|
Package health probes environment connectivity over direct HTTP, edge tunnels or the local Docker socket. |
|
proxy
Package proxy owns the transport to remote environment agents: request building, edge tunnel routing, JSON decoding and configuration pushes.
|
Package proxy owns the transport to remote environment agents: request building, edge tunnel routing, JSON decoding and configuration pushes. |
|
snippets
Package snippets renders agent deployment snippets and issues the edge mTLS assets they reference.
|
Package snippets renders agent deployment snippets and issues the edge mTLS assets they reference. |
|
swarm
Package swarm owns swarm-node agent provisioning, node binding policy, and agent API-key rotation; the parent persists environment rows.
|
Package swarm owns swarm-node agent provisioning, node binding policy, and agent API-key rotation; the parent persists environment rows. |