Documentation
¶
Index ¶
- Constants
- Variables
- func Bool(v bool) *bool
- func Int64(v int64) *int64
- func String(v string) *string
- type AuthPolicyType
- type CVStatusTimestamps
- type CategoryType
- type Client
- type Config
- type ConfigurationSource
- type ConfigurationStatus
- type ConfigurationVersion
- type ConfigurationVersionCreateOptions
- type ConfigurationVersionListOptions
- type ConfigurationVersions
- func (s *ConfigurationVersions) Create(ctx context.Context, workspaceID string, ...) (*ConfigurationVersion, error)
- func (s *ConfigurationVersions) List(ctx context.Context, workspaceID string, ...) ([]*ConfigurationVersion, error)
- func (s *ConfigurationVersions) Read(ctx context.Context, cvID string) (*ConfigurationVersion, error)
- func (s *ConfigurationVersions) Upload(ctx context.Context, url, path string) error
- type Enforcement
- type EnforcementLevel
- type EnforcementOptions
- type EnterprisePlanType
- type ListOptions
- type OAuthClient
- type OAuthClientCreateOptions
- type OAuthClients
- type OAuthToken
- type OAuthTokens
- type Organization
- type OrganizationCreateOptions
- type OrganizationListOptions
- type OrganizationPermissions
- type OrganizationToken
- type OrganizationTokens
- type OrganizationUpdateOptions
- type Organizations
- func (s *Organizations) Create(ctx context.Context, options OrganizationCreateOptions) (*Organization, error)
- func (s *Organizations) Delete(ctx context.Context, name string) error
- func (s *Organizations) List(ctx context.Context, options OrganizationListOptions) ([]*Organization, error)
- func (s *Organizations) Read(ctx context.Context, name string) (*Organization, error)
- func (s *Organizations) Update(ctx context.Context, name string, options OrganizationUpdateOptions) (*Organization, error)
- type Policies
- func (s *Policies) Create(ctx context.Context, organization string, options PolicyCreateOptions) (*Policy, error)
- func (s *Policies) Delete(ctx context.Context, policyID string) error
- func (s *Policies) List(ctx context.Context, organization string, options PolicyListOptions) ([]*Policy, error)
- func (s *Policies) Read(ctx context.Context, policyID string) (*Policy, error)
- func (s *Policies) Update(ctx context.Context, policyID string, options PolicyUpdateOptions) (*Policy, error)
- func (s *Policies) Upload(ctx context.Context, policyID string, content []byte) error
- type Policy
- type PolicyActions
- type PolicyCheck
- type PolicyCheckListOptions
- type PolicyChecks
- type PolicyCreateOptions
- type PolicyListOptions
- type PolicyPermissions
- type PolicyResult
- type PolicyScope
- type PolicyStatus
- type PolicyStatusTimestamps
- type PolicyUpdateOptions
- type Run
- type RunActions
- type RunApplyOptions
- type RunCancelOptions
- type RunCreateOptions
- type RunDiscardOptions
- type RunListOptions
- type RunPermissions
- type RunSource
- type RunStatus
- type RunStatusTimestamps
- type Runs
- func (s *Runs) Apply(ctx context.Context, runID string, options RunApplyOptions) error
- func (s *Runs) Cancel(ctx context.Context, runID string, options RunCancelOptions) error
- func (s *Runs) Create(ctx context.Context, options RunCreateOptions) (*Run, error)
- func (s *Runs) Discard(ctx context.Context, runID string, options RunDiscardOptions) error
- func (s *Runs) List(ctx context.Context, workspaceID string, options RunListOptions) ([]*Run, error)
- func (s *Runs) Read(ctx context.Context, runID string) (*Run, error)
- type SSHKey
- type SSHKeyCreateOptions
- type SSHKeyListOptions
- type SSHKeyUpdateOptions
- type SSHKeys
- func (s *SSHKeys) Create(ctx context.Context, organization string, options SSHKeyCreateOptions) (*SSHKey, error)
- func (s *SSHKeys) Delete(ctx context.Context, sshKeyID string) error
- func (s *SSHKeys) List(ctx context.Context, organization string, options SSHKeyListOptions) ([]*SSHKey, error)
- func (s *SSHKeys) Read(ctx context.Context, sshKeyID string) (*SSHKey, error)
- func (s *SSHKeys) Update(ctx context.Context, sshKeyID string, options SSHKeyUpdateOptions) (*SSHKey, error)
- type ServiceProviderType
- type StateVersion
- type StateVersionCreateOptions
- type StateVersionListOptions
- type StateVersions
- func (s *StateVersions) Create(ctx context.Context, workspaceID string, options StateVersionCreateOptions) (*StateVersion, error)
- func (s *StateVersions) Download(ctx context.Context, url string) ([]byte, error)
- func (s *StateVersions) List(ctx context.Context, options StateVersionListOptions) ([]*StateVersion, error)
- func (s *StateVersions) Read(ctx context.Context, svID string) (*StateVersion, error)
- type Team
- type TeamAccess
- type TeamAccessAddOptions
- type TeamAccessListOptions
- type TeamAccessType
- type TeamAccesses
- func (s *TeamAccesses) Add(ctx context.Context, options TeamAccessAddOptions) (*TeamAccess, error)
- func (s *TeamAccesses) List(ctx context.Context, options TeamAccessListOptions) ([]*TeamAccess, error)
- func (s *TeamAccesses) Read(ctx context.Context, teamAccessID string) (*TeamAccess, error)
- func (s *TeamAccesses) Remove(ctx context.Context, teamAccessID string) error
- type TeamCreateOptions
- type TeamListOptions
- type TeamMemberAddOptions
- type TeamMemberRemoveOptions
- type TeamMembers
- type TeamPermissions
- type TeamToken
- type TeamTokens
- type Teams
- func (s *Teams) Create(ctx context.Context, organization string, options TeamCreateOptions) (*Team, error)
- func (s *Teams) Delete(ctx context.Context, teamID string) error
- func (s *Teams) List(ctx context.Context, organization string, options TeamListOptions) ([]*Team, error)
- func (s *Teams) Read(ctx context.Context, teamID string) (*Team, error)
- type TwoFactor
- type User
- type UserUpdateOptions
- type Users
- type VCSRepo
- type VCSRepoOptions
- type Variable
- type VariableCreateOptions
- type VariableListOptions
- type VariableUpdateOptions
- type Variables
- func (s *Variables) Create(ctx context.Context, options VariableCreateOptions) (*Variable, error)
- func (s *Variables) Delete(ctx context.Context, variableID string) error
- func (s *Variables) List(ctx context.Context, options VariableListOptions) ([]*Variable, error)
- func (s *Variables) Update(ctx context.Context, variableID string, options VariableUpdateOptions) (*Variable, error)
- type Workspace
- type WorkspaceActions
- type WorkspaceAssignSSHKeyOptions
- type WorkspaceCreateOptions
- type WorkspaceListOptions
- type WorkspaceLockOptions
- type WorkspacePermissions
- type WorkspaceUpdateOptions
- type Workspaces
- func (s *Workspaces) AssignSSHKey(ctx context.Context, workspaceID string, options WorkspaceAssignSSHKeyOptions) (*Workspace, error)
- func (s *Workspaces) Create(ctx context.Context, organization string, options WorkspaceCreateOptions) (*Workspace, error)
- func (s *Workspaces) Delete(ctx context.Context, organization, workspace string) error
- func (s *Workspaces) List(ctx context.Context, organization string, options WorkspaceListOptions) ([]*Workspace, error)
- func (s *Workspaces) Lock(ctx context.Context, workspaceID string, options WorkspaceLockOptions) (*Workspace, error)
- func (s *Workspaces) Read(ctx context.Context, organization, workspace string) (*Workspace, error)
- func (s *Workspaces) UnassignSSHKey(ctx context.Context, workspaceID string) (*Workspace, error)
- func (s *Workspaces) Unlock(ctx context.Context, workspaceID string) (*Workspace, error)
- func (s *Workspaces) Update(ctx context.Context, organization, workspace string, ...) (*Workspace, error)
Constants ¶
const ( // DefaultAddress of Terraform Enterprise. DefaultAddress = "https://app.terraform.io" // DefaultBasePath on which the API is served. DefaultBasePath = "/api/v2/" )
Variables ¶
var ( ErrUnauthorized = errors.New("unauthorized") // ErrResourceNotFound is returned when a receiving a 404. ErrResourceNotFound = errors.New("resource not found") )
Functions ¶
Types ¶
type AuthPolicyType ¶
type AuthPolicyType string
AuthPolicyType represents an authentication policy type.
const ( AuthPolicyPassword AuthPolicyType = "password" AuthPolicyTwoFactor AuthPolicyType = "two_factor_mandatory" )
List of available authentication policies.
func AuthPolicy ¶
func AuthPolicy(v AuthPolicyType) *AuthPolicyType
AuthPolicy returns a pointer to the given authentication poliy.
type CVStatusTimestamps ¶
type CVStatusTimestamps struct {
FinishedAt time.Time `json:"finished-at"`
QueuedAt time.Time `json:"queued-at"`
StartedAt time.Time `json:"started-at"`
}
CVStatusTimestamps holds the timestamps for individual configuration version statuses.
type CategoryType ¶
type CategoryType string
CategoryType represents a category type.
const ( CategoryEnv CategoryType = "env" CategoryTerraform CategoryType = "terraform" )
List all available categories.
func Category ¶
func Category(v CategoryType) *CategoryType
Category returns a pointer to the given category type.
type Client ¶
type Client struct {
ConfigurationVersions *ConfigurationVersions
OAuthClients *OAuthClients
OAuthTokens *OAuthTokens
Organizations *Organizations
OrganizationTokens *OrganizationTokens
Policies *Policies
PolicyChecks *PolicyChecks
Runs *Runs
StateVersions *StateVersions
SSHKeys *SSHKeys
Teams *Teams
TeamAccess *TeamAccesses
TeamMembers *TeamMembers
TeamTokens *TeamTokens
Users *Users
Variables *Variables
Workspaces *Workspaces
// contains filtered or unexported fields
}
Client is the Terraform Enterprise API client. It provides the basic connectivity and configuration for accessing the TFE API.
type Config ¶
type Config struct {
// The address of the Terraform Enterprise API.
Address string
// The base path on which the API is served.
BasePath string
// API token used to access the Terraform Enterprise API.
Token string
// A custom HTTP client to use.
HTTPClient *http.Client
}
Config provides configuration details to the API client.
type ConfigurationSource ¶
type ConfigurationSource string
ConfigurationSource represents a source of a configuration version.
const ( ConfigurationSourceAPI ConfigurationSource = "tfe-api" ConfigurationSourceBitbucket ConfigurationSource = "bitbucket" ConfigurationSourceGithub ConfigurationSource = "github" ConfigurationSourceGitlab ConfigurationSource = "gitlab" ConfigurationSourceTerraform ConfigurationSource = "terraform" )
List all available configuration version sources.
type ConfigurationStatus ¶
type ConfigurationStatus string
ConfigurationStatus represents a configuration version status.
const ( ConfigurationErrored ConfigurationStatus = "errored" ConfigurationPending ConfigurationStatus = "pending" ConfigurationUploaded ConfigurationStatus = "uploaded" )
List all available configuration version statuses.
type ConfigurationVersion ¶
type ConfigurationVersion struct {
ID string `jsonapi:"primary,configuration-versions"`
AutoQueueRuns bool `jsonapi:"attr,auto-queue-runs"`
Error string `jsonapi:"attr,error"`
ErrorMessage string `jsonapi:"attr,error-message"`
Source ConfigurationSource `jsonapi:"attr,source"`
Status ConfigurationStatus `jsonapi:"attr,status"`
StatusTimestamps *CVStatusTimestamps `jsonapi:"attr,status-timestamps"`
UploadURL string `jsonapi:"attr,upload-url"`
}
ConfigurationVersion is a representation of an uploaded or ingressed Terraform configuration in TFE. A workspace must have at least one configuration version before any runs may be queued on it.
type ConfigurationVersionCreateOptions ¶
type ConfigurationVersionCreateOptions struct {
// For internal use only!
ID string `jsonapi:"primary,configuration-versions"`
// When true, runs are queued automatically when the configuration version
// is uploaded.
AutoQueueRuns *bool `jsonapi:"attr,auto-queue-runs,omitempty"`
}
ConfigurationVersionCreateOptions represents the options for creating a configuration version.
type ConfigurationVersionListOptions ¶
type ConfigurationVersionListOptions struct {
ListOptions
}
ConfigurationVersionListOptions represents the options for listing configuration versions.
type ConfigurationVersions ¶
type ConfigurationVersions struct {
// contains filtered or unexported fields
}
ConfigurationVersions handles communication with the configuration version related methods of the Terraform Enterprise API.
TFE API docs: https://www.terraform.io/docs/enterprise/api/configuration-versions.html
func (*ConfigurationVersions) Create ¶
func (s *ConfigurationVersions) Create(ctx context.Context, workspaceID string, options ConfigurationVersionCreateOptions) (*ConfigurationVersion, error)
Create is used to create a new configuration version. The created configuration version will be usable once data is uploaded to it.
func (*ConfigurationVersions) List ¶
func (s *ConfigurationVersions) List(ctx context.Context, workspaceID string, options ConfigurationVersionListOptions) ([]*ConfigurationVersion, error)
List returns all configuration versions of a workspace.
func (*ConfigurationVersions) Read ¶
func (s *ConfigurationVersions) Read(ctx context.Context, cvID string) (*ConfigurationVersion, error)
Read single configuration version by its ID.
type Enforcement ¶
type Enforcement struct {
Path string `json:"path"`
Mode EnforcementLevel `json:"mode"`
}
Enforcement describes a enforcement.
type EnforcementLevel ¶
type EnforcementLevel string
EnforcementLevel represents an enforcement level.
const ( EnforcementAdvisory EnforcementLevel = "advisory" EnforcementHard EnforcementLevel = "hard-mandatory" EnforcementSoft EnforcementLevel = "soft-mandatory" )
List the available enforcement types.
func EnforcementMode ¶
func EnforcementMode(v EnforcementLevel) *EnforcementLevel
EnforcementMode returns a pointer to the given enforcement level.
type EnforcementOptions ¶
type EnforcementOptions struct {
Path *string `json:"path,omitempty"`
Mode *EnforcementLevel `json:"mode"`
}
EnforcementOptions represents the enforcement options of a policy.
type EnterprisePlanType ¶
type EnterprisePlanType string
EnterprisePlanType represents an enterprise plan type.
const ( EnterprisePlanDisabled EnterprisePlanType = "disabled" EnterprisePlanPremium EnterprisePlanType = "premium" EnterprisePlanPro EnterprisePlanType = "pro" EnterprisePlanTrial EnterprisePlanType = "trial" )
List of available enterprise plan types.
type ListOptions ¶
type ListOptions struct {
// The page number to request. The results vary based on the PageSize.
PageNumber int `url:"page[number],omitempty"`
// The number of elements returned in a single page.
PageSize int `url:"page[size],omitempty"`
}
ListOptions is used to specify pagination options when making API requests. Pagination allows breaking up large result sets into chunks, or "pages".
type OAuthClient ¶
type OAuthClient struct {
ID string `jsonapi:"primary,oauth-clients"`
APIURL string `jsonapi:"attr,api-url"`
CallbackURL string `jsonapi:"attr,callback-url"`
ConnectPath string `jsonapi:"attr,connect-path"`
CreatedAt time.Time `jsonapi:"attr,created-at,iso8601"`
HTTPURL string `jsonapi:"attr,http-url"`
Key string `jsonapi:"attr,key"`
RSAPublicKey string `jsonapi:"attr,rsa-public-key"`
ServiceProvider ServiceProviderType `jsonapi:"attr,service-provider"`
ServiceProviderName string `jsonapi:"attr,service-provider-display-name"`
// Relations
Organization *Organization `jsonapi:"relation,organization"`
OAuthToken []*OAuthToken `jsonapi:"relation,oauth-token"`
}
OAuthClient represents a connection between an organization and a VCS provider.
type OAuthClientCreateOptions ¶
type OAuthClientCreateOptions struct {
// For internal use only!
ID string `jsonapi:"primary,oauth-clients"`
// The base URL of your VCS provider's API.
APIURL *string `jsonapi:"attr,api-url"`
// The homepage of your VCS provider.
HTTPURL *string `jsonapi:"attr,http-url"`
// The key you were given by your VCS provider.
Key *string `jsonapi:"attr,key"`
// The secret you were given by your VCS provider.
Secret *string `jsonapi:"attr,secret"`
// The VCS provider being connected with.
ServiceProvider *ServiceProviderType `jsonapi:"attr,service-provider"`
}
OAuthClientCreateOptions represents the options for creating an OAuth client.
type OAuthClients ¶
type OAuthClients struct {
// contains filtered or unexported fields
}
OAuthClients handles communication with the OAuth client related methods of the Terraform Enterprise API.
TFE API docs: https://www.terraform.io/docs/enterprise/api/oauth-clients.html
func (*OAuthClients) Create ¶
func (s *OAuthClients) Create(ctx context.Context, organization string, options OAuthClientCreateOptions) (*OAuthClient, error)
Create a VCS connection between an organization and a VCS provider.
type OAuthToken ¶
type OAuthToken struct {
ID string `jsonapi:"primary,oauth-tokens"`
UID string `jsonapi:"attr,uid"`
CreatedAt time.Time `jsonapi:"attr,created-at,iso8601"`
HasSSHKey bool `jsonapi:"attr,has-ssh-key"`
ServiceProviderUser string `jsonapi:"attr,service-provider-user"`
// Relations
OAuthClient *OAuthClient `jsonapi:"relation,oauth-client"`
}
OAuthToken represents a VCS configuration including the assocaited OAuth token
type OAuthTokens ¶
type OAuthTokens struct {
// contains filtered or unexported fields
}
OAuthTokens handles communication with the OAuth token related methods of the Terraform Enterprise API.
TFE API docs: https://www.terraform.io/docs/enterprise/api/oauth-tokens.html
func (*OAuthTokens) List ¶
func (s *OAuthTokens) List(ctx context.Context, organization string) ([]*OAuthToken, error)
List all the OAuth Tokens for a given organization.
type Organization ¶
type Organization struct {
Name string `jsonapi:"primary,organizations"`
CollaboratorAuthPolicy AuthPolicyType `jsonapi:"attr,collaborator-auth-policy"`
CreatedAt time.Time `jsonapi:"attr,created-at,iso8601"`
Email string `jsonapi:"attr,email"`
EnterprisePlan EnterprisePlanType `jsonapi:"attr,enterprise-plan"`
OwnersTeamSamlRoleID string `jsonapi:"attr,owners-team-saml-role-id"`
Permissions *OrganizationPermissions `jsonapi:"attr,permissions"`
SAMLEnabled bool `jsonapi:"attr,saml-enabled"`
SessionRemember int `jsonapi:"attr,session-remember"`
SessionTimeout int `jsonapi:"attr,session-timeout"`
TrialExpiresAt time.Time `jsonapi:"attr,trial-expires-at,iso8601"`
TwoFactorConformant bool `jsonapi:"attr,two-factor-conformant"`
}
Organization represents a Terraform Enterprise organization.
type OrganizationCreateOptions ¶
type OrganizationCreateOptions struct {
// For internal use only!
ID string `jsonapi:"primary,organizations"`
// Name of the organization.
Name *string `jsonapi:"attr,name"`
// Admin email address.
Email *string `jsonapi:"attr,email"`
}
OrganizationCreateOptions represents the options for creating an organization.
type OrganizationListOptions ¶
type OrganizationListOptions struct {
ListOptions
}
OrganizationListOptions represents the options for listing organizations.
type OrganizationPermissions ¶
type OrganizationPermissions struct {
CanCreateTeam bool `json:"can-create-team"`
CanCreateWorkspace bool `json:"can-create-workspace"`
CanCreateWorkspaceMigration bool `json:"can-create-workspace-migration"`
CanDestroy bool `json:"can-destroy"`
CanTraverse bool `json:"can-traverse"`
CanUpdate bool `json:"can-update"`
CanUpdateAPIToken bool `json:"can-update-api-token"`
CanUpdateOAuth bool `json:"can-update-oauth"`
CanUpdateSentinel bool `json:"can-update-sentinel"`
}
OrganizationPermissions represents the organization permissions.
type OrganizationToken ¶
type OrganizationToken struct {
ID string `jsonapi:"primary,authentication-tokens"`
CreatedAt time.Time `jsonapi:"attr,created-at,iso8601"`
Description string `jsonapi:"attr,description"`
LastUsedAt time.Time `jsonapi:"attr,last-used-at,iso8601"`
Token string `jsonapi:"attr,token"`
}
OrganizationToken represents a Terraform Enterprise organization token.
type OrganizationTokens ¶
type OrganizationTokens struct {
// contains filtered or unexported fields
}
OrganizationTokens handles communication with the organization token related methods of the Terraform Enterprise API.
TFE API docs: https://www.terraform.io/docs/enterprise/api/organization-tokens.html
func (*OrganizationTokens) Delete ¶
func (s *OrganizationTokens) Delete(ctx context.Context, organization string) error
Delete an organization token.
func (*OrganizationTokens) Generate ¶
func (s *OrganizationTokens) Generate(ctx context.Context, organization string) (*OrganizationToken, error)
Generate a new organization token, replacing any existing token.
type OrganizationUpdateOptions ¶
type OrganizationUpdateOptions struct {
// For internal use only!
ID string `jsonapi:"primary,organizations"`
// New name for the organization.
Name *string `jsonapi:"attr,name,omitempty"`
// New admin email address.
Email *string `jsonapi:"attr,email,omitempty"`
// Session expiration (minutes).
SessionRemember *int `jsonapi:"attr,session-remember,omitempty"`
// Session timeout after inactivity (minutes).
SessionTimeout *int `jsonapi:"attr,session-timeout,omitempty"`
// Authentication policy.
CollaboratorAuthPolicy *AuthPolicyType `jsonapi:"attr,collaborator-auth-policy,omitempty"`
}
OrganizationUpdateOptions represents the options for updating an organization.
type Organizations ¶
type Organizations struct {
// contains filtered or unexported fields
}
Organizations handles communication with the organization related methods of the Terraform Enterprise API.
TFE API docs: https://www.terraform.io/docs/enterprise/api/organizations.html
func (*Organizations) Create ¶
func (s *Organizations) Create(ctx context.Context, options OrganizationCreateOptions) (*Organization, error)
Create a new organization with the given name and email.
func (*Organizations) Delete ¶
func (s *Organizations) Delete(ctx context.Context, name string) error
Delete an organization by its name.
func (*Organizations) List ¶
func (s *Organizations) List(ctx context.Context, options OrganizationListOptions) ([]*Organization, error)
List returns all the organizations visible to the current user.
func (*Organizations) Read ¶
func (s *Organizations) Read(ctx context.Context, name string) (*Organization, error)
Read single organization by its name.
func (*Organizations) Update ¶
func (s *Organizations) Update(ctx context.Context, name string, options OrganizationUpdateOptions) (*Organization, error)
Update attributes of an existing organization.
type Policies ¶
type Policies struct {
// contains filtered or unexported fields
}
Policies handles communication with the policy related methods of the Terraform Enterprise API.
TFE API docs: https://www.terraform.io/docs/enterprise/api/policies.html
func (*Policies) Create ¶
func (s *Policies) Create(ctx context.Context, organization string, options PolicyCreateOptions) (*Policy, error)
Create a policy and associate it with an organization.
func (*Policies) List ¶
func (s *Policies) List(ctx context.Context, organization string, options PolicyListOptions) ([]*Policy, error)
List all the policies for a given organization
type Policy ¶
type Policy struct {
ID string `jsonapi:"primary,policies"`
Name string `jsonapi:"attr,name"`
Enforce []*Enforcement `jsonapi:"attr,enforce"`
UpdatedAt time.Time `jsonapi:"attr,updated-at,iso8601"`
}
Policy represents a Terraform Enterprise policy.
type PolicyActions ¶
type PolicyActions struct {
IsOverridable bool `json:"is-overridable"`
}
PolicyActions represents the policy check actions.
type PolicyCheck ¶
type PolicyCheck struct {
ID string `jsonapi:"primary,policy-checks"`
Actions *PolicyActions `jsonapi:"attr,actions"`
Permissions *PolicyPermissions `jsonapi:"attr,permissions"`
Result *PolicyResult `jsonapi:"attr,result"`
Scope PolicyScope `jsonapi:"attr,source"`
Status PolicyStatus `jsonapi:"attr,status"`
StatusTimestamps *PolicyStatusTimestamps `jsonapi:"attr,status-timestamps"`
}
PolicyCheck represents a Terraform Enterprise policy check..
type PolicyCheckListOptions ¶
type PolicyCheckListOptions struct {
ListOptions
}
PolicyCheckListOptions represents the options for listing policy checks.
type PolicyChecks ¶
type PolicyChecks struct {
// contains filtered or unexported fields
}
PolicyChecks handles communication with the policy checks related methods of the Terraform Enterprise API.
TFE API docs: https://www.terraform.io/docs/enterprise/api/policy-checks.html
func (*PolicyChecks) List ¶
func (s *PolicyChecks) List(ctx context.Context, runID string, options PolicyCheckListOptions) ([]*PolicyCheck, error)
List all policy checks of the given run.
func (*PolicyChecks) Override ¶
func (s *PolicyChecks) Override(ctx context.Context, policyCheckID string) (*PolicyCheck, error)
Override a soft-mandatory or warning policy.
type PolicyCreateOptions ¶
type PolicyCreateOptions struct {
// For internal use only!
ID string `jsonapi:"primary,policies"`
// The name of the policy.
Name *string `jsonapi:"attr,name"`
// The enforcements of the policy.
Enforce []*EnforcementOptions `jsonapi:"attr,enforce"`
}
PolicyCreateOptions represents the options for creating a new policy.
type PolicyListOptions ¶
type PolicyListOptions struct {
ListOptions
}
PolicyListOptions represents the options for listing policies.
type PolicyPermissions ¶
type PolicyPermissions struct {
CanOverride bool `json:"can-override"`
}
PolicyPermissions represents the policy check permissions.
type PolicyResult ¶
type PolicyResult struct {
AdvisoryFailed int `json:"advisory-failed"`
Duration int `json:"duration"`
HardFailed int `json:"hard-failed"`
Passed int `json:"passed"`
Result bool `json:"result"`
// Sentinel *sentinel.EvalResult `json:"sentinel"`
SoftFailed int `json:"soft-failed"`
TotalFailed int `json:"total-failed"`
}
PolicyResult represents the complete policy check result,
type PolicyScope ¶
type PolicyScope string
PolicyScope represents a policy scope.
const ( PolicyScopeOrganization PolicyScope = "organization" PolicyScopeWorkspace PolicyScope = "workspace" )
List all available policy scopes.
type PolicyStatus ¶
type PolicyStatus string
PolicyStatus represents a policy check state.
const ( PolicyErrored PolicyStatus = "errored" PolicyHardFailed PolicyStatus = "hard_failed" PolicyOverridden PolicyStatus = "overridden" PolicyPasses PolicyStatus = "passed" PolicyPending PolicyStatus = "pending" PolicyQueued PolicyStatus = "queued" PolicySoftFailed PolicyStatus = "soft_failed" )
List all available policy check statuses.
type PolicyStatusTimestamps ¶
type PolicyStatusTimestamps struct {
ErroredAt time.Time `json:"errored-at"`
HardFailedAt time.Time `json:"hard-failed-at"`
PassedAt time.Time `json:"passed-at"`
QueuedAt time.Time `json:"queued-at"`
SoftFailedAt time.Time `json:"soft-failed-at"`
}
PolicyStatusTimestamps holds the timestamps for individual policy check statuses.
type PolicyUpdateOptions ¶
type PolicyUpdateOptions struct {
// For internal use only!
ID string `jsonapi:"primary,policies"`
// The enforcements of the policy.
Enforce []*EnforcementOptions `jsonapi:"attr,enforce"`
}
PolicyUpdateOptions represents the options for updating a policy.
type Run ¶
type Run struct {
ID string `jsonapi:"primary,runs"`
Actions *RunActions `jsonapi:"attr,actions"`
CreatedAt time.Time `jsonapi:"attr,created-at,iso8601"`
HasChanges bool `jsonapi:"attr,has-changes"`
IsDestroy bool `jsonapi:"attr,is-destroy"`
Message string `jsonapi:"attr,message"`
Permissions *RunPermissions `jsonapi:"attr,permissions"`
Source RunSource `jsonapi:"attr,source"`
Status RunStatus `jsonapi:"attr,status"`
StatusTimestamps *RunStatusTimestamps `jsonapi:"attr,status-timestamps"`
// Relations
ConfigurationVersion *ConfigurationVersion `jsonapi:"relation,configuration-version"`
Workspace *Workspace `jsonapi:"relation,workspace"`
}
Run represents a Terraform Enterprise run.
type RunActions ¶
type RunActions struct {
IsCancelable bool `json:"is-cancelable"`
IsComfirmable bool `json:"is-comfirmable"`
IsDiscardable bool `json:"is-discardable"`
}
RunActions represents the run actions.
type RunApplyOptions ¶
type RunApplyOptions struct {
// An optional comment about the run.
Comment *string `json:"comment,omitempty"`
}
RunApplyOptions represents the options for applying a run.
type RunCancelOptions ¶
type RunCancelOptions struct {
// An optional explanation for why the run was canceled.
Comment *string `json:"comment,omitempty"`
}
RunCancelOptions represents the options for canceling a run.
type RunCreateOptions ¶
type RunCreateOptions struct {
// For internal use only!
ID string `jsonapi:"primary,runs"`
// Specifies if this plan is a destroy plan, which will destroy all
// provisioned resources.
IsDestroy *bool `jsonapi:"attr,is-destroy,omitempty"`
// Specifies the message to be associated with this run.
Message *string `jsonapi:"attr,message,omitempty"`
// Specifies the configuration version to use for this run. If the
// configuration version object is omitted, the run will be created using the
// workspace's latest configuration version.
ConfigurationVersion *ConfigurationVersion `jsonapi:"relation,configuration-version"`
// Specifies the workspace where the run will be executed.
Workspace *Workspace `jsonapi:"relation,workspace"`
}
RunCreateOptions represents the options for creating a new run.
type RunDiscardOptions ¶
type RunDiscardOptions struct {
// An optional explanation for why the run was discarded.
Comment *string `json:"comment,omitempty"`
}
RunDiscardOptions represents the options for discarding a run.
type RunListOptions ¶
type RunListOptions struct {
ListOptions
}
RunListOptions represents the options for listing runs.
type RunPermissions ¶
type RunPermissions struct {
CanApply bool `json:"can-apply"`
CanCancel bool `json:"can-cancel"`
CanDiscard bool `json:"can-discard"`
CanForceExecute bool `json:"can-force-execute"`
}
RunPermissions represents the run permissions.
type RunStatus ¶
type RunStatus string
RunStatus represents a run state.
const ( RunApplied RunStatus = "applied" RunApplying RunStatus = "applying" RunCanceled RunStatus = "canceled" RunConfirmed RunStatus = "confirmed" RunDiscarded RunStatus = "discarded" RunErrored RunStatus = "errored" RunPending RunStatus = "pending" RunPlanned RunStatus = "planned" RunPlanning RunStatus = "planning" RunPolicyChecked RunStatus = "policy_checked" RunPolicyChecking RunStatus = "policy_checking" RunPolicyOverride RunStatus = "policy_override" )
List all available run statuses.
type RunStatusTimestamps ¶
type RunStatusTimestamps struct {
ErroredAt time.Time `json:"errored-at"`
FinishedAt time.Time `json:"finished-at"`
QueuedAt time.Time `json:"queued-at"`
StartedAt time.Time `json:"started-at"`
}
RunStatusTimestamps holds the timestamps for individual run statuses.
type Runs ¶
type Runs struct {
// contains filtered or unexported fields
}
Runs handles communication with the run related methods of the Terraform Enterprise API.
TFE API docs: https://www.terraform.io/docs/enterprise/api/run.html
type SSHKeyCreateOptions ¶
type SSHKeyCreateOptions struct {
// For internal use only!
ID string `jsonapi:"primary,ssh-keys"`
// A name to identify the SSH key.
Name *string `jsonapi:"attr,name"`
// The content of the SSH private key.
Value *string `jsonapi:"attr,value"`
}
SSHKeyCreateOptions represents the options for creating an SSH key.
type SSHKeyListOptions ¶
type SSHKeyListOptions struct {
ListOptions
}
SSHKeyListOptions represents the options for listing SSH keys.
type SSHKeyUpdateOptions ¶
type SSHKeyUpdateOptions struct {
// For internal use only!
ID string `jsonapi:"primary,ssh-keys"`
// A new name to identify the SSH key.
Name *string `jsonapi:"attr,name,omitempty"`
// Updated content of the SSH private key.
Value *string `jsonapi:"attr,value,omitempty"`
}
SSHKeyUpdateOptions represents the options for updating an SSH key.
type SSHKeys ¶
type SSHKeys struct {
// contains filtered or unexported fields
}
SSHKeys handles communication with the SSH key related methods of the Terraform Enterprise API.
TFE API docs: https://www.terraform.io/docs/enterprise/api/ssh-keys.html
func (*SSHKeys) Create ¶
func (s *SSHKeys) Create(ctx context.Context, organization string, options SSHKeyCreateOptions) (*SSHKey, error)
Create an SSH key and associate it with an organization.
func (*SSHKeys) List ¶
func (s *SSHKeys) List(ctx context.Context, organization string, options SSHKeyListOptions) ([]*SSHKey, error)
List returns all the organizations visible to the current user.
type ServiceProviderType ¶
type ServiceProviderType string
ServiceProviderType represents a VCS type.
const ( ServiceProviderBitbucket ServiceProviderType = "bitbucket_hosted" ServiceProviderBitbucketServer ServiceProviderType = "bitbucket_server" ServiceProviderGithub ServiceProviderType = "github" ServiceProviderGithubEE ServiceProviderType = "github_enterprise" ServiceProviderGitlab ServiceProviderType = "gitlab_hosted" ServiceProviderGitlabCE ServiceProviderType = "gitlab_community_edition" ServiceProviderGitlabEE ServiceProviderType = "gitlab_enterprise_edition" )
List of available VCS types.
func ServiceProvider ¶
func ServiceProvider(v ServiceProviderType) *ServiceProviderType
ServiceProvider returns a pointer to the given service provider type.
type StateVersion ¶
type StateVersion struct {
ID string `jsonapi:"primary,state-versions"`
CreatedAt time.Time `jsonapi:"attr,created-at,iso8601"`
DownloadURL string `jsonapi:"attr,hosted-state-download-url"`
Serial int `jsonapi:"attr,serial"`
VCSCommitSHA string `jsonapi:"attr,vcs-commit-sha"`
VCSCommitURL string `jsonapi:"attr,vcs-commit-url"`
// Relations
Run *Run `jsonapi:"relation,run"`
}
StateVersion represents a Terraform Enterprise state version.
type StateVersionCreateOptions ¶
type StateVersionCreateOptions struct {
// For internal use only!
ID string `jsonapi:"primary,state-versions"`
// The lineage of the state.
Lineage *string `jsonapi:"attr,lineage,omitempty"`
// The MD5 hash of the state version.
MD5 *string `jsonapi:"attr,md5"`
// The serial of the state.
Serial *int64 `jsonapi:"attr,serial"`
// The base64 encoded state.
State *string `jsonapi:"attr,state"`
}
StateVersionCreateOptions represents the options for creating a state version.
type StateVersionListOptions ¶
type StateVersionListOptions struct {
ListOptions
Organization *string `url:"filter[organization][name]"`
Workspace *string `url:"filter[workspace][name]"`
}
StateVersionListOptions represents the options for listing state versions.
type StateVersions ¶
type StateVersions struct {
// contains filtered or unexported fields
}
StateVersions handles communication with the state version related methods of the Terraform Enterprise API.
TFE API docs: https://www.terraform.io/docs/enterprise/api/state-versions.html
func (*StateVersions) Create ¶
func (s *StateVersions) Create(ctx context.Context, workspaceID string, options StateVersionCreateOptions) (*StateVersion, error)
Create a new state version with the given name.
func (*StateVersions) List ¶
func (s *StateVersions) List(ctx context.Context, options StateVersionListOptions) ([]*StateVersion, error)
List returns all the organizations visible to the current user.
func (*StateVersions) Read ¶
func (s *StateVersions) Read(ctx context.Context, svID string) (*StateVersion, error)
Read a single state version by its ID.
type Team ¶
type Team struct {
ID string `jsonapi:"primary,teams"`
Name string `jsonapi:"attr,name"`
Permissions *TeamPermissions `jsonapi:"attr,permissions"`
UserCount int `jsonapi:"attr,users-count"`
}
Team represents a Terraform Enterprise team.
type TeamAccess ¶
type TeamAccess struct {
ID string `jsonapi:"primary,team-workspaces"`
Access TeamAccessType `jsonapi:"attr,access"`
// Relations
Team *Team `jsonapi:"relation,team"`
Workspace *Workspace `jsonapi:"relation,workspace"`
}
TeamAccess represents the workspace access for a team.
type TeamAccessAddOptions ¶
type TeamAccessAddOptions struct {
// For internal use only!
ID string `jsonapi:"primary,team-workspaces"`
// The type of access to grant.
Access *TeamAccessType `jsonapi:"attr,access"`
// The team to add to the workspace
Team *Team `jsonapi:"relation,team"`
// The workspace to which the team is to be added.
Workspace *Workspace `jsonapi:"relation,workspace"`
}
TeamAccessAddOptions represents the options for adding team access.
type TeamAccessListOptions ¶
type TeamAccessListOptions struct {
ListOptions
WorkspaceID *string `url:"filter[workspace][id],omitempty"`
}
TeamAccessListOptions represents the options for listing team accesses.
type TeamAccessType ¶
type TeamAccessType string
TeamAccessType represents a team access type.
const ( TeamAccessAdmin TeamAccessType = "admin" TeamAccessRead TeamAccessType = "read" TeamAccessWrite TeamAccessType = "write" )
List all available team access types.
func Access ¶
func Access(v TeamAccessType) *TeamAccessType
Access returns a pointer to the given team access type.
type TeamAccesses ¶
type TeamAccesses struct {
// contains filtered or unexported fields
}
TeamAccesses handles communication with the team access related methods of the Terraform Enterprise API.
TFE API docs: https://www.terraform.io/docs/enterprise/api/team-access.html
func (*TeamAccesses) Add ¶
func (s *TeamAccesses) Add(ctx context.Context, options TeamAccessAddOptions) (*TeamAccess, error)
Add team access for a workspace.
func (*TeamAccesses) List ¶
func (s *TeamAccesses) List(ctx context.Context, options TeamAccessListOptions) ([]*TeamAccess, error)
List returns the team accesses for a given workspace.
func (*TeamAccesses) Read ¶
func (s *TeamAccesses) Read(ctx context.Context, teamAccessID string) (*TeamAccess, error)
Read a sible team access by its ID.
type TeamCreateOptions ¶
type TeamCreateOptions struct {
// For internal use only!
ID string `jsonapi:"primary,teams"`
// Name of the team.
Name *string `jsonapi:"attr,name"`
}
TeamCreateOptions represents the options for creating a team.
type TeamListOptions ¶
type TeamListOptions struct {
ListOptions
}
TeamListOptions represents the options for listing teams.
type TeamMemberAddOptions ¶
type TeamMemberAddOptions struct {
Usernames []string
}
TeamMemberAddOptions represents the options for adding team members.
type TeamMemberRemoveOptions ¶
type TeamMemberRemoveOptions struct {
Usernames []string
}
TeamMemberRemoveOptions represents the options for deleting team members.
type TeamMembers ¶
type TeamMembers struct {
// contains filtered or unexported fields
}
TeamMembers handles communication with the team member related methods of the Terraform Enterprise API.
TFE API docs: https://www.terraform.io/docs/enterprise/api/team-members.html
func (*TeamMembers) Add ¶
func (s *TeamMembers) Add(ctx context.Context, teamID string, options TeamMemberAddOptions) error
Add multiple users to a team.
func (*TeamMembers) Remove ¶
func (s *TeamMembers) Remove(ctx context.Context, teamID string, options TeamMemberRemoveOptions) error
Remove multiple users from a team.
type TeamPermissions ¶
type TeamPermissions struct {
CanDestroy bool `json:"can-destroy"`
CanUpdateMembership bool `json:"can-update-membership"`
}
TeamPermissions represents the team permissions.
type TeamToken ¶
type TeamToken struct {
ID string `jsonapi:"primary,authentication-tokens"`
CreatedAt time.Time `jsonapi:"attr,created-at,iso8601"`
Description string `jsonapi:"attr,description"`
LastUsedAt time.Time `jsonapi:"attr,last-used-at,iso8601"`
Token string `jsonapi:"attr,token"`
}
TeamToken represents a Terraform Enterprise team token.
type TeamTokens ¶
type TeamTokens struct {
// contains filtered or unexported fields
}
TeamTokens handles communication with the team token related methods of the Terraform Enterprise API.
TFE API docs: https://www.terraform.io/docs/enterprise/api/team-tokens.html
type Teams ¶
type Teams struct {
// contains filtered or unexported fields
}
Teams handles communication with the team related methods of the Terraform Enterprise API.
TFE API docs: https://www.terraform.io/docs/enterprise/api/teams.html
func (*Teams) Create ¶
func (s *Teams) Create(ctx context.Context, organization string, options TeamCreateOptions) (*Team, error)
Create a new team with the given name.
type User ¶
type User struct {
ID string `jsonapi:"primary,users"`
AvatarURL string `jsonapi:"attr,avatar-url"`
Email string `jsonapi:"attr,email"`
IsServiceAccount bool `jsonapi:"attr,is-service-account"`
TwoFactor *TwoFactor `jsonapi:"attr,two-factor"`
UnconfirmedEmail string `jsonapi:"attr,unconfirmed-email"`
Username string `jsonapi:"attr,username"`
V2Only bool `jsonapi:"attr,v2-only"`
}
User represents a Terraform Enterprise user.
type UserUpdateOptions ¶
type UserUpdateOptions struct {
// For internal use only!
ID string `jsonapi:"primary,users"`
// New username.
Username *string `jsonapi:"attr,username,omitempty"`
// New email address (must be consumed afterwards to take effect).
Email *string `jsonapi:"attr,email,omitempty"`
}
UserUpdateOptions represents the options for updating a user.
type Users ¶
type Users struct {
// contains filtered or unexported fields
}
Users handles communication with the user related methods of the the Terraform Enterprise API.
TFE API docs: https://www.terraform.io/docs/enterprise/api/user.html
func (*Users) ReadCurrent ¶
ReadCurrent reads the details of the currently authenticated user.
type VCSRepo ¶
type VCSRepo struct {
Branch string `json:"branch"`
Identifier string `json:"identifier"`
IncludeSubmodules bool `json:"ingress-submodules"`
OAuthTokenID string `json:"oauth-token-id"`
}
VCSRepo contains the configuration of a VCS integration.
type VCSRepoOptions ¶
type VCSRepoOptions struct {
Branch *string `json:"branch,omitempty"`
Identifier *string `json:"identifier,omitempty"`
IncludeSubmodules *bool `json:"ingress-submodules,omitempty"`
OAuthTokenID *string `json:"oauth-token-id,omitempty"`
}
VCSRepoOptions represents the configuration options of a VCS integration.
type Variable ¶
type Variable struct {
ID string `jsonapi:"primary,vars"`
Key string `jsonapi:"attr,key"`
Value string `jsonapi:"attr,value"`
Category CategoryType `jsonapi:"attr,category"`
HCL bool `jsonapi:"attr,hcl"`
Sensitive bool `jsonapi:"attr,sensitive"`
// Relations
Workspace *Workspace `jsonapi:"relation,workspace"`
}
Variable represents a Terraform Enterprise variable.
type VariableCreateOptions ¶
type VariableCreateOptions struct {
// For internal use only!
ID string `jsonapi:"primary,vars"`
// The name of the variable.
Key *string `jsonapi:"attr,key"`
// The value of the variable.
Value *string `jsonapi:"attr,value"`
// Whether this is a Terraform or environment variable.
Category *CategoryType `jsonapi:"attr,category"`
// Whether to evaluate the value of the variable as a string of HCL code.
HCL *bool `jsonapi:"attr,hcl,omitempty"`
// Whether the value is sensitive.
Sensitive *bool `jsonapi:"attr,sensitive,omitempty"`
// The workspace that owns the variable.
Workspace *Workspace `jsonapi:"relation,workspace"`
}
VariableCreateOptions represents the options for creating a new variable.
type VariableListOptions ¶
type VariableListOptions struct {
ListOptions
Organization *string `url:"filter[organization][name]"`
Workspace *string `url:"filter[workspace][name]"`
}
VariableListOptions represents the options for listing variables.
type VariableUpdateOptions ¶
type VariableUpdateOptions struct {
// For internal use only!
ID string `jsonapi:"primary,vars"`
// The name of the variable.
Key *string `jsonapi:"attr,key,omitempty"`
// The value of the variable.
Value *string `jsonapi:"attr,value,omitempty"`
// Whether this is a Terraform or environment variable.
Category *CategoryType `jsonapi:"attr,category,omitempty"`
// Whether to evaluate the value of the variable as a string of HCL code.
HCL *bool `jsonapi:"attr,hcl,omitempty"`
// Whether the value is sensitive.
Sensitive *bool `jsonapi:"attr,sensitive,omitempty"`
}
VariableUpdateOptions represents the options for updating a variable.
type Variables ¶
type Variables struct {
// contains filtered or unexported fields
}
Variables handles communication with the variable related methods of the Terraform Enterprise API.
TFE API docs: https://www.terraform.io/docs/enterprise/api/variables.html
type Workspace ¶
type Workspace struct {
ID string `jsonapi:"primary,workspaces"`
Actions *WorkspaceActions `jsonapi:"attr,actions"`
AutoApply bool `jsonapi:"attr,auto-apply"`
CanQueueDestroyPlan bool `jsonapi:"attr,can-queue-destroy-plan"`
CreatedAt time.Time `jsonapi:"attr,created-at,iso8601"`
Environment string `jsonapi:"attr,environment"`
Locked bool `jsonapi:"attr,locked"`
MigrationEnvironment string `jsonapi:"attr,migration-environment"`
Name string `jsonapi:"attr,name"`
Permissions *WorkspacePermissions `jsonapi:"attr,permissions"`
TerraformVersion string `jsonapi:"attr,terraform-version"`
VCSRepo *VCSRepo `jsonapi:"attr,vcs-repo"`
WorkingDirectory string `jsonapi:"attr,working-directory"`
// Relations
Organization *Organization `jsonapi:"relation,organization"`
SSHKey *SSHKey `jsonapi:"relation,ssh-key"`
}
Workspace represents a Terraform Enterprise workspace.
type WorkspaceActions ¶
type WorkspaceActions struct {
IsDestroyable bool `json:"is-destroyable"`
}
WorkspaceActions represents the workspace actions.
type WorkspaceAssignSSHKeyOptions ¶
type WorkspaceAssignSSHKeyOptions struct {
// For internal use only!
ID string `jsonapi:"primary,workspaces"`
// The SSH key ID to assign.
SSHKeyID *string `jsonapi:"attr,id"`
}
WorkspaceAssignSSHKeyOptions represents the options to assign an SSH key to a workspace.
type WorkspaceCreateOptions ¶
type WorkspaceCreateOptions struct {
// For internal use only!
ID string `jsonapi:"primary,workspaces"`
// Whether to automatically apply changes when a Terraform plan is successful.
AutoApply *bool `jsonapi:"attr,auto-apply,omitempty"`
// The legacy TFE environment to use as the source of the migration, in the
// form organization/environment. Omit this unless you are migrating a legacy
// environment.
MigrationEnvironment *string `jsonapi:"attr,migration-environment,omitempty"`
// The name of the workspace, which can only include letters, numbers, -,
// and _. This will be used as an identifier and must be unique in the
// organization.
Name *string `jsonapi:"attr,name"`
// The version of Terraform to use for this workspace. Upon creating a
// workspace, the latest version is selected unless otherwise specified.
TerraformVersion *string `jsonapi:"attr,terraform-version,omitempty"`
// Settings for the workspace's VCS repository. If omitted, the workspace is
// created without a VCS repo. If included, you must specify at least the
// oauth-token-id and identifier keys below.
VCSRepo *VCSRepoOptions `jsonapi:"attr,vcs-repo,omitempty"`
// A relative path that Terraform will execute within. This defaults to the
// root of your repository and is typically set to a subdirectory matching the
// environment when multiple environments exist within the same repository.
WorkingDirectory *string `jsonapi:"attr,working-directory,omitempty"`
}
WorkspaceCreateOptions represents the options for creating a new workspace.
type WorkspaceListOptions ¶
type WorkspaceListOptions struct {
ListOptions
}
WorkspaceListOptions represents the options for listing workspaces.
type WorkspaceLockOptions ¶
type WorkspaceLockOptions struct {
// Specifies the reason for locking the workspace.
Reason *string `json:"reason,omitempty"`
}
WorkspaceLockOptions represents the options for locking a workspace.
type WorkspacePermissions ¶
type WorkspacePermissions struct {
CanDestroy bool `json:"can-destroy"`
CanLock bool `json:"can-lock"`
CanQueueDestroy bool `json:"can-queue-destroy"`
CanQueueRun bool `json:"can-queue-run"`
CanReadSettings bool `json:"can-read-settings"`
CanUpdate bool `json:"can-update"`
CanUpdateVariable bool `json:"can-update-variable"`
}
WorkspacePermissions represents the workspace permissions.
type WorkspaceUpdateOptions ¶
type WorkspaceUpdateOptions struct {
// For internal use only!
ID string `jsonapi:"primary,workspaces"`
// Whether to automatically apply changes when a Terraform plan is successful.
AutoApply *bool `jsonapi:"attr,auto-apply,omitempty"`
// A new name for the workspace, which can only include letters, numbers, -,
// and _. This will be used as an identifier and must be unique in the
// organization. Warning: Changing a workspace's name changes its URL in the
// API and UI.
Name *string `jsonapi:"attr,name,omitempty"`
// The version of Terraform to use for this workspace.
TerraformVersion *string `jsonapi:"attr,terraform-version,omitempty"`
// To delete a workspace's existing VCS repo, specify null instead of an
// object. To modify a workspace's existing VCS repo, include whichever of
// the keys below you wish to modify. To add a new VCS repo to a workspace
// that didn't previously have one, include at least the oauth-token-id and
// identifier keys. VCSRepo *VCSRepo `jsonapi:"relation,vcs-repo,om-tempty"`
VCSRepo *VCSRepoOptions `jsonapi:"attr,vcs-repo,omitempty"`
// A relative path that Terraform will execute within. This defaults to the
// root of your repository and is typically set to a subdirectory matching
// the environment when multiple environments exist within the same
// repository.
WorkingDirectory *string `jsonapi:"attr,working-directory,omitempty"`
}
WorkspaceUpdateOptions represents the options for updating a workspace.
type Workspaces ¶
type Workspaces struct {
// contains filtered or unexported fields
}
Workspaces handles communication with the workspace related methods of the Terraform Enterprise API.
TFE API docs: https://www.terraform.io/docs/enterprise/api/workspaces.html
func (*Workspaces) AssignSSHKey ¶
func (s *Workspaces) AssignSSHKey(ctx context.Context, workspaceID string, options WorkspaceAssignSSHKeyOptions) (*Workspace, error)
AssignSSHKey to a workspace.
func (*Workspaces) Create ¶
func (s *Workspaces) Create(ctx context.Context, organization string, options WorkspaceCreateOptions) (*Workspace, error)
Create is used to create a new workspace.
func (*Workspaces) Delete ¶
func (s *Workspaces) Delete(ctx context.Context, organization, workspace string) error
Delete a workspace by its name.
func (*Workspaces) List ¶
func (s *Workspaces) List(ctx context.Context, organization string, options WorkspaceListOptions) ([]*Workspace, error)
List returns all of the workspaces within an organization.
func (*Workspaces) Lock ¶
func (s *Workspaces) Lock(ctx context.Context, workspaceID string, options WorkspaceLockOptions) (*Workspace, error)
Lock a workspace.
func (*Workspaces) UnassignSSHKey ¶
UnassignSSHKey from a workspace.
func (*Workspaces) Update ¶
func (s *Workspaces) Update(ctx context.Context, organization, workspace string, options WorkspaceUpdateOptions) (*Workspace, error)
Update settings of an existing workspace.