Documentation ¶
Index ¶
- Constants
- func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.UUID, ...) error
- func MutateTags(userID uuid.UUID, tags map[string]string) map[string]string
- func ProvisionerJobLogsNotifyChannel(jobID uuid.UUID) string
- type ProvisionerJobLogsNotifyMessage
- type Server
- func (server *Server) AcquireJob(ctx context.Context, _ *proto.Empty) (*proto.AcquiredJob, error)
- func (server *Server) CommitQuota(ctx context.Context, request *proto.CommitQuotaRequest) (*proto.CommitQuotaResponse, error)
- func (server *Server) CompleteJob(ctx context.Context, completed *proto.CompletedJob) (*proto.Empty, error)
- func (server *Server) FailJob(ctx context.Context, failJob *proto.FailedJob) (*proto.Empty, error)
- func (server *Server) UpdateJob(ctx context.Context, request *proto.UpdateJobRequest) (*proto.UpdateJobResponse, error)
- type TemplateVersionDryRunJob
- type TemplateVersionImportJob
- type WorkspaceProvisionJob
Constants ¶
const ( TagScope = "scope" TagOwner = "owner" ScopeUser = "user" ScopeOrganization = "organization" )
Variables ¶
This section is empty.
Functions ¶
func InsertWorkspaceResource ¶
func MutateTags ¶ added in v0.12.8
MutateTags adjusts the "owner" tag dependent on the "scope". If the scope is "user", the "owner" is changed to the user ID. This is for user-scoped provisioner daemons, where users should own their own operations.
func ProvisionerJobLogsNotifyChannel ¶
ProvisionerJobLogsNotifyChannel is the PostgreSQL NOTIFY channel to publish updates to job logs on.
Types ¶
type ProvisionerJobLogsNotifyMessage ¶
type ProvisionerJobLogsNotifyMessage struct { CreatedAfter int64 `json:"created_after"` EndOfLogs bool `json:"end_of_logs,omitempty"` }
ProvisionerJobLogsNotifyMessage is the payload published on the provisioner job logs notify channel.
type Server ¶
type Server struct { AccessURL *url.URL ID uuid.UUID Logger slog.Logger Provisioners []database.ProvisionerType Tags json.RawMessage Database database.Store Pubsub database.Pubsub Telemetry telemetry.Reporter QuotaCommitter *atomic.Pointer[proto.QuotaCommitter] Auditor *atomic.Pointer[audit.Auditor] AcquireJobDebounce time.Duration }
func (*Server) AcquireJob ¶
AcquireJob queries the database to lock a job.
func (*Server) CommitQuota ¶ added in v0.12.7
func (server *Server) CommitQuota(ctx context.Context, request *proto.CommitQuotaRequest) (*proto.CommitQuotaResponse, error)
func (*Server) CompleteJob ¶
func (server *Server) CompleteJob(ctx context.Context, completed *proto.CompletedJob) (*proto.Empty, error)
CompleteJob is triggered by a provision daemon to mark a provisioner job as completed.
func (*Server) UpdateJob ¶
func (server *Server) UpdateJob(ctx context.Context, request *proto.UpdateJobRequest) (*proto.UpdateJobResponse, error)
type TemplateVersionDryRunJob ¶
type TemplateVersionDryRunJob struct { TemplateVersionID uuid.UUID `json:"template_version_id"` WorkspaceName string `json:"workspace_name"` ParameterValues []database.ParameterValue `json:"parameter_values"` }
TemplateVersionDryRunJob is the payload for the "template_version_dry_run" job type.
type TemplateVersionImportJob ¶ added in v0.15.0
type WorkspaceProvisionJob ¶
type WorkspaceProvisionJob struct { WorkspaceBuildID uuid.UUID `json:"workspace_build_id"` DryRun bool `json:"dry_run"` }
WorkspaceProvisionJob is the payload for the "workspace_provision" job type.