Documentation
¶
Overview ¶
Package workspace provides access to terraform workspaces
Index ¶
- Constants
- Variables
- func NewService(opts Options) *service
- type Client
- func (c *Client) GetWorkspace(ctx context.Context, workspaceID string) (*Workspace, error)
- func (c *Client) GetWorkspaceByName(ctx context.Context, organization, workspace string) (*Workspace, error)
- func (c *Client) ListWorkspaces(ctx context.Context, options ListOptions) (*WorkspaceList, error)
- func (c *Client) LockWorkspace(ctx context.Context, workspaceID string, runID *string) (*Workspace, error)
- func (c *Client) UnlockWorkspace(ctx context.Context, workspaceID string, runID *string, force bool) (*Workspace, error)
- func (c *Client) UpdateWorkspace(ctx context.Context, workspaceID string, options UpdateOptions) (*Workspace, error)
- type ConnectOptions
- type CreateOptions
- type ExecutionMode
- type ListOptions
- type LockButton
- type LockKind
- type LockService
- type Options
- type OrganizationService
- type PermissionsService
- type QualifiedName
- type Service
- type UpdateOptions
- type VCSProviderService
- type Workspace
- func (ws *Workspace) ExecutionModes() []string
- func (ws *Workspace) Lock(id string, kind LockKind) error
- func (ws *Workspace) Locked() bool
- func (ws *Workspace) MarshalLog() any
- func (ws *Workspace) QualifiedName() QualifiedName
- func (ws *Workspace) String() string
- func (ws *Workspace) Unlock(id string, kind LockKind, force bool) error
- func (ws *Workspace) Update(opts UpdateOptions) error
- type WorkspaceList
- type WorkspaceService
Constants ¶
const ( RemoteExecutionMode ExecutionMode = "remote" LocalExecutionMode ExecutionMode = "local" AgentExecutionMode ExecutionMode = "agent" DefaultAllowDestroyPlan = true DefaultFileTriggersEnabled = true MinTerraformVersion = "1.2.0" DefaultTerraformVersion = "1.3.7" )
Variables ¶
var ( EventLocked otf.EventType = "workspace_locked" EventUnlocked otf.EventType = "workspace_unlocked" )
Functions ¶
func NewService ¶ added in v0.0.32
func NewService(opts Options) *service
Types ¶
type Client ¶ added in v0.0.32
type Client struct {
otf.JSONAPIClient
}
func (*Client) GetWorkspace ¶ added in v0.0.32
GetWorkspace retrieves a workspace by its ID
func (*Client) GetWorkspaceByName ¶ added in v0.0.32
func (c *Client) GetWorkspaceByName(ctx context.Context, organization, workspace string) (*Workspace, error)
GetWorkspaceByName retrieves a workspace by organization and name.
func (*Client) ListWorkspaces ¶ added in v0.0.32
func (c *Client) ListWorkspaces(ctx context.Context, options ListOptions) (*WorkspaceList, error)
func (*Client) LockWorkspace ¶ added in v0.0.32
func (*Client) UnlockWorkspace ¶ added in v0.0.32
func (*Client) UpdateWorkspace ¶ added in v0.0.32
func (c *Client) UpdateWorkspace(ctx context.Context, workspaceID string, options UpdateOptions) (*Workspace, error)
UpdateWorkspace updates the settings of an existing workspace.
type ConnectOptions ¶ added in v0.0.32
type CreateOptions ¶ added in v0.0.32
type CreateOptions struct {
AllowDestroyPlan *bool
AutoApply *bool
Branch *string
Description *string
ExecutionMode *ExecutionMode
FileTriggersEnabled *bool
GlobalRemoteState *bool
MigrationEnvironment *string
Name *string `schema:"name,required"`
QueueAllRuns *bool
SpeculativeEnabled *bool
SourceName *string
SourceURL *string
StructuredRunOutputEnabled *bool
TerraformVersion *string
TriggerPrefixes []string
WorkingDirectory *string
Organization *string `schema:"organization_name,required"`
*ConnectOptions
}
CreateOptions represents the options for creating a new workspace.
type ExecutionMode ¶ added in v0.0.32
type ExecutionMode string
func ExecutionModePtr ¶ added in v0.0.32
func ExecutionModePtr(m ExecutionMode) *ExecutionMode
ExecutionModePtr returns a pointer to an execution mode.
type ListOptions ¶ added in v0.0.32
type ListOptions struct {
otf.ListOptions // Pagination
Prefix string `schema:"search[name],omitempty"`
Organization *string `schema:"organization_name,required"`
}
ListOptions are options for paginating and filtering a list of Workspaces
type LockButton ¶ added in v0.0.33
type LockService ¶ added in v0.0.32
type Options ¶ added in v0.0.32
type Options struct {
otf.DB
otf.Broker
otf.Renderer
organization.OrganizationService
vcsprovider.VCSProviderService
repo.RepoService
auth.TeamService
logr.Logger
}
type OrganizationService ¶ added in v0.0.32
type OrganizationService organization.Service
type PermissionsService ¶ added in v0.0.32
type QualifiedName ¶ added in v0.0.32
QualifiedName is the workspace's fully qualified name including the name of its organization
type Service ¶ added in v0.0.32
type Service interface {
CreateWorkspace(ctx context.Context, opts CreateOptions) (*Workspace, error)
UpdateWorkspace(ctx context.Context, workspaceID string, opts UpdateOptions) (*Workspace, error)
GetWorkspace(ctx context.Context, workspaceID string) (*Workspace, error)
GetWorkspaceByName(ctx context.Context, organization, workspace string) (*Workspace, error)
GetWorkspaceJSONAPI(ctx context.Context, workspaceID string, r *http.Request) (*jsonapi.Workspace, error)
ListWorkspaces(ctx context.Context, opts ListOptions) (*WorkspaceList, error)
// ListWorkspacesByWebhookID retrieves workspaces by webhook ID.
//
// TODO: rename to ListConnectedWorkspaces
ListWorkspacesByRepoID(ctx context.Context, repoID uuid.UUID) ([]*Workspace, error)
DeleteWorkspace(ctx context.Context, workspaceID string) (*Workspace, error)
SetCurrentRun(ctx context.Context, workspaceID, runID string) (*Workspace, error)
LockService
PermissionsService
// contains filtered or unexported methods
}
type UpdateOptions ¶ added in v0.0.32
type UpdateOptions struct {
AllowDestroyPlan *bool
AutoApply *bool
Name *string
Description *string
ExecutionMode *ExecutionMode `schema:"execution_mode"`
FileTriggersEnabled *bool
GlobalRemoteState *bool
Operations *bool
QueueAllRuns *bool
SpeculativeEnabled *bool
StructuredRunOutputEnabled *bool
TerraformVersion *string `schema:"terraform_version"`
TriggerPrefixes []string
WorkingDirectory *string
}
type VCSProviderService ¶ added in v0.0.32
type VCSProviderService vcsprovider.Service
type Workspace ¶ added in v0.0.32
type Workspace struct {
ID string
CreatedAt time.Time
UpdatedAt time.Time
AllowDestroyPlan bool
AutoApply bool
Branch string
CanQueueDestroyPlan bool
Description string
Environment string
ExecutionMode ExecutionMode
FileTriggersEnabled bool
GlobalRemoteState bool
MigrationEnvironment string
Name string
QueueAllRuns bool
SpeculativeEnabled bool
StructuredRunOutputEnabled bool
SourceName string
SourceURL string
TerraformVersion string
TriggerPrefixes []string
WorkingDirectory string
Organization string
LatestRunID *string
Connection *repo.Connection
Permissions []otf.WorkspacePermission
// contains filtered or unexported fields
}
Workspace is a terraform workspace.
func NewWorkspace ¶ added in v0.0.32
func NewWorkspace(opts CreateOptions) (*Workspace, error)
func (*Workspace) ExecutionModes ¶ added in v0.0.32
ExecutionModes returns a list of possible execution modes
func (*Workspace) MarshalLog ¶ added in v0.0.32
func (*Workspace) QualifiedName ¶ added in v0.0.32
func (ws *Workspace) QualifiedName() QualifiedName
QualifiedName returns the workspace's qualified name including the name of its organization
func (*Workspace) Update ¶ added in v0.0.32
func (ws *Workspace) Update(opts UpdateOptions) error
Update updates the workspace with the given options.
type WorkspaceList ¶ added in v0.0.32
type WorkspaceList struct {
*otf.Pagination
Items []*Workspace
}
WorkspaceList is a list of workspaces.
type WorkspaceService ¶ added in v0.0.32
type WorkspaceService = Service