Documentation ¶
Index ¶
- Constants
- Variables
- func TharsisCVToCV(cv *models.ConfigurationVersion, tharsisAPIURL string) *gotfe.ConfigurationVersion
- func TharsisErrorToTfeError(err error) error
- func TharsisStateVersionToStateVersion(sv *models.StateVersion, tharsisAPIURL string) *gotfe.StateVersion
- type CategoryType
- type Controller
- func NewHealthController(respWriter response.Writer) Controller
- func NewJobController(logger logger.Logger, respWriter response.Writer, ...) Controller
- func NewModuleRegistryController(logger logger.Logger, respWriter response.Writer, ...) Controller
- func NewOIDCController(respWriter response.Writer, jwsProvider jwsprovider.JWSProvider, ...) Controller
- func NewOrgController(logger logger.Logger, respWriter response.Writer, ...) Controller
- func NewProviderRegistryController(logger logger.Logger, respWriter response.Writer, ...) Controller
- func NewRunController(logger logger.Logger, respWriter response.Writer, ...) Controller
- func NewSCIMController(logger logger.Logger, respWriter response.Writer, ...) Controller
- func NewServiceAccountController(logger logger.Logger, respWriter response.Writer, ...) Controller
- func NewVCSController(logger logger.Logger, respWriter response.Writer, ...) Controller
- func NewWorkspaceController(logger logger.Logger, respWriter response.Writer, ...) Controller
- type CreateSCIMGroupRequest
- type CreateSCIMUserRequest
- type GPGPublicKey
- type RegistryModuleVersion
- type RegistryModuleVersionList
- type RegistryModuleVersionsResponse
- type RegistryProviderDownloadResponse
- type RegistryProviderPlatform
- type RegistryProviderVersion
- type RegistryProviderVersionList
- type Run
- type RunActions
- type RunPermissions
- type RunQueue
- type RunSource
- type RunStatus
- type RunStatusTimestamps
- type SCIMEmail
- type SCIMGroup
- type SCIMListResponse
- type SCIMMetadata
- type SCIMOperation
- type SCIMResourceType
- type SCIMSchemaURI
- type SCIMUpdateRequest
- type SCIMUser
- type ScimErrorResponse
- type ServiceAccountLoginOptions
- type ServiceAccountLoginResponse
- type SigningKeys
- type Variable
- type VariableList
- type Workspace
- type WorkspacePermissions
Constants ¶
const ( UserSchemaURI SCIMSchemaURI = "urn:ietf:params:scim:schemas:core:2.0:User" UserEnterpriseSchemaURI SCIMSchemaURI = "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User" GroupSchemaURI SCIMSchemaURI = "urn:ietf:params:scim:schemas:core:2.0:Group" ListSchemaURI SCIMSchemaURI = "urn:ietf:params:scim:api:messages:2.0:ListResponse" UpdateSchemaURI SCIMSchemaURI = "urn:ietf:params:scim:api:messages:2.0:PatchOp" ErrorSchemaURI SCIMSchemaURI = "urn:ietf:params:scim:api:messages:2.0:Error" UserResourceType SCIMResourceType = "User" GroupResourceType SCIMResourceType = "Group" )
SCIMSchemaURI constants are used to indicate the schema type. SCIMResourceType constants are used to indicate the resource type being returned.
Variables ¶
var ( // EntitlementSettings represents the entitlements for a particular user 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, } )
Functions ¶
func TharsisCVToCV ¶
func TharsisCVToCV(cv *models.ConfigurationVersion, tharsisAPIURL 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 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 Controller ¶
type Controller interface {
// RegisterRoutes adds controller handlers to the router
RegisterRoutes(router chi.Router)
}
Controller encapsulates the logic for registering handler functions
func NewHealthController ¶
func NewHealthController(respWriter response.Writer) Controller
NewHealthController creates an instance of HealthController
func NewJobController ¶
func NewJobController( logger logger.Logger, respWriter response.Writer, jwtAuthMiddleware middleware.Handler, jwsProvider jwsprovider.JWSProvider, jobService job.Service, ) Controller
NewJobController creates an instance of jobController
func NewModuleRegistryController ¶
func NewModuleRegistryController( logger logger.Logger, respWriter response.Writer, jwtAuthMiddleware middleware.Handler, moduleRegistryService moduleregistry.Service, moduleRegistryMaxUploadSize int, ) Controller
NewModuleRegistryController creates an instance of moduleRegistryController
func NewOIDCController ¶
func NewOIDCController(respWriter response.Writer, jwsProvider jwsprovider.JWSProvider, tharsisAPIURL string) Controller
NewOIDCController creates an instance of oidcController
func NewOrgController ¶
func NewOrgController( logger logger.Logger, respWriter response.Writer, jwtAuthMiddleware middleware.Handler, runService run.Service, groupService group.Service, ) Controller
NewOrgController creates an instance of orgController
func NewProviderRegistryController ¶
func NewProviderRegistryController( logger logger.Logger, respWriter response.Writer, jwtAuthMiddleware middleware.Handler, providerRegistryService providerregistry.Service, ) Controller
NewProviderRegistryController creates an instance of providerRegistryController
func NewRunController ¶
func NewRunController( logger logger.Logger, respWriter response.Writer, jwtAuthMiddleware middleware.Handler, jwsProvider jwsprovider.JWSProvider, runService run.Service, tharsisAPIURL string, ) Controller
NewRunController creates an instance of runController
func NewSCIMController ¶
func NewSCIMController( logger logger.Logger, respWriter response.Writer, jwtAuthMiddleware middleware.Handler, userService user.Service, teamService team.Service, scimService scim.Service, ) Controller
NewSCIMController creates an instance of scimController
func NewServiceAccountController ¶
func NewServiceAccountController( logger logger.Logger, respWriter response.Writer, saService serviceaccount.Service, ) Controller
NewServiceAccountController handles service account REST requests
func NewVCSController ¶
func NewVCSController( logger logger.Logger, respWriter response.Writer, authenticator *auth.Authenticator, vcsService vcs.Service, ) Controller
NewVCSController creates an instance of vcsController.
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, ) Controller
NewWorkspaceController creates an instance of workspaceController
type CreateSCIMGroupRequest ¶
type CreateSCIMGroupRequest struct { DisplayName string `json:"displayName"` ExternalID string `json:"externalId"` Schemas []SCIMSchemaURI `json:"schemas"` }
CreateSCIMGroupRequest represents a SCIM create group (Team) request.
type CreateSCIMUserRequest ¶
type CreateSCIMUserRequest struct { ExternalID string `json:"externalId"` Emails []SCIMEmail `json:"emails"` Schemas []SCIMSchemaURI `json:"schemas"` Active bool `json:"active"` }
CreateSCIMUserRequest represents a SCIM create user request.
type GPGPublicKey ¶
type GPGPublicKey struct { KeyID string `json:"key_id"` ASCIIArmor string `json:"ascii_armor"` TrustSignature string `json:"trust_signature"` Source string `json:"source"` SourceURL string `json:"source_url"` }
GPGPublicKey represents a GPG public key used to sign a provider version
type RegistryModuleVersion ¶
type RegistryModuleVersion struct {
Version string `json:"version"`
}
RegistryModuleVersion represents a module version
type RegistryModuleVersionList ¶
type RegistryModuleVersionList struct {
Versions []RegistryModuleVersion `json:"versions"`
}
RegistryModuleVersionList contains a list of module versions
type RegistryModuleVersionsResponse ¶
type RegistryModuleVersionsResponse struct {
Modules []RegistryModuleVersionList `json:"modules"`
}
RegistryModuleVersionsResponse is the response for the modules versions endpoint
type RegistryProviderDownloadResponse ¶
type RegistryProviderDownloadResponse struct { SHASumsSignatureURL string `json:"shasums_signature_url"` OperatingSystem string `json:"os"` Arch string `json:"arch"` Filename string `json:"filename"` DownloadURL string `json:"download_url"` SHASumsURL string `json:"shasums_url"` SHASum string `json:"shasum"` Protocols []string `json:"protocols"` SigningKeys SigningKeys `json:"signing_keys"` }
RegistryProviderDownloadResponse is the response that adheres to the Terraform Provider Registry Protocol
type RegistryProviderPlatform ¶
type RegistryProviderPlatform struct { OperatingSystem string `json:"os"` Arch string `json:"arch"` }
RegistryProviderPlatform represents a platform for a provider version
type RegistryProviderVersion ¶
type RegistryProviderVersion struct { Version string `json:"version"` Protocols []string `json:"protocols"` Platforms []RegistryProviderPlatform `json:"platforms"` }
RegistryProviderVersion represents a provider version
type RegistryProviderVersionList ¶
type RegistryProviderVersionList struct {
Versions []RegistryProviderVersion `json:"versions"`
}
RegistryProviderVersionList contains a list of provider versions
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 SCIMEmail ¶
type SCIMEmail struct { Type string `json:"type"` Value string `json:"value"` Primary bool `json:"primary"` }
SCIMEmail represents a SCIM user email.
type SCIMGroup ¶
type SCIMGroup struct { Metadata SCIMMetadata `json:"meta"` ID string `json:"id"` ExternalID string `json:"externalId"` DisplayName string `json:"displayName"` SchemaURIs []SCIMSchemaURI `json:"schemas"` }
SCIMGroup represents a SCIM group resource.
func TharsisTeamToSCIMGroup ¶
TharsisTeamToSCIMGroup converts from Tharsis team to a SCIMGroup.
type SCIMListResponse ¶
type SCIMListResponse struct { SchemaURIs []SCIMSchemaURI `json:"schemas"` Resources []interface{} `json:"Resources"` TotalResults int `json:"totalResults"` StartIndex int `json:"startIndex"` ItemsPerPage int `json:"itemsPerPage"` }
SCIMListResponse is a SCIM list response.
type SCIMMetadata ¶
type SCIMMetadata struct { CreatedAt *time.Time `json:"created,omitempty"` LastModified *time.Time `json:"lastModified,omitempty"` ResourceType SCIMResourceType `json:"resourceType"` }
SCIMMetadata is the metadata for SCIM resources.
type SCIMOperation ¶
type SCIMOperation struct { Value interface{} `json:"value"` OP string `json:"op"` Path string `json:"path"` }
SCIMOperation represents a SCIM PATCH request operation.
type SCIMResourceType ¶
type SCIMResourceType string
SCIMResourceType represents a SCIM resource type.
type SCIMSchemaURI ¶
type SCIMSchemaURI string
SCIMSchemaURI defines the SchemaURI used by SCIM resources. See: https://www.rfc-editor.org/rfc/rfc7644#section-8.2.
type SCIMUpdateRequest ¶
type SCIMUpdateRequest struct { Schemas []SCIMSchemaURI `json:"schemas"` Operations []SCIMOperation `json:"operations"` }
SCIMUpdateRequest represents a SCIM update request.
type SCIMUser ¶
type SCIMUser struct { SchemaURIs []SCIMSchemaURI `json:"schemas"` ID string `json:"id"` ExternalID string `json:"externalId"` Metadata SCIMMetadata `json:"meta"` Username string `json:"userName"` Emails []SCIMEmail `json:"emails"` Active bool `json:"active"` }
SCIMUser represents a SCIM user resource.
func TharsisUserToSCIMUser ¶
TharsisUserToSCIMUser converts a Tharsis user to a SCIM user.
type ScimErrorResponse ¶
type ScimErrorResponse struct { Detail string `json:"detail"` Status string `json:"status"` SchemaURIs []SCIMSchemaURI `json:"schemas"` }
ScimErrorResponse is the SCIM specific error response.
type ServiceAccountLoginOptions ¶
type ServiceAccountLoginOptions struct { // ServiceAccount needs to be set to the full path of the service account ServiceAccountPath *string `jsonapi:"attr,service-account-path,omitempty"` // Token is set to the token being used to login with Token *string `jsonapi:"attr,token,omitempty"` // Type is a public field utilized by JSON:API to // set the resource type via the field tag. Type string `jsonapi:"primary,service-account-token"` }
ServiceAccountLoginOptions is used to login to a service account
type ServiceAccountLoginResponse ¶
type ServiceAccountLoginResponse struct { ID string `jsonapi:"primary,service-account-token"` Token string `jsonapi:"attr,token"` }
ServiceAccountLoginResponse is returned after logging in to a service account
type SigningKeys ¶
type SigningKeys struct {
GPGPublicKeys []GPGPublicKey `json:"gpg_public_keys"`
}
SigningKeys contains a list of GPG public keys
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