tharsis

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: MPL-2.0 Imports: 28 Imported by: 1

Documentation

Overview

Package tharsis provides functions for interfacing with the Tharsis API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NotFoundError added in v0.7.0

func NotFoundError(err error) bool

NotFoundError returns true if the error is a tharsis Error and contains the ErrNotFound code

Types

type Apply

type Apply interface {
	UpdateApply(ctx context.Context, input *types.UpdateApplyInput) (*types.Apply, error)
}

Apply implements functions related to Tharsis Apply.

func NewApply

func NewApply(client *Client) Apply

NewApply returns an apply.

type Client

type Client struct {
	ConfigurationVersion      ConfigurationVersion
	Group                     Group
	Job                       Job
	ManagedIdentity           ManagedIdentity
	Plan                      Plan
	Apply                     Apply
	Run                       Run
	ServiceAccount            ServiceAccount
	StateVersion              StateVersion
	Variable                  Variable
	Workspaces                Workspaces
	TerraformProvider         TerraformProvider
	TerraformProviderVersion  TerraformProviderVersion
	TerraformModule           TerraformModule
	TerraformModuleVersion    TerraformModuleVersion
	TerraformProviderPlatform TerraformProviderPlatform
	TerraformCLIVersions      TerraformCLIVersion
	// contains filtered or unexported fields
}

Client provides access for the client/user to access the SDK functions. Note: When adding a new field here, make sure to assign the field near the end of the NewClient function.

func NewClient

func NewClient(cfg *config.Config) (*Client, error)

NewClient returns a TharsisClient.

func (*Client) Close

func (c *Client) Close() error

Close client connections

type ConfigurationVersion

type ConfigurationVersion interface {
	GetConfigurationVersion(ctx context.Context,
		input *types.GetConfigurationVersionInput) (*types.ConfigurationVersion, error)
	CreateConfigurationVersion(ctx context.Context,
		input *types.CreateConfigurationVersionInput) (*types.ConfigurationVersion, error)
	DownloadConfigurationVersion(ctx context.Context,
		input *types.GetConfigurationVersionInput, writer io.WriterAt) error
	UploadConfigurationVersion(ctx context.Context, input *types.UploadConfigurationVersionInput) error
}

ConfigurationVersion implements functions related to Tharsis configuration versions.

func NewConfigurationVersion

func NewConfigurationVersion(client *Client) ConfigurationVersion

NewConfigurationVersion returns a ConfigurationVersion object.

type Error added in v0.7.0

type Error struct {
	Err  error
	Code ErrorCode
	Msg  string
}

Error represents an error returned by the Tharsis API

func (*Error) Error added in v0.7.0

func (e *Error) Error() string

func (*Error) Unwrap added in v0.7.0

func (e *Error) Unwrap() error

type ErrorCode added in v0.7.0

type ErrorCode string

ErrorCode represents the types of errors that can be returned by the SDK

const (
	ErrInternal        ErrorCode = "internal error"
	ErrNotImplemented  ErrorCode = "not implemented"
	ErrNotFound        ErrorCode = "not found"
	ErrConflict        ErrorCode = "conflict"
	ErrOptimisticLock  ErrorCode = "optimistic lock"
	ErrForbidden       ErrorCode = "forbidden"
	ErrTooManyRequests ErrorCode = "too many requests"
	ErrUnauthorized    ErrorCode = "unauthorized"
	ErrTooLarge        ErrorCode = "request too large"
	ErrBadRequest      ErrorCode = "bad request"
)

Error code constants

type GetWorkspacesPaginator

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

GetWorkspacesPaginator is a type-specific paginator.

func (*GetWorkspacesPaginator) HasMore

func (wp *GetWorkspacesPaginator) HasMore() bool

HasMore returns a boolean, whether there is another page (or more):

func (*GetWorkspacesPaginator) Next

Next returns the next page of results:

type GraphQLManagedIdentity

type GraphQLManagedIdentity struct {
	ID           graphql.String
	Metadata     internal.GraphQLMetadata
	Type         graphql.String
	ResourcePath graphql.String
	Name         graphql.String
	Description  graphql.String
	Data         graphql.String
	CreatedBy    graphql.String
}

GraphQLManagedIdentity represents the insides of the query structure, everything in the managed identity object, and with graphql types.

type GraphQLStateVersion

type GraphQLStateVersion struct {
	Metadata internal.GraphQLMetadata
	ID       graphql.String
	Run      struct {
		ID graphql.String
	}
	Outputs []GraphQLStateVersionOutput
}

GraphQLStateVersion represents the insides of the query structure, everything in the state version object, and with graphql types.

type GraphQLStateVersionOutput

type GraphQLStateVersionOutput struct {
	Metadata  internal.GraphQLMetadata
	ID        graphql.String
	Name      graphql.String
	Value     graphql.String
	Type      graphql.String
	Sensitive graphql.Boolean
}

GraphQLStateVersionOutput represents the insides of the query structure, everything in the state version output object, and with graphql types.

type Group

type Group interface {
	GetGroup(ctx context.Context, input *types.GetGroupInput) (*types.Group, error)
	GetGroups(ctx context.Context, input *types.GetGroupsInput) (*types.GetGroupsOutput, error)
	GetGroupPaginator(ctx context.Context, input *types.GetGroupsInput) (*GroupPaginator, error)
	CreateGroup(ctx context.Context, input *types.CreateGroupInput) (*types.Group, error)
	UpdateGroup(ctx context.Context, input *types.UpdateGroupInput) (*types.Group, error)
	DeleteGroup(ctx context.Context, input *types.DeleteGroupInput) error
}

Group implements functions related to Tharsis groups.

func NewGroup

func NewGroup(client *Client) Group

NewGroup returns a Group.

type GroupPaginator

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

GroupPaginator is a type-specific paginator.

func (*GroupPaginator) HasMore

func (gp *GroupPaginator) HasMore() bool

HasMore returns a boolean, whether there is another page (or more):

func (*GroupPaginator) Next

Next returns the next page of results:

type Job

type Job interface {
	GetJob(ctx context.Context, input *types.GetJobInput) (*types.Job, error)
	SubscribeToJobCancellationEvent(ctx context.Context, input *types.JobCancellationEventSubscriptionInput) (<-chan *types.CancellationEvent, error)
	SaveJobLogs(ctx context.Context, input *types.SaveJobLogsInput) error
	GetJobLogs(ctx context.Context, input *types.GetJobLogsInput) (chan string, error)
}

Job implements functions related to Tharsis jobs.

func NewJob

func NewJob(client *Client) Job

NewJob returns a Job.

type ManagedIdentity

type ManagedIdentity interface {
	CreateManagedIdentity(ctx context.Context,
		input *types.CreateManagedIdentityInput) (*types.ManagedIdentity, error)
	GetManagedIdentity(ctx context.Context,
		input *types.GetManagedIdentityInput) (*types.ManagedIdentity, error)
	UpdateManagedIdentity(ctx context.Context,
		input *types.UpdateManagedIdentityInput) (*types.ManagedIdentity, error)
	DeleteManagedIdentity(ctx context.Context,
		input *types.DeleteManagedIdentityInput) error
	CreateManagedIdentityCredentials(ctx context.Context,
		input *types.CreateManagedIdentityCredentialsInput) ([]byte, error)
	AssignManagedIdentityToWorkspace(ctx context.Context,
		input *types.AssignManagedIdentityInput) (*types.Workspace, error)
	UnassignManagedIdentityFromWorkspace(ctx context.Context,
		input *types.AssignManagedIdentityInput) (*types.Workspace, error)
	GetManagedIdentityAccessRules(ctx context.Context,
		input *types.GetManagedIdentityInput) ([]types.ManagedIdentityAccessRule, error)
	CreateManagedIdentityAccessRule(ctx context.Context,
		input *types.CreateManagedIdentityAccessRuleInput) (*types.ManagedIdentityAccessRule, error)
	GetManagedIdentityAccessRule(ctx context.Context,
		input *types.GetManagedIdentityAccessRuleInput) (*types.ManagedIdentityAccessRule, error)
	UpdateManagedIdentityAccessRule(ctx context.Context,
		input *types.UpdateManagedIdentityAccessRuleInput) (*types.ManagedIdentityAccessRule, error)
	DeleteManagedIdentityAccessRule(ctx context.Context,
		input *types.DeleteManagedIdentityAccessRuleInput) error
}

ManagedIdentity implements functions related to Tharsis ManagedIdentity.

func NewManagedIdentity

func NewManagedIdentity(client *Client) ManagedIdentity

NewManagedIdentity returns a new ManagedIdentity.

type Plan

type Plan interface {
	UpdatePlan(ctx context.Context, input *types.UpdatePlanInput) (*types.Plan, error)
	DownloadPlanCache(ctx context.Context, id string, writer io.WriterAt) error
	UploadPlanCache(ctx context.Context, id string, body io.Reader) error
}

Plan implements functions related to Tharsis Plan.

func NewPlan

func NewPlan(client *Client) Plan

NewPlan returns a plan.

type Run

type Run interface {
	GetRun(ctx context.Context, input *types.GetRunInput) (*types.Run, error)
	GetRuns(ctx context.Context, input *types.GetRunsInput) (*types.GetRunsOutput, error)
	GetRunVariables(ctx context.Context, input *types.GetRunInput) ([]types.RunVariable, error)
	GetRunPaginator(ctx context.Context, input *types.GetRunsInput) (*RunPaginator, error)
	CreateRun(ctx context.Context, input *types.CreateRunInput) (*types.Run, error)
	ApplyRun(ctx context.Context, input *types.ApplyRunInput) (*types.Run, error)
	CancelRun(ctx context.Context, input *types.CancelRunInput) (*types.Run, error)
	SubscribeToWorkspaceRunEvents(ctx context.Context, input *types.RunSubscriptionInput) (<-chan *types.Run, error)
}

Run implements functions related to Tharsis runs.

func NewRun

func NewRun(client *Client) Run

NewRun returns a Run.

type RunPaginator

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

RunPaginator is a type-specific paginator.

func (*RunPaginator) HasMore

func (rp *RunPaginator) HasMore() bool

HasMore returns a boolean, whether there is another page (or more):

func (*RunPaginator) Next

Next returns the next page of results:

type ServiceAccount added in v0.6.0

type ServiceAccount interface {
	CreateServiceAccount(ctx context.Context,
		input *types.CreateServiceAccountInput) (*types.ServiceAccount, error)
	GetServiceAccount(ctx context.Context,
		input *types.GetServiceAccountInput) (*types.ServiceAccount, error)
	UpdateServiceAccount(ctx context.Context,
		input *types.UpdateServiceAccountInput) (*types.ServiceAccount, error)
	DeleteServiceAccount(ctx context.Context,
		input *types.DeleteServiceAccountInput) error
}

ServiceAccount implements functions related to Tharsis ServiceAccount.

func NewServiceAccount added in v0.6.0

func NewServiceAccount(client *Client) ServiceAccount

NewServiceAccount returns a new ServiceAccount.

type StateVersion

type StateVersion interface {
	CreateStateVersion(ctx context.Context, input *types.CreateStateVersionInput) (*types.StateVersion, error)
	DownloadStateVersion(ctx context.Context, input *types.DownloadStateVersionInput, writer io.WriterAt) error
}

StateVersion implements functions related to a Tharsis state version.

func NewStateVersion

func NewStateVersion(client *Client) StateVersion

NewStateVersion returns a StateVersion.

type TerraformCLIVersion

type TerraformCLIVersion interface {
	CreateTerraformCLIDownloadURL(ctx context.Context, input *types.CreateTerraformCLIDownloadURLInput) (string, error)
}

TerraformCLIVersion implements the function related to Terraform CLI Versions.

func NewTerraformCLIVersion

func NewTerraformCLIVersion(client *Client) TerraformCLIVersion

NewTerraformCLIVersion returns a TerraformCLIVersion object.

type TerraformModule added in v0.5.0

type TerraformModule interface {
	GetModule(ctx context.Context, input *types.GetTerraformModuleInput) (*types.TerraformModule, error)
	CreateModule(ctx context.Context, input *types.CreateTerraformModuleInput) (*types.TerraformModule, error)
	UpdateModule(ctx context.Context, input *types.UpdateTerraformModuleInput) (*types.TerraformModule, error)
	DeleteModule(ctx context.Context, input *types.DeleteTerraformModuleInput) error
}

TerraformModule implements functions related to Tharsis modules.

func NewTerraformModule added in v0.5.0

func NewTerraformModule(client *Client) TerraformModule

NewTerraformModule returns a TerraformModule.

type TerraformModuleVersion added in v0.5.0

type TerraformModuleVersion interface {
	GetModuleVersion(ctx context.Context, input *types.GetTerraformModuleVersionInput) (*types.TerraformModuleVersion, error)
	CreateModuleVersion(ctx context.Context, input *types.CreateTerraformModuleVersionInput) (*types.TerraformModuleVersion, error)
	UploadModuleVersion(ctx context.Context, moduleVersionID string, reader io.Reader) error
	DeleteModuleVersion(ctx context.Context, input *types.DeleteTerraformModuleVersionInput) error
}

TerraformModuleVersion implements functions related to Tharsis module versions.

func NewTerraformModuleVersion added in v0.5.0

func NewTerraformModuleVersion(client *Client) TerraformModuleVersion

NewTerraformModuleVersion returns a TerraformModuleVersion.

type TerraformProvider

type TerraformProvider interface {
	GetProvider(ctx context.Context, input *types.GetTerraformProviderInput) (*types.TerraformProvider, error)
	CreateProvider(ctx context.Context, input *types.CreateTerraformProviderInput) (*types.TerraformProvider, error)
}

TerraformProvider implements functions related to Tharsis providers.

func NewTerraformProvider

func NewTerraformProvider(client *Client) TerraformProvider

NewTerraformProvider returns a TerraformProvider.

type TerraformProviderPlatform

type TerraformProviderPlatform interface {
	GetProviderPlatform(ctx context.Context, input *types.GetTerraformProviderPlatformInput) (*types.TerraformProviderPlatform, error)
	CreateProviderPlatform(ctx context.Context, input *types.CreateTerraformProviderPlatformInput) (*types.TerraformProviderPlatform, error)
	UploadProviderPlatformBinary(ctx context.Context, providerPlatformID string, reader io.Reader) error
}

TerraformProviderPlatform implements functions related to Tharsis provider platforms.

func NewTerraformProviderPlatform

func NewTerraformProviderPlatform(client *Client) TerraformProviderPlatform

NewTerraformProviderPlatform returns a TerraformProviderPlatform.

type TerraformProviderVersion

type TerraformProviderVersion interface {
	GetProviderVersion(ctx context.Context, input *types.GetTerraformProviderVersionInput) (*types.TerraformProviderVersion, error)
	CreateProviderVersion(ctx context.Context, input *types.CreateTerraformProviderVersionInput) (*types.TerraformProviderVersion, error)
	UploadProviderReadme(ctx context.Context, providerVersionID string, reader io.Reader) error
	UploadProviderChecksums(ctx context.Context, providerVersionID string, reader io.Reader) error
	UploadProviderChecksumSignature(ctx context.Context, providerVersionID string, reader io.Reader) error
}

TerraformProviderVersion implements functions related to Tharsis providerVersions.

func NewTerraformProviderVersion

func NewTerraformProviderVersion(client *Client) TerraformProviderVersion

NewTerraformProviderVersion returns a TerraformProviderVersion.

type Variable added in v0.6.0

Variable implements functions related to Tharsis Variable.

func NewVariable added in v0.6.0

func NewVariable(client *Client) Variable

NewVariable returns a new Variable.

type Workspaces

type Workspaces interface {
	GetWorkspace(ctx context.Context, input *types.GetWorkspaceInput) (*types.Workspace, error)
	GetWorkspaces(ctx context.Context, input *types.GetWorkspacesInput) (*types.GetWorkspacesOutput, error)
	GetWorkspacePaginator(ctx context.Context, input *types.GetWorkspacesInput) (*GetWorkspacesPaginator, error)
	CreateWorkspace(ctx context.Context, workspace *types.CreateWorkspaceInput) (*types.Workspace, error)
	UpdateWorkspace(ctx context.Context, workspace *types.UpdateWorkspaceInput) (*types.Workspace, error)
	DeleteWorkspace(ctx context.Context, workspace *types.DeleteWorkspaceInput) error
	GetAssignedManagedIdentities(ctx context.Context, input *types.GetAssignedManagedIdentitiesInput) ([]types.ManagedIdentity, error)
}

Workspaces implements functions related to Tharsis workspaces.

func NewWorkspaces

func NewWorkspaces(client *Client) Workspaces

NewWorkspaces returns a Workspaces.

Directories

Path Synopsis
Package auth package
Package auth package
Package config package
Package config package
Package types contains the type definitions for the SDK
Package types contains the type definitions for the SDK

Jump to

Keyboard shortcuts

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