Documentation
¶
Index ¶
- Constants
- func ApplyId() string
- func ConfigVersionId(workspaceId string) string
- func MakeConfigurationVersionResponse(configVersion *tfe.ConfigurationVersion) map[string]interface{}
- func MakeGetRunResponse(run tfe.Run) map[string]interface{}
- func MakeGetStateVersionOutputsResponse(stateVersionOutputs []*tfe.StateVersionOutput, page int, size int) map[string]interface{}
- func MakeGetStateVersionResponse(stateVersion tfe.StateVersion) map[string]interface{}
- func MakeListProjectsResponse(projects []*tfe.Project) map[string]interface{}
- func MakeListVarsResponse(vars []*tfe.Variable, page int, size int) map[string]interface{}
- func MakeListWorkspacesResponse(workspaces []*tfe.Workspace) map[string]interface{}
- func MakeProjectResponse(project *tfe.Project) map[string]interface{}
- func MakeTeamTokenResponse(teamToken *tfe.TeamToken) map[string]interface{}
- func MakeVarResponse(variable *tfe.Variable) map[string]interface{}
- func MakeWorkspaceResponse(workspace *tfe.Workspace) map[string]interface{}
- func RunFromRequest(req RunPostRequest) *tfe.Run
- func RunId(run *tfe.Run) string
- func StateVersionId(workspaceId string) string
- func TruncateString(str string, length int) string
- func VarId(variable *tfe.Variable) string
- func WorkspaceId(workspace *tfe.Workspace) string
- type MockTFC
- func (srv *MockTFC) AddApply(apply *tfe.Apply) *tfe.Apply
- func (srv *MockTFC) AddConfigurationVersion(workspaceId string, configVersion *tfe.ConfigurationVersion) *tfe.ConfigurationVersion
- func (srv *MockTFC) AddProject(id string, p ProjectFactoryParameters)
- func (srv *MockTFC) AddRun(runId string, p RunFactoryParameters) *tfe.Run
- func (srv *MockTFC) AddStateVersion(applyId string, stateVersion *tfe.StateVersion) *tfe.StateVersion
- func (srv *MockTFC) AddVar(variable *tfe.Variable) *tfe.Variable
- func (srv *MockTFC) AddWorkspace(id string, p WorkspaceFactoryParameters) *tfe.Workspace
- func (srv *MockTFC) FailRequests(n int32)
- func (srv *MockTFC) HandleAppliesGetRequests(w http.ResponseWriter, r *http.Request) bool
- func (srv *MockTFC) HandleConfigurationVersionsGetRequests(w http.ResponseWriter, r *http.Request) bool
- func (srv *MockTFC) HandleConfigurationVersionsPostRequests(w http.ResponseWriter, r *http.Request) bool
- func (srv *MockTFC) HandleConfigurationVersionsUploads(w http.ResponseWriter, r *http.Request) bool
- func (srv *MockTFC) HandleProjectsGetRequests(w http.ResponseWriter, r *http.Request) bool
- func (srv *MockTFC) HandleProjectsPostRequests(w http.ResponseWriter, r *http.Request) bool
- func (srv *MockTFC) HandleRunsGetRequests(w http.ResponseWriter, r *http.Request) bool
- func (srv *MockTFC) HandleRunsPostRequests(w http.ResponseWriter, r *http.Request) bool
- func (srv *MockTFC) HandleStateVersionsGetRequests(w http.ResponseWriter, r *http.Request) bool
- func (srv *MockTFC) HandleTokensPostRequests(w http.ResponseWriter, r *http.Request) bool
- func (srv *MockTFC) HandleVarsDeleteRequests(w http.ResponseWriter, r *http.Request) bool
- func (srv *MockTFC) HandleVarsGetRequests(w http.ResponseWriter, r *http.Request) bool
- func (srv *MockTFC) HandleVarsPatchRequests(w http.ResponseWriter, r *http.Request) bool
- func (srv *MockTFC) HandleVarsPostRequests(w http.ResponseWriter, r *http.Request) bool
- func (srv *MockTFC) HandleWorkspacesDeleteRequests(w http.ResponseWriter, r *http.Request) bool
- func (srv *MockTFC) HandleWorkspacesGetRequests(w http.ResponseWriter, r *http.Request) bool
- func (srv *MockTFC) HandleWorkspacesPatchRequests(w http.ResponseWriter, r *http.Request) bool
- func (srv *MockTFC) HandleWorkspacesPostRequests(w http.ResponseWriter, r *http.Request) bool
- func (srv *MockTFC) MakeGetApplyResponse(apply tfe.Apply) map[string]interface{}
- func (srv *MockTFC) MockRequest(predicate mocking.RequestHandlerPredicate, h http.HandlerFunc)
- func (srv *MockTFC) PersistRun(run *tfe.Run) *tfe.Run
- func (srv *MockTFC) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (srv *MockTFC) SetRetryAfter(i int)
- func (srv *MockTFC) SetToken(token string)
- func (srv *MockTFC) SetUploadedArtifact(artifact []byte)
- func (srv *MockTFC) Stop()
- func (srv *MockTFC) UploadedArtifact() []byte
- type ProjectFactoryParameters
- type RunFactoryParameters
- type RunPostRequest
- type ServiceCatalogMetadata
- type VarUpdateOrCreateRequest
- type WorkspaceFactoryParameters
- type WorkspaceUpdateRequest
Constants ¶
const ProductIdMetadataHeaderKey = "Tfp-Aws-Service-Catalog-Product-Id"
const ProductVersionMetadataHeaderKey = "Tfp-Aws-Service-Catalog-Product-Ver"
const ProvisionedProductIdMetadataHeaderKey = "Tfp-Aws-Service-Catalog-Prv-Product-Id"
Variables ¶
This section is empty.
Functions ¶
func ConfigVersionId ¶
func MakeConfigurationVersionResponse ¶
func MakeConfigurationVersionResponse(configVersion *tfe.ConfigurationVersion) map[string]interface{}
func MakeGetRunResponse ¶
func MakeGetRunResponse(run tfe.Run) map[string]interface{}
func MakeGetStateVersionResponse ¶
func MakeGetStateVersionResponse(stateVersion tfe.StateVersion) map[string]interface{}
func MakeListProjectsResponse ¶
func MakeListProjectsResponse(projects []*tfe.Project) map[string]interface{}
func MakeListVarsResponse ¶
func MakeListWorkspacesResponse ¶
func MakeListWorkspacesResponse(workspaces []*tfe.Workspace) map[string]interface{}
func MakeProjectResponse ¶
func MakeProjectResponse(project *tfe.Project) map[string]interface{}
func MakeTeamTokenResponse ¶
func MakeTeamTokenResponse(teamToken *tfe.TeamToken) map[string]interface{}
func MakeVarResponse ¶
func MakeVarResponse(variable *tfe.Variable) map[string]interface{}
func MakeWorkspaceResponse ¶
func MakeWorkspaceResponse(workspace *tfe.Workspace) map[string]interface{}
func RunFromRequest ¶
func RunFromRequest(req RunPostRequest) *tfe.Run
func StateVersionId ¶
func TruncateString ¶
func WorkspaceId ¶
func WorkspaceId(workspace *tfe.Workspace) string
Types ¶
type MockTFC ¶
type MockTFC struct { Address string OrganizationName string // Projects is a map of all the Projects the mock TFC contains, with their respective id as the keys Projects map[string]*tfe.Project // Workspaces is a map of all the Workspaces the mock TFC contains, with their respective id as the keys Workspaces map[string]*tfe.Workspace // WorkspaceServiceCatalogMetadata is a map of all the AWS Service Catalog metadata the mock TFC contains, with their respective Workspace IDs as the keys WorkspaceServiceCatalogMetadata map[string]*ServiceCatalogMetadata // Runs is a map containing the all the Runs the mock TFC contains, the keys are the paths for the Runs Runs map[string]*tfe.Run // Vars is a map of all the Variables the mock TFC server contains, the keys are the IDs of the Workspaces that own them Vars map[string][]*tfe.Variable // Applies is a map containing the all the Applies the mock TFC contains, the keys are the paths for the Applies Applies map[string]*tfe.Apply // StateVersions is a map containing the all the StateVersions the mock TFC contains, the keys are the IDs of the Workspaces that own them StateVersions map[string]*tfe.StateVersion // StateVersions is a map containing all the StateVersions the mock TFC contains, where the keys are the IDs of the Apply that owns them StateVersionsByApply map[string][]*tfe.StateVersion // StateVersionOutputs is a map containing the all the StateVersionOutputs the mock TFC contains, the keys are the IDs of the StateVersion that own them StateVersionOutputs map[string][]*tfe.StateVersionOutput // contains filtered or unexported fields }
MockTFC handles mocking the agent-related TFC APIs. It exposes methods for creating server-side state, such as jobs in the queue.
func NewMockTFC ¶
func NewMockTFC() *MockTFC
func (*MockTFC) AddConfigurationVersion ¶
func (*MockTFC) AddProject ¶
func (srv *MockTFC) AddProject(id string, p ProjectFactoryParameters)
func (*MockTFC) AddRun ¶
func (srv *MockTFC) AddRun(runId string, p RunFactoryParameters) *tfe.Run
func (*MockTFC) AddStateVersion ¶
func (*MockTFC) AddWorkspace ¶
func (srv *MockTFC) AddWorkspace(id string, p WorkspaceFactoryParameters) *tfe.Workspace
func (*MockTFC) FailRequests ¶
FailRequests makes the mock server return a 500 error for the subsequent n requests. This is useful for testing retries.
func (*MockTFC) HandleAppliesGetRequests ¶
func (*MockTFC) HandleConfigurationVersionsGetRequests ¶
func (*MockTFC) HandleConfigurationVersionsPostRequests ¶
func (*MockTFC) HandleConfigurationVersionsUploads ¶
func (*MockTFC) HandleProjectsGetRequests ¶
func (*MockTFC) HandleProjectsPostRequests ¶
func (*MockTFC) HandleRunsGetRequests ¶
func (*MockTFC) HandleRunsPostRequests ¶
func (*MockTFC) HandleStateVersionsGetRequests ¶
func (*MockTFC) HandleTokensPostRequests ¶
func (*MockTFC) HandleVarsDeleteRequests ¶
func (*MockTFC) HandleVarsGetRequests ¶
func (*MockTFC) HandleVarsPatchRequests ¶
func (*MockTFC) HandleVarsPostRequests ¶
func (*MockTFC) HandleWorkspacesDeleteRequests ¶
func (*MockTFC) HandleWorkspacesGetRequests ¶
func (*MockTFC) HandleWorkspacesPatchRequests ¶
func (*MockTFC) HandleWorkspacesPostRequests ¶
func (*MockTFC) MakeGetApplyResponse ¶
func (*MockTFC) MockRequest ¶
func (srv *MockTFC) MockRequest(predicate mocking.RequestHandlerPredicate, h http.HandlerFunc)
MockRequest allows for requests to be mocked, which is especially useful if you want to test error cases. The predicate that you pass as the first argument can be used to make sure that you don't accidentally end up mocking the wrong request, such as the status update requests that agent instances send regularly in the background.
func (*MockTFC) PersistRun ¶
func (srv *MockTFC) PersistRun(run *tfe.Run) *tfe.Run
func (*MockTFC) SetRetryAfter ¶
SetRetryAfter sets the value which will be used as the Retry-After header. This value will be used exactly once and discarded.
func (*MockTFC) SetUploadedArtifact ¶
func (*MockTFC) UploadedArtifact ¶
type ProjectFactoryParameters ¶
type ProjectFactoryParameters struct {
Name string
}
type RunFactoryParameters ¶
type RunFactoryParameters struct { RunStatus tfe.RunStatus Apply *tfe.Apply }
type RunPostRequest ¶
type RunPostRequest struct { Data struct { Id int `json:"id"` Attributes struct { AutoApply bool `json:"auto-apply"` IsDestroy bool `json:"is-destroy"` } `json:"attributes"` Relationships struct { Workspace struct { Data struct { Id string `json:"id"` } `json:"data"` } `json:"workspace"` } `json:"relationships"` } `json:"data"` }
type ServiceCatalogMetadata ¶
type VarUpdateOrCreateRequest ¶
type VarUpdateOrCreateRequest struct { Data struct { Id int `json:"id"` Attributes struct { Key string `json:"key"` Value string `json:"value"` Category tfe.CategoryType `json:"category"` HCL bool `json:"hcl"` } `json:"attributes"` Relationships struct { Workspace struct { Data struct { Id string `json:"id"` } `json:"data"` } `json:"workspace"` } `json:"relationships"` } `json:"data"` }
type WorkspaceFactoryParameters ¶
type WorkspaceFactoryParameters struct {
Name string
}