wsbuilder
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¶
Overview¶
Package wsbuilder provides the Builder object, which encapsulates the common business logic of inserting a newworkspace build into the database.
Index¶
- type BuildError
- type Builder
- func (b Builder) ActiveVersion() Builder
- func (b *Builder) Build(ctx context.Context, store database.Store, ...) (*database.WorkspaceBuild, *database.ProvisionerJob, error)
- func (b Builder) DeploymentValues(dv *codersdk.DeploymentValues) Builder
- func (b Builder) Initiator(u uuid.UUID) Builder
- func (b Builder) LogLevel(l string) Builder
- func (b Builder) Orphan() Builder
- func (b Builder) Reason(r database.BuildReason) Builder
- func (b Builder) RichParameterValues(p []codersdk.WorkspaceBuildParameter) Builder
- func (b Builder) SetLastWorkspaceBuildInTx(build *database.WorkspaceBuild) Builder
- func (b Builder) SetLastWorkspaceBuildJobInTx(job *database.ProvisionerJob) Builder
- func (b Builder) State(state []byte) Builder
- func (b Builder) VersionID(v uuid.UUID) Builder
- type Option
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeBuildError¶
func (BuildError)Error¶
func (eBuildError) Error()string
func (BuildError)Unwrap¶
func (eBuildError) Unwrap()error
typeBuilder¶
type Builder struct {// contains filtered or unexported fields}
Builder encapsulates the business logic of inserting a new workspace build into the database.
Builder follows the so-called "Builder" pattern where options that customize the kind of build you get returna new instance of the Builder with the option applied.
Example:
b = wsbuilder.New(workspace, transition).VersionID(vID).Initiator(me)build, job, err := b.Build(...)
func (Builder)ActiveVersion¶
func (*Builder)Build¶
func (b *Builder) Build(ctxcontext.Context,storedatabase.Store,authFunc func(actionrbac.Action, objectrbac.Objecter)bool,) (*database.WorkspaceBuild, *database.ProvisionerJob,error,)
Build computes and inserts a new workspace build into the database. If authFunc is provided, it also performsauthorization preflight checks.
func (Builder)DeploymentValues¶added inv0.25.0
func (bBuilder) DeploymentValues(dv *codersdk.DeploymentValues)Builder
func (Builder)RichParameterValues¶
func (bBuilder) RichParameterValues(p []codersdk.WorkspaceBuildParameter)Builder
func (Builder)SetLastWorkspaceBuildInTx¶
func (bBuilder) SetLastWorkspaceBuildInTx(build *database.WorkspaceBuild)Builder
SetLastWorkspaceBuildInTx prepopulates the Builder's cache with the last workspace build. This allows usto avoid a repeated database query when the Builder's caller also needs the workspace build, e.g. auto-start &auto-stop.
CAUTION: only call this method from within a database transaction with RepeatableRead isolation. This transactionMUST be the database.Store you call Build() with.
func (Builder)SetLastWorkspaceBuildJobInTx¶
func (bBuilder) SetLastWorkspaceBuildJobInTx(job *database.ProvisionerJob)Builder
SetLastWorkspaceBuildJobInTx prepopulates the Builder's cache with the last workspace build job. This allows usto avoid a repeated database query when the Builder's caller also needs the workspace build job, e.g. auto-start &auto-stop.
CAUTION: only call this method from within a database transaction with RepeatableRead isolation. This transactionMUST be the database.Store you call Build() with.