tfc

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultAddress of Terraform Enterprise.
	DefaultAddress = "https://app.terraform.io"
	// DefaultBasePath on which the API is served.
	DefaultBasePath = "/api/registry/v1/"
	// PingEndpoint is a no-op API endpoint used to configure the rate limiter
	PingEndpoint = "ping"
)

Variables

View Source
var (
	// ErrWorkspaceLocked is returned when trying to lock a
	// locked workspace.
	ErrWorkspaceLocked = errors.New("workspace already locked")
	// ErrWorkspaceNotLocked is returned when trying to unlock
	// a unlocked workspace.
	ErrWorkspaceNotLocked = errors.New("workspace already unlocked")

	// ErrUnauthorized is returned when a receiving a 401.
	ErrUnauthorized = errors.New("unauthorized")
	// ErrResourceNotFound is returned when a receiving a 404.
	ErrResourceNotFound = errors.New("resource not found")
)

Functions

func DefaultConfig

func DefaultConfig() *tfe.Config

DefaultConfig returns a default config structure.

Types

type RegistryClient

type RegistryClient struct {
	RegistryModules RegistryModules
	// contains filtered or unexported fields
}

RegistryClient is the Terraform Enterprise registry API client.

func NewRegistryClient

func NewRegistryClient(cfg *tfe.Config) (*RegistryClient, error)

NewRegistryClient creates a new Terraform Enterprise API client.

type RegistryModule

type RegistryModule struct {
	ID              string
	Name            string
	Provider        string
	VersionStatuses []tfe.RegistryModuleVersionStatuses
	Organization    string
	Source          string
}

RegistryModule represents a Terraform Cloud registry module.

type RegistryModuleList

type RegistryModuleList struct {
	*tfe.Pagination
	Items []*tfe.RegistryModule
}

RegistryModuleList represents a list of registry modules.

type RegistryModuleListOptions

type RegistryModuleListOptions struct {
	Limit    int    `url:"limit"`
	Provider string `url:"provider"`
	Verified bool   `url:"verified"`
}

RegistryModuleListOptions represents the options for listing registry modules.

type RegistryModules

type RegistryModules interface {
	List(ctx context.Context, options RegistryModuleListOptions) (*RegistryModuleList, error)
}

RegistryModules describes the registry modules related methods that the Terraform Enterprise API supports.

TFE API docs: https://www.terraform.io/docs/registry/api.html#service-discovery

type Run

type Run struct {
	ID            string
	Organization  string
	Workspace     string
	Status        string
	IsConfirmable bool
	CreatedAt     time.Time
}

Run represents a Terraform workspaces run.

type TfCloud

type TfCloud interface {
	// Address returns a Terraform Cloud / Enterprise API endpoint addres.
	Address() string
	// RunList returns all the terraform workspace current runs.
	RunList(organization string) ([]*Run, error)
	// RunGet returns the specified terraform workspace run.
	RunGet(workspaceName, runID string) (*Run, error)
	// RunApply applys the specified terraform workspace run.
	RunApply(RunID string) error
	// WorkspaceList returns all the terraform workspaces in an organization.
	WorkspaceList(organization string) ([]*Workspace, error)
	// WorkspaceGet returns the specified terraform workspace.
	WorkspaceGet(organization, workspace string) (*Workspace, error)
	// WorkspaceUpdateVersion updates the terraform version config in the specified workspace.
	WorkspaceUpdateVersion(organization, workspace, version string) error
	// ModuleList returns all the terraform registry modules.
	ModuleList() ([]*RegistryModule, error)
	// ModuleGet returns the specified terraform registry module.
	ModuleGet(organization, name, provider string) (*RegistryModule, error)
}

TfCloud represents Terraform Cloud API client.

func NewTfCloud

func NewTfCloud(address, token string) (TfCloud, error)

NewTfCloud creates a new TfCloud interface

type Workspace

type Workspace struct {
	ID               string
	Name             string
	TerraformVersion string
	CurrentRun       *tfe.Run
	VCSRepoName      string
}

Workspace represents a Terraform Cloud workspace.

Jump to

Keyboard shortcuts

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