client

package
v0.0.52 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package client provides an abstraction for interacting with otf services either remotely or locally.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(config http.Config) (*remoteClient, error)

New constructs a client that uses the http to remotely invoke OTF services.

Types

type Client

type Client interface {
	CreateOrganization(ctx context.Context, opts orgcreator.OrganizationCreateOptions) (*organization.Organization, error)
	DeleteOrganization(ctx context.Context, organization string) error

	GetWorkspace(ctx context.Context, workspaceID string) (*workspace.Workspace, error)
	GetWorkspaceByName(ctx context.Context, organization, workspace string) (*workspace.Workspace, error)
	ListWorkspaces(ctx context.Context, opts workspace.ListOptions) (*resource.Page[*workspace.Workspace], error)
	UpdateWorkspace(ctx context.Context, workspaceID string, opts workspace.UpdateOptions) (*workspace.Workspace, error)

	ListVariables(ctx context.Context, workspaceID string) ([]*variable.Variable, error)

	CreateAgentToken(ctx context.Context, opts tokens.CreateAgentTokenOptions) ([]byte, error)
	GetAgentToken(ctx context.Context, token string) (*tokens.AgentToken, error)

	GetPlanFile(ctx context.Context, id string, format run.PlanFormat) ([]byte, error)
	UploadPlanFile(ctx context.Context, id string, plan []byte, format run.PlanFormat) error

	GetLockFile(ctx context.Context, id string) ([]byte, error)
	UploadLockFile(ctx context.Context, id string, lockFile []byte) error

	ListRuns(ctx context.Context, opts run.RunListOptions) (*resource.Page[*run.Run], error)
	GetRun(ctx context.Context, id string) (*run.Run, error)

	StartPhase(ctx context.Context, id string, phase internal.PhaseType, opts run.PhaseStartOptions) (*run.Run, error)
	FinishPhase(ctx context.Context, id string, phase internal.PhaseType, opts run.PhaseFinishOptions) (*run.Run, error)

	DownloadConfig(ctx context.Context, id string) ([]byte, error)

	Watch(context.Context, run.WatchOptions) (<-chan pubsub.Event, error)

	CreateStateVersion(ctx context.Context, opts state.CreateStateVersionOptions) (*state.Version, error)
	DownloadCurrentState(ctx context.Context, workspaceID string) ([]byte, error)
	GetCurrentStateVersion(ctx context.Context, workspaceID string) (*state.Version, error)
	RollbackStateVersion(ctx context.Context, svID string) (*state.Version, error)
	DeleteStateVersion(ctx context.Context, svID string) error
	DownloadState(ctx context.Context, svID string) ([]byte, error)
	ListStateVersions(ctx context.Context, workspaceID string, opts resource.PageOptions) (*resource.Page[*state.Version], error)

	CreateUser(ctx context.Context, username string, opts ...auth.NewUserOption) (*auth.User, error)
	DeleteUser(ctx context.Context, username string) error
	AddTeamMembership(ctx context.Context, opts auth.TeamMembershipOptions) error
	RemoveTeamMembership(ctx context.Context, opts auth.TeamMembershipOptions) error

	CreateTeam(ctx context.Context, organization string, opts auth.CreateTeamOptions) (*auth.Team, error)
	GetTeam(ctx context.Context, organization, team string) (*auth.Team, error)
	DeleteTeam(ctx context.Context, teamID string) error

	Hostname() string

	tokens.RunTokenService
	internal.PutChunkService
	workspace.LockService
}

Client is those service endpoints that support both in-process and remote invocation. Intended for use with the agent (the internal agent is in-process, while the external agent is remote) as well as the CLI.

Jump to

Keyboard shortcuts

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