createworkspaces

package
v2.38.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: AGPL-3.0 Imports: 17 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// User is the configuration for the user to create.
	User UserConfig `json:"user"`
	// Workspace is the configuration for the workspace to create. The workspace
	// will be built using the new user.
	//
	// OrganizationID is ignored and set to the new user's organization ID.
	Workspace workspacebuild.Config `json:"workspace"`

	// ReconnectingPTY is the configuration for web terminal connections to the
	// new workspace. If nil, no web terminal connections will be made. Runs in
	// parallel to agent connections if specified.
	//
	// AgentID is ignored and set to the new workspace's agent ID.
	ReconnectingPTY *reconnectingpty.Config `json:"reconnecting_pty"`
	// AgentConn is the configuration for connections made to the agent. If nil,
	// no agent connections will be made. Runs in parallel to reconnecting pty
	// connections if specified.
	//
	// AgentID is ignored and set to the new workspace's agent ID.
	AgentConn *agentconn.Config `json:"agent_conn"`

	// NoCleanup determines whether the user and workspace should be left as is
	// and not deleted or stopped in any way.
	NoCleanup bool `json:"no_cleanup"`
}

func (Config) Validate

func (c Config) Validate() error

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

func NewRunner

func NewRunner(client *codersdk.Client, cfg Config) *Runner

func (*Runner) Cleanup

func (r *Runner) Cleanup(ctx context.Context, id string, logs io.Writer) error

Cleanup implements Cleanable.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, id string, logs io.Writer) error

Run implements Runnable.

type UserConfig

type UserConfig struct {
	// OrganizationID is the ID of the organization to add the user to.
	OrganizationID uuid.UUID `json:"organization_id"`
	// Username is the username of the new user. Generated if empty.
	Username string `json:"username"`
	// Email is the email of the new user. Generated if empty.
	Email string `json:"email"`
	// SessionToken is the session token of an already existing user. If set, no
	// user will be created.
	SessionToken string `json:"session_token"`
}

func (UserConfig) Validate

func (c UserConfig) Validate() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL