Documentation ¶
Overview ¶
Package tfe package
Index ¶
- Variables
- func NewOrgController(logger logger.Logger, respWriter response.Writer, ...) controllers.Controller
- func NewRunController(logger logger.Logger, respWriter response.Writer, ...) controllers.Controller
- func NewStateController(logger logger.Logger, respWriter response.Writer, ...) controllers.Controller
- func NewWorkspaceController(logger logger.Logger, respWriter response.Writer, ...) controllers.Controller
- func TharsisCVToCV(cv *models.ConfigurationVersion, ...) *gotfe.ConfigurationVersion
- func TharsisErrorToTfeError(err error) error
- func TharsisStateVersionToStateVersion(sv *models.StateVersion, tharsisAPIURL, tfeStateVersionedPath string) *gotfe.StateVersion
- type CategoryType
- type Run
- type RunActions
- type RunPermissions
- type RunQueue
- type RunSource
- type RunStatus
- type RunStatusTimestamps
- type Variable
- type VariableList
- type Workspace
- type WorkspacePermissions
Constants ¶
This section is empty.
Variables ¶
var EntitlementSettings = gotfe.Entitlements{ ID: "1", Agents: true, AuditLogging: true, CostEstimation: true, Operations: true, PrivateModuleRegistry: true, SSO: true, Sentinel: true, StateStorage: true, Teams: true, VCSIntegrations: true, }
EntitlementSettings represents the entitlements for a particular user
Functions ¶
func NewOrgController ¶
func NewOrgController( logger logger.Logger, respWriter response.Writer, jwtAuthMiddleware middleware.Handler, runService run.Service, groupService group.Service, ) controllers.Controller
NewOrgController creates an instance of orgController
func NewRunController ¶
func NewRunController( logger logger.Logger, respWriter response.Writer, jwtAuthMiddleware middleware.Handler, jwsProvider jws.Provider, runService run.Service, tharsisAPIURL string, ) controllers.Controller
NewRunController creates an instance of runController
func NewStateController ¶
func NewStateController( logger logger.Logger, respWriter response.Writer, jwtAuthMiddleware middleware.Handler, workspaceService workspace.Service, tharsisAPIURL string, tfeVersionedPath string, ) controllers.Controller
NewStateController creates an instance of stateController
func NewWorkspaceController ¶
func NewWorkspaceController( logger logger.Logger, respWriter response.Writer, jwtAuthMiddleware middleware.Handler, runService run.Service, workspaceService workspace.Service, groupService group.Service, managedIdentityService managedidentity.Service, variableService variable.Service, tharsisAPIURL string, tfeVersionedPath string, ) controllers.Controller
NewWorkspaceController creates an instance of workspaceController
func TharsisCVToCV ¶
func TharsisCVToCV(cv *models.ConfigurationVersion, tharsisAPIURL, tfeWorkspacesVersionedPath string) *gotfe.ConfigurationVersion
TharsisCVToCV converts a tharsis configuration version to a TFE configuration version
func TharsisErrorToTfeError ¶
TharsisErrorToTfeError translates Tharsis error to TFE equivalent or returns original.
func TharsisStateVersionToStateVersion ¶
func TharsisStateVersionToStateVersion(sv *models.StateVersion, tharsisAPIURL, tfeStateVersionedPath string) *gotfe.StateVersion
TharsisStateVersionToStateVersion converts a tharsis state version to a TFE state version
Types ¶
type CategoryType ¶
type CategoryType string
CategoryType represents a category type.
const ( CategoryEnv CategoryType = "env" CategoryTerraform CategoryType = "terraform" )
List all available categories.
type Run ¶
type Run struct { CreatedAt time.Time `jsonapi:"attr,created-at,iso8601"` ForceCancelAvailableAt time.Time `jsonapi:"attr,force-cancel-available-at,iso8601"` Actions *RunActions `jsonapi:"attr,actions"` StatusTimestamps *RunStatusTimestamps `jsonapi:"attr,status-timestamps"` Permissions *RunPermissions `jsonapi:"attr,permissions"` // Relations Workspace *Workspace `jsonapi:"relation,workspace"` Apply *gotfe.Apply `jsonapi:"relation,apply"` ConfigurationVersion *gotfe.ConfigurationVersion `jsonapi:"relation,configuration-version"` CostEstimate *gotfe.CostEstimate `jsonapi:"relation,cost-estimate"` CreatedBy *gotfe.User `jsonapi:"relation,created-by"` Plan *gotfe.Plan `jsonapi:"relation,plan"` Message string `jsonapi:"attr,message"` ID string `jsonapi:"primary,runs"` Source RunSource `jsonapi:"attr,source"` Status RunStatus `jsonapi:"attr,status"` ReplaceAddrs []string `jsonapi:"attr,replace-addrs,omitempty"` TargetAddrs []string `jsonapi:"attr,target-addrs,omitempty"` // Relation PolicyChecks []*gotfe.PolicyCheck `jsonapi:"relation,policy-checks"` PositionInQueue int `jsonapi:"attr,position-in-queue"` RefreshOnly bool `jsonapi:"attr,refresh-only"` Refresh bool `jsonapi:"attr,refresh"` IsDestroy bool `jsonapi:"attr,is-destroy"` HasChanges bool `jsonapi:"attr,has-changes"` AutoApply bool `jsonapi:"attr,auto-apply,omitempty"` }
Run represents a terraform run within a workspace
func TharsisRunToRun ¶
TharsisRunToRun converts a tharsis run to a TFE run
type RunActions ¶
type RunActions struct { IsCancelable bool `json:"is-cancelable"` IsConfirmable bool `json:"is-confirmable"` IsDiscardable bool `json:"is-discardable"` IsForceCancelable bool `json:"is-force-cancelable"` }
RunActions represents the run actions.
type RunPermissions ¶
type RunPermissions struct { CanApply bool `json:"can-apply"` CanCancel bool `json:"can-cancel"` CanDiscard bool `json:"can-discard"` CanForceCancel bool `json:"can-force-cancel"` CanForceExecute bool `json:"can-force-execute"` }
RunPermissions represents the run permissions.
type RunQueue ¶
type RunQueue struct { *gotfe.Pagination Items []*Run }
RunQueue represents the current run queue of an organization.
type RunStatus ¶
type RunStatus string
RunStatus represents a run state.
const ( RunApplied RunStatus = "applied" RunApplyQueued RunStatus = "apply_queued" RunApplying RunStatus = "applying" RunCanceled RunStatus = "canceled" RunConfirmed RunStatus = "confirmed" RunCostEstimated RunStatus = "cost_estimated" RunCostEstimating RunStatus = "cost_estimating" RunDiscarded RunStatus = "discarded" RunErrored RunStatus = "errored" RunPending RunStatus = "pending" RunPlanQueued RunStatus = "plan_queued" RunPlanned RunStatus = "planned" RunPlannedAndFinished RunStatus = "planned_and_finished" RunPlanning RunStatus = "planning" RunPolicyChecked RunStatus = "policy_checked" RunPolicyChecking RunStatus = "policy_checking" RunPolicyOverride RunStatus = "policy_override" RunPolicySoftFailed RunStatus = "policy_soft_failed" )
List all available run statuses.
type RunStatusTimestamps ¶
type RunStatusTimestamps struct { AppliedAt time.Time `jsonapi:"attr,applied-at,rfc3339"` ApplyQueuedAt time.Time `jsonapi:"attr,apply-queued-at,rfc3339"` ApplyingAt time.Time `jsonapi:"attr,applying-at,rfc3339"` CanceledAt time.Time `jsonapi:"attr,canceled-at,rfc3339"` ConfirmedAt time.Time `jsonapi:"attr,confirmed-at,rfc3339"` CostEstimatedAt time.Time `jsonapi:"attr,cost-estimated-at,rfc3339"` CostEstimatingAt time.Time `jsonapi:"attr,cost-estimating-at,rfc3339"` DiscardedAt time.Time `jsonapi:"attr,discarded-at,rfc3339"` ErroredAt time.Time `jsonapi:"attr,errored-at,rfc3339"` ForceCanceledAt time.Time `jsonapi:"attr,force-canceled-at,rfc3339"` PlanQueueableAt time.Time `jsonapi:"attr,plan-queueable-at,rfc3339"` PlanQueuedAt time.Time `jsonapi:"attr,plan-queued-at,rfc3339"` PlannedAndFinishedAt time.Time `jsonapi:"attr,planned-and-finished-at,rfc3339"` PlannedAt time.Time `jsonapi:"attr,planned-at,rfc3339"` PlanningAt time.Time `jsonapi:"attr,planning-at,rfc3339"` PolicyCheckedAt time.Time `jsonapi:"attr,policy-checked-at,rfc3339"` PolicySoftFailedAt time.Time `jsonapi:"attr,policy-soft-failed-at,rfc3339"` }
RunStatusTimestamps holds the timestamps for individual run statuses.
type Variable ¶
type Variable struct { Workspace *Workspace `jsonapi:"relation,configurable"` ID string `jsonapi:"primary,vars"` Key string `jsonapi:"attr,key"` Value string `jsonapi:"attr,value"` Description string `jsonapi:"attr,description"` Category CategoryType `jsonapi:"attr,category"` HCL bool `jsonapi:"attr,hcl"` Sensitive bool `jsonapi:"attr,sensitive"` }
Variable represents a Terraform Enterprise variable.
type VariableList ¶
type VariableList struct { *gotfe.Pagination Items []*Variable }
VariableList represents a list of variables.
type Workspace ¶
type Workspace struct { CreatedAt time.Time `jsonapi:"attr,created-at,iso8601"` UpdatedAt time.Time `jsonapi:"attr,updated-at,iso8601"` Actions *gotfe.WorkspaceActions `jsonapi:"attr,actions"` VCSRepo *gotfe.VCSRepo `jsonapi:"attr,vcs-repo"` // Relations CurrentRun *gotfe.Run `jsonapi:"relation,current-run"` Permissions *WorkspacePermissions `jsonapi:"attr,permissions"` Organization *gotfe.Organization `jsonapi:"relation,organization"` CurrentStateVersion *gotfe.StateVersion `jsonapi:"relation,current-state-version"` SSHKey *gotfe.SSHKey `jsonapi:"relation,ssh-key"` AgentPool *gotfe.AgentPool `jsonapi:"relation,agent-pool"` ExecutionMode string `jsonapi:"attr,execution-mode"` Environment string `jsonapi:"attr,environment"` MigrationEnvironment string `jsonapi:"attr,migration-environment"` Name string `jsonapi:"attr,name"` ID string `jsonapi:"primary,workspaces"` Description string `jsonapi:"attr,description"` AgentPoolID string `jsonapi:"attr,agent-pool-id"` WorkingDirectory string `jsonapi:"attr,working-directory"` TerraformVersion string `jsonapi:"attr,terraform-version"` TriggerPrefixes []string `jsonapi:"attr,trigger-prefixes"` ApplyDurationAverage time.Duration `jsonapi:"attr,apply-duration-average"` PolicyCheckFailures int `jsonapi:"attr,policy-check-failures"` RunsCount int `jsonapi:"attr,workspace-kpis-runs-count"` ResourceCount int `jsonapi:"attr,resource-count"` RunFailures int `jsonapi:"attr,run-failures"` PlanDurationAverage time.Duration `jsonapi:"attr,plan-duration-average"` Operations bool `jsonapi:"attr,operations"` SpeculativeEnabled bool `jsonapi:"attr,speculative-enabled"` QueueAllRuns bool `jsonapi:"attr,queue-all-runs"` Locked bool `jsonapi:"attr,locked"` FileTriggersEnabled bool `jsonapi:"attr,file-triggers-enabled"` CanQueueDestroyPlan bool `jsonapi:"attr,can-queue-destroy-plan"` AutoApply bool `jsonapi:"attr,auto-apply"` AllowDestroyPlan bool `jsonapi:"attr,allow-destroy-plan"` }
Workspace type is defined here because the go-tfe.Workspace has an issue with the jsonapi tags
func TharsisWorkspaceToWorkspace ¶
TharsisWorkspaceToWorkspace converts a tharsis workspace to a TFE workspace
type WorkspacePermissions ¶
type WorkspacePermissions struct { CanDestroy bool `json:"can-destroy"` CanForceUnlock bool `json:"can-force-unlock"` CanLock bool `json:"can-lock"` CanQueueApply bool `json:"can-queue-apply"` CanQueueDestroy bool `json:"can-queue-destroy"` CanQueueRun bool `json:"can-queue-run"` CanReadSettings bool `json:"can-read-settings"` CanUnlock bool `json:"can-unlock"` CanUpdate bool `json:"can-update"` CanUpdateVariable bool `json:"can-update-variable"` }
WorkspacePermissions contains the permissions for a workspace