Documentation
¶
Overview ¶
Package http provides an HTTP interface allowing HTTP clients to interact with OTF.
Index ¶
- Constants
- func DecodeQuery(opts interface{}, query url.Values) error
- func MarshalPayload(w io.Writer, r *http.Request, models interface{}) error
- func NewLogHandler(logger logr.Logger) negroni.HandlerFunc
- func NewRouter(server *Server) *negroni.Negroni
- func SanitizeAddress(address string) (string, error)
- func SanitizeHostname(hostname string) (string, error)
- func WithCode(code int) func(w http.ResponseWriter)
- func WriteError(w http.ResponseWriter, code int, err error)
- func WriteResponse(w http.ResponseWriter, r *http.Request, obj interface{}, ...)
- type Apply
- type ApplyStatusTimestamps
- type CVStatusTimestamps
- type Client
- type ClientFactory
- type Config
- type ConfigOption
- type ConfigurationVersion
- type ConfigurationVersionList
- type FakeClient
- type FakeClientFactory
- type FakeOrganizationsClient
- type FakeWorkspacesClient
- func (f *FakeWorkspacesClient) Get(ctx context.Context, spec otf.WorkspaceSpecifier) (*otf.Workspace, error)
- func (f *FakeWorkspacesClient) List(ctx context.Context, opts otf.WorkspaceListOptions) (*otf.WorkspaceList, error)
- func (f *FakeWorkspacesClient) Lock(ctx context.Context, id string, opts otf.WorkspaceLockOptions) (*otf.Workspace, error)
- func (f *FakeWorkspacesClient) Unlock(ctx context.Context, id string) (*otf.Workspace, error)
- func (f *FakeWorkspacesClient) Update(ctx context.Context, spec otf.WorkspaceSpecifier, ...) (*otf.Workspace, error)
- type Organization
- type OrganizationList
- type Plan
- type PlanStatusTimestamps
- type RetryLogHook
- type Run
- type RunActions
- type RunList
- type RunStatusTimestamps
- type Server
- func (s *Server) ApplyRun(w http.ResponseWriter, r *http.Request)
- func (s *Server) CancelRun(w http.ResponseWriter, r *http.Request)
- func (s *Server) Close() error
- func (s *Server) ConfigurationVersionListJSONAPIObject(cvl *otf.ConfigurationVersionList) *ConfigurationVersionList
- func (s *Server) CreateConfigurationVersion(w http.ResponseWriter, r *http.Request)
- func (s *Server) CreateOrganization(w http.ResponseWriter, r *http.Request)
- func (s *Server) CreateRun(w http.ResponseWriter, r *http.Request)
- func (s *Server) CreateStateVersion(w http.ResponseWriter, r *http.Request)
- func (s *Server) CreateWorkspace(w http.ResponseWriter, r *http.Request)
- func (s *Server) CurrentStateVersion(w http.ResponseWriter, r *http.Request)
- func (s *Server) DeleteOrganization(w http.ResponseWriter, r *http.Request)
- func (s *Server) DeleteWorkspace(w http.ResponseWriter, r *http.Request)
- func (s *Server) DeleteWorkspaceByID(w http.ResponseWriter, r *http.Request)
- func (s *Server) DiscardRun(w http.ResponseWriter, r *http.Request)
- func (s *Server) DownloadStateVersion(w http.ResponseWriter, r *http.Request)
- func (s *Server) ForceCancelRun(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetApply(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetApplyLogs(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetConfigurationVersion(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetEntitlements(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetJSONPlanByRunID(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetOrganization(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetPlan(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetPlanFile(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetPlanJSON(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetPlanLogs(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetRun(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetRunLogs(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetStateVersion(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetWorkspace(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetWorkspaceByID(w http.ResponseWriter, r *http.Request)
- func (s *Server) ListConfigurationVersions(w http.ResponseWriter, r *http.Request)
- func (s *Server) ListOrganizations(w http.ResponseWriter, r *http.Request)
- func (s *Server) ListRuns(w http.ResponseWriter, r *http.Request)
- func (s *Server) ListStateVersions(w http.ResponseWriter, r *http.Request)
- func (s *Server) ListWorkspaces(w http.ResponseWriter, r *http.Request)
- func (s *Server) LockWorkspace(w http.ResponseWriter, r *http.Request)
- func (s *Server) Open() (err error)
- func (s *Server) Port() int
- func (s *Server) SetupRoutes()
- func (s *Server) UnlockWorkspace(w http.ResponseWriter, r *http.Request)
- func (s *Server) UpdateOrganization(w http.ResponseWriter, r *http.Request)
- func (s *Server) UpdateWorkspace(w http.ResponseWriter, r *http.Request)
- func (s *Server) UpdateWorkspaceByID(w http.ResponseWriter, r *http.Request)
- func (s *Server) UploadApplyLogs(w http.ResponseWriter, r *http.Request)
- func (s *Server) UploadConfigurationVersion(w http.ResponseWriter, r *http.Request)
- func (s *Server) UploadPlanFile(w http.ResponseWriter, r *http.Request)
- func (s *Server) UploadPlanLogs(w http.ResponseWriter, r *http.Request)
- func (s *Server) Wait(ctx context.Context) error
- func (s *Server) WellKnown(w http.ResponseWriter, r *http.Request)
- type StateVersion
- type StateVersionList
- type StateVersionOutput
- type TwoFactor
- type User
- type VCSRepoOptions
- type WebRoute
- type WellKnown
- type Workspace
- type WorkspaceList
Constants ¶
const ( // DefaultBasePath on which the API is served. DefaultBasePath = "/api/v2/" // PingEndpoint is a no-op API endpoint used to configure the rate limiter PingEndpoint = "ping" )
const (
DefaultAddress = "localhost:8080"
)
Variables ¶
This section is empty.
Functions ¶
func DecodeQuery ¶
DecodeQuery unmarshals a query string (k1=v1&k2=v2...) into a struct.
func MarshalPayload ¶
MarshalPayload marshals the models object into a JSON-API response.
func NewLogHandler ¶ added in v0.0.8
func NewLogHandler(logger logr.Logger) negroni.HandlerFunc
NewLogHandler returns negroni middleware that logs HTTP requests
func SanitizeAddress ¶ added in v0.0.8
SanitizeAddress ensures address is in format https://<host>:<port>
func SanitizeHostname ¶ added in v0.0.8
SanitizeHostname ensures hostname is in the format <host>:<port>
func WithCode ¶
func WithCode(code int) func(w http.ResponseWriter)
WithCode is a helper func for writing an HTTP status code to a response stream. For use with WriteResponse.
func WriteError ¶
func WriteError(w http.ResponseWriter, code int, err error)
WriteError writes an HTTP response with a JSON-API marshalled error obj.
func WriteResponse ¶
func WriteResponse(w http.ResponseWriter, r *http.Request, obj interface{}, opts ...func(http.ResponseWriter))
WriteResponse writes an HTTP response with a JSON-API marshalled payload.
Types ¶
type Apply ¶ added in v0.0.8
type Apply struct { ID string `jsonapi:"primary,applies"` LogReadURL string `jsonapi:"attr,log-read-url"` ResourceAdditions int `jsonapi:"attr,resource-additions"` ResourceChanges int `jsonapi:"attr,resource-changes"` ResourceDestructions int `jsonapi:"attr,resource-destructions"` Status otf.ApplyStatus `jsonapi:"attr,status"` StatusTimestamps *ApplyStatusTimestamps `jsonapi:"attr,status-timestamps"` }
Apply represents a Terraform Enterprise apply.
func ApplyJSONAPIObject ¶ added in v0.0.8
ApplyJSONAPIObject converts a Apply to a struct that can be marshalled into a JSON-API object
type ApplyStatusTimestamps ¶ added in v0.0.8
type ApplyStatusTimestamps struct { CanceledAt *time.Time `json:"canceled-at,omitempty"` ErroredAt *time.Time `json:"errored-at,omitempty"` FinishedAt *time.Time `json:"finished-at,omitempty"` ForceCanceledAt *time.Time `json:"force-canceled-at,omitempty"` QueuedAt *time.Time `json:"queued-at,omitempty"` StartedAt *time.Time `json:"started-at,omitempty"` }
ApplyStatusTimestamps holds the timestamps for individual apply statuses.
type CVStatusTimestamps ¶ added in v0.0.8
type CVStatusTimestamps struct { FinishedAt *time.Time `json:"finished-at,omitempty"` QueuedAt *time.Time `json:"queued-at,omitempty"` StartedAt *time.Time `json:"started-at,omitempty"` }
CVStatusTimestamps holds the timestamps for individual configuration version statuses.
type Client ¶ added in v0.0.8
type Client interface { Organizations() otf.OrganizationService Workspaces() otf.WorkspaceService }
type ClientFactory ¶ added in v0.0.8
ClientFactory implementations of capable of constructing new OTF clients
type Config ¶ added in v0.0.8
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 // Headers that will be added to every request. Headers http.Header // A custom HTTP client to use. HTTPClient *http.Client // RetryLogHook is invoked each time a request is retried. RetryLogHook RetryLogHook // contains filtered or unexported fields }
Config provides configuration details to the API client.
func NewConfig ¶ added in v0.0.8
func NewConfig(opts ...ConfigOption) (*Config, error)
NewConfig constructs a new http client config. Options are only applied when NewClient() is called.
type ConfigOption ¶ added in v0.0.8
type ConfigurationVersion ¶ added in v0.0.8
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 otf.ConfigurationSource `jsonapi:"attr,source"` Speculative bool `jsonapi:"attr,speculative "` Status otf.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.
func ConfigurationVersionJSONAPIObject ¶ added in v0.0.8
func ConfigurationVersionJSONAPIObject(cv *otf.ConfigurationVersion) *ConfigurationVersion
ConfigurationVersionJSONAPIObject converts a ConfigurationVersion to a struct that can be marshalled into a JSON-API object
func (*ConfigurationVersion) ToDomain ¶ added in v0.0.8
func (cv *ConfigurationVersion) ToDomain() *otf.ConfigurationVersion
ToDomain converts http config version obj to a domain config version obj.
type ConfigurationVersionList ¶ added in v0.0.8
type ConfigurationVersionList struct { *otf.Pagination Items []*ConfigurationVersion }
ConfigurationVersionList represents a list of configuration versions.
type FakeClient ¶ added in v0.0.8
type FakeClient struct {
Client
}
func (FakeClient) Organizations ¶ added in v0.0.8
func (f FakeClient) Organizations() otf.OrganizationService
func (FakeClient) Workspaces ¶ added in v0.0.8
func (f FakeClient) Workspaces() otf.WorkspaceService
type FakeClientFactory ¶ added in v0.0.8
type FakeClientFactory struct{}
func (FakeClientFactory) NewClient ¶ added in v0.0.8
func (f FakeClientFactory) NewClient() (Client, error)
type FakeOrganizationsClient ¶ added in v0.0.8
type FakeOrganizationsClient struct {
otf.OrganizationService
}
func (*FakeOrganizationsClient) Create ¶ added in v0.0.8
func (f *FakeOrganizationsClient) Create(ctx context.Context, opts otf.OrganizationCreateOptions) (*otf.Organization, error)
type FakeWorkspacesClient ¶ added in v0.0.8
type FakeWorkspacesClient struct {
otf.WorkspaceService
}
func (*FakeWorkspacesClient) Get ¶ added in v0.0.8
func (f *FakeWorkspacesClient) Get(ctx context.Context, spec otf.WorkspaceSpecifier) (*otf.Workspace, error)
func (*FakeWorkspacesClient) List ¶ added in v0.0.8
func (f *FakeWorkspacesClient) List(ctx context.Context, opts otf.WorkspaceListOptions) (*otf.WorkspaceList, error)
func (*FakeWorkspacesClient) Lock ¶ added in v0.0.8
func (f *FakeWorkspacesClient) Lock(ctx context.Context, id string, opts otf.WorkspaceLockOptions) (*otf.Workspace, error)
func (*FakeWorkspacesClient) Update ¶ added in v0.0.8
func (f *FakeWorkspacesClient) Update(ctx context.Context, spec otf.WorkspaceSpecifier, opts otf.WorkspaceUpdateOptions) (*otf.Workspace, error)
type Organization ¶ added in v0.0.8
type Organization struct { Name string `jsonapi:"primary,organizations"` CostEstimationEnabled bool `jsonapi:"attr,cost-estimation-enabled"` CreatedAt time.Time `jsonapi:"attr,created-at,iso8601"` Email string `jsonapi:"attr,email"` ExternalID string `jsonapi:"attr,external-id"` OwnersTeamSAMLRoleID string `jsonapi:"attr,owners-team-saml-role-id"` Permissions *otf.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.
func OrganizationJSONAPIObject ¶ added in v0.0.8
func OrganizationJSONAPIObject(org *otf.Organization) *Organization
OrganizationJSONAPIObject converts a Organization to a struct that can be marshalled into a JSON-API object
func (*Organization) ToDomain ¶ added in v0.0.8
func (o *Organization) ToDomain() *otf.Organization
ToDomain converts http organization obj to a domain organization obj.
type OrganizationList ¶ added in v0.0.8
type OrganizationList struct { *otf.Pagination Items []*Organization }
OrganizationList represents a list of organizations.
func OrganizationListJSONAPIObject ¶ added in v0.0.8
func OrganizationListJSONAPIObject(cvl *otf.OrganizationList) *OrganizationList
OrganizationListJSONAPIObject converts a OrganizationList to a struct that can be marshalled into a JSON-API object
type Plan ¶ added in v0.0.8
type Plan struct { ID string `jsonapi:"primary,plans"` HasChanges bool `jsonapi:"attr,has-changes"` LogReadURL string `jsonapi:"attr,log-read-url"` ResourceAdditions int `jsonapi:"attr,resource-additions"` ResourceChanges int `jsonapi:"attr,resource-changes"` ResourceDestructions int `jsonapi:"attr,resource-destructions"` Status otf.PlanStatus `jsonapi:"attr,status"` StatusTimestamps *PlanStatusTimestamps `jsonapi:"attr,status-timestamps"` }
Plan represents a Terraform Enterprise plan.
func PlanJSONAPIObject ¶ added in v0.0.8
PlanJSONAPIObject converts a Plan to a struct that can be marshalled into a JSON-API object
type PlanStatusTimestamps ¶ added in v0.0.8
type PlanStatusTimestamps struct { CanceledAt *time.Time `json:"canceled-at,omitempty"` ErroredAt *time.Time `json:"errored-at,omitempty"` FinishedAt *time.Time `json:"finished-at,omitempty"` ForceCanceledAt *time.Time `json:"force-canceled-at,omitempty"` QueuedAt *time.Time `json:"queued-at,omitempty"` StartedAt *time.Time `json:"started-at,omitempty"` }
PlanStatusTimestamps holds the timestamps for individual plan statuses.
type RetryLogHook ¶ added in v0.0.8
RetryLogHook allows a function to run before each retry.
type Run ¶ added in v0.0.8
type Run struct { ID string `jsonapi:"primary,runs"` Actions *RunActions `jsonapi:"attr,actions"` CreatedAt time.Time `jsonapi:"attr,created-at,iso8601"` ForceCancelAvailableAt time.Time `jsonapi:"attr,force-cancel-available-at,iso8601"` HasChanges bool `jsonapi:"attr,has-changes"` IsDestroy bool `jsonapi:"attr,is-destroy"` Message string `jsonapi:"attr,message"` Permissions *otf.RunPermissions `jsonapi:"attr,permissions"` PositionInQueue int `jsonapi:"attr,position-in-queue"` Refresh bool `jsonapi:"attr,refresh"` RefreshOnly bool `jsonapi:"attr,refresh-only"` ReplaceAddrs []string `jsonapi:"attr,replace-addrs,omitempty"` Source string `jsonapi:"attr,source"` Status otf.RunStatus `jsonapi:"attr,status"` StatusTimestamps *RunStatusTimestamps `jsonapi:"attr,status-timestamps"` TargetAddrs []string `jsonapi:"attr,target-addrs,omitempty"` // Relations Apply *Apply `jsonapi:"relation,apply"` ConfigurationVersion *ConfigurationVersion `jsonapi:"relation,configuration-version"` CreatedBy *User `jsonapi:"relation,created-by"` Plan *Plan `jsonapi:"relation,plan"` Workspace *Workspace `jsonapi:"relation,workspace"` }
Run represents a Terraform Enterprise run.
func RunJSONAPIObject ¶ added in v0.0.8
RunJSONAPIObject converts a Run to a struct that can be marshalled into a JSON-API object
type RunActions ¶ added in v0.0.8
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 RunList ¶ added in v0.0.8
type RunList struct { *otf.Pagination Items []*Run }
RunList represents a list of runs.
type RunStatusTimestamps ¶ added in v0.0.8
type RunStatusTimestamps struct { AppliedAt *time.Time `json:"applied-at,omitempty"` ApplyQueuedAt *time.Time `json:"apply-queued-at,omitempty"` ApplyingAt *time.Time `json:"applying-at,omitempty"` CanceledAt *time.Time `json:"canceled-at,omitempty"` ConfirmedAt *time.Time `json:"confirmed-at,omitempty"` CostEstimatedAt *time.Time `json:"cost-estimated-at,omitempty"` CostEstimatingAt *time.Time `json:"cost-estimating-at,omitempty"` DiscardedAt *time.Time `json:"discarded-at,omitempty"` ErroredAt *time.Time `json:"errored-at,omitempty"` ForceCanceledAt *time.Time `json:"force-canceled-at,omitempty"` PlanQueueableAt *time.Time `json:"plan-queueable-at,omitempty"` PlanQueuedAt *time.Time `json:"plan-queued-at,omitempty"` PlannedAndFinishedAt *time.Time `json:"planned-and-finished-at,omitempty"` PlannedAt *time.Time `json:"planned-at,omitempty"` PlanningAt *time.Time `json:"planning-at,omitempty"` PolicyCheckedAt *time.Time `json:"policy-checked-at,omitempty"` PolicySoftFailedAt *time.Time `json:"policy-soft-failed-at,omitempty"` }
RunStatusTimestamps holds the timestamps for individual run statuses.
type Server ¶
type Server struct { logr.Logger EnableRequestLogging bool SSL bool CertFile, KeyFile string // Listening Address in the form <ip>:<port> Addr string OrganizationService otf.OrganizationService WorkspaceService otf.WorkspaceService StateVersionService otf.StateVersionService ConfigurationVersionService otf.ConfigurationVersionService EventService otf.EventService RunService otf.RunService PlanService otf.PlanService ApplyService otf.ApplyService // contains filtered or unexported fields }
Server provides an HTTP/S server
func (*Server) ConfigurationVersionListJSONAPIObject ¶
func (s *Server) ConfigurationVersionListJSONAPIObject(cvl *otf.ConfigurationVersionList) *ConfigurationVersionList
ConfigurationVersionListJSONAPIObject converts a ConfigurationVersionList to a struct that can be marshalled into a JSON-API object
func (*Server) CreateConfigurationVersion ¶
func (s *Server) CreateConfigurationVersion(w http.ResponseWriter, r *http.Request)
func (*Server) CreateOrganization ¶
func (s *Server) CreateOrganization(w http.ResponseWriter, r *http.Request)
func (*Server) CreateStateVersion ¶
func (s *Server) CreateStateVersion(w http.ResponseWriter, r *http.Request)
func (*Server) CreateWorkspace ¶
func (s *Server) CreateWorkspace(w http.ResponseWriter, r *http.Request)
func (*Server) CurrentStateVersion ¶
func (s *Server) CurrentStateVersion(w http.ResponseWriter, r *http.Request)
func (*Server) DeleteOrganization ¶
func (s *Server) DeleteOrganization(w http.ResponseWriter, r *http.Request)
func (*Server) DeleteWorkspace ¶
func (s *Server) DeleteWorkspace(w http.ResponseWriter, r *http.Request)
func (*Server) DeleteWorkspaceByID ¶
func (s *Server) DeleteWorkspaceByID(w http.ResponseWriter, r *http.Request)
func (*Server) DiscardRun ¶
func (s *Server) DiscardRun(w http.ResponseWriter, r *http.Request)
func (*Server) DownloadStateVersion ¶
func (s *Server) DownloadStateVersion(w http.ResponseWriter, r *http.Request)
func (*Server) ForceCancelRun ¶
func (s *Server) ForceCancelRun(w http.ResponseWriter, r *http.Request)
func (*Server) GetApplyLogs ¶
func (s *Server) GetApplyLogs(w http.ResponseWriter, r *http.Request)
func (*Server) GetConfigurationVersion ¶
func (s *Server) GetConfigurationVersion(w http.ResponseWriter, r *http.Request)
func (*Server) GetEntitlements ¶
func (s *Server) GetEntitlements(w http.ResponseWriter, r *http.Request)
func (*Server) GetJSONPlanByRunID ¶ added in v0.0.8
func (s *Server) GetJSONPlanByRunID(w http.ResponseWriter, r *http.Request)
func (*Server) GetOrganization ¶
func (s *Server) GetOrganization(w http.ResponseWriter, r *http.Request)
func (*Server) GetPlanFile ¶ added in v0.0.8
func (s *Server) GetPlanFile(w http.ResponseWriter, r *http.Request)
func (*Server) GetPlanJSON ¶
func (s *Server) GetPlanJSON(w http.ResponseWriter, r *http.Request)
func (*Server) GetPlanLogs ¶
func (s *Server) GetPlanLogs(w http.ResponseWriter, r *http.Request)
func (*Server) GetRunLogs ¶ added in v0.0.10
func (s *Server) GetRunLogs(w http.ResponseWriter, r *http.Request)
GetRunLogs gets the logs for a run, combining the logs of both its plan and then its apply.
func (*Server) GetStateVersion ¶
func (s *Server) GetStateVersion(w http.ResponseWriter, r *http.Request)
func (*Server) GetWorkspace ¶
func (s *Server) GetWorkspace(w http.ResponseWriter, r *http.Request)
func (*Server) GetWorkspaceByID ¶
func (s *Server) GetWorkspaceByID(w http.ResponseWriter, r *http.Request)
func (*Server) ListConfigurationVersions ¶
func (s *Server) ListConfigurationVersions(w http.ResponseWriter, r *http.Request)
func (*Server) ListOrganizations ¶
func (s *Server) ListOrganizations(w http.ResponseWriter, r *http.Request)
func (*Server) ListStateVersions ¶
func (s *Server) ListStateVersions(w http.ResponseWriter, r *http.Request)
func (*Server) ListWorkspaces ¶
func (s *Server) ListWorkspaces(w http.ResponseWriter, r *http.Request)
func (*Server) LockWorkspace ¶
func (s *Server) LockWorkspace(w http.ResponseWriter, r *http.Request)
func (*Server) Port ¶
Port returns the TCP port for the running server. This is useful in tests where we allocate a random port by using ":0".
func (*Server) SetupRoutes ¶ added in v0.0.8
func (s *Server) SetupRoutes()
func (*Server) UnlockWorkspace ¶
func (s *Server) UnlockWorkspace(w http.ResponseWriter, r *http.Request)
func (*Server) UpdateOrganization ¶
func (s *Server) UpdateOrganization(w http.ResponseWriter, r *http.Request)
func (*Server) UpdateWorkspace ¶
func (s *Server) UpdateWorkspace(w http.ResponseWriter, r *http.Request)
func (*Server) UpdateWorkspaceByID ¶
func (s *Server) UpdateWorkspaceByID(w http.ResponseWriter, r *http.Request)
func (*Server) UploadApplyLogs ¶ added in v0.0.8
func (s *Server) UploadApplyLogs(w http.ResponseWriter, r *http.Request)
func (*Server) UploadConfigurationVersion ¶
func (s *Server) UploadConfigurationVersion(w http.ResponseWriter, r *http.Request)
func (*Server) UploadPlanFile ¶ added in v0.0.8
func (s *Server) UploadPlanFile(w http.ResponseWriter, r *http.Request)
func (*Server) UploadPlanLogs ¶ added in v0.0.8
func (s *Server) UploadPlanLogs(w http.ResponseWriter, r *http.Request)
type StateVersion ¶ added in v0.0.8
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 int64 `jsonapi:"attr,serial"` VCSCommitSHA string `jsonapi:"attr,vcs-commit-sha"` VCSCommitURL string `jsonapi:"attr,vcs-commit-url"` // Relations Run *Run `jsonapi:"relation,run"` Outputs []*StateVersionOutput `jsonapi:"relation,outputs"` }
StateVersion represents a Terraform Enterprise state version.
func StateVersionJSONAPIObject ¶ added in v0.0.8
func StateVersionJSONAPIObject(r *otf.StateVersion) *StateVersion
StateVersionJSONAPIObject converts a StateVersion to a struct that can be marshalled into a JSON-API object
type StateVersionList ¶ added in v0.0.8
type StateVersionList struct { *otf.Pagination Items []*StateVersion }
StateVersionList represents a list of state versions.
func StateVersionListJSONAPIObject ¶ added in v0.0.8
func StateVersionListJSONAPIObject(cvl *otf.StateVersionList) *StateVersionList
StateVersionListJSONAPIObject converts a StateVersionList to a struct that can be marshalled into a JSON-API object
type StateVersionOutput ¶ added in v0.0.8
type StateVersionOutput struct { ID string `jsonapi:"primary,state-version-outputs"` Name string `jsonapi:"attr,name"` Sensitive bool `jsonapi:"attr,sensitive"` Type string `jsonapi:"attr,type"` Value string `jsonapi:"attr,value"` }
func StateVersionOutputJSONAPIObject ¶ added in v0.0.8
func StateVersionOutputJSONAPIObject(svo *otf.StateVersionOutput) *StateVersionOutput
StateVersionOutputJSONAPIObject converts a StateVersionOutput to a struct that can be marshalled into a JSON-API object
func StateVersionOutputListJSONAPIObject ¶ added in v0.0.8
func StateVersionOutputListJSONAPIObject(svol otf.StateVersionOutputList) []*StateVersionOutput
StateVersionOutputListJSONAPIObject converts a StateVersionOutputList to a struct that can be marshalled into a JSON-API object
type TwoFactor ¶ added in v0.0.8
type TwoFactor struct { Enabled bool `jsonapi:"attr,enabled"` Verified bool `jsonapi:"attr,verified"` }
TwoFactor represents the organization permissions.
type User ¶ added in v0.0.8
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 VCSRepoOptions ¶ added in v0.0.8
type VCSRepoOptions struct { Branch *string `json:"branch,omitempty"` Identifier *string `json:"identifier,omitempty"` IngressSubmodules *bool `json:"ingress-submodules,omitempty"` OAuthTokenID *string `json:"oauth-token-id,omitempty"` }
VCSRepoOptions is used by workspaces, policy sets, and registry modules VCSRepoOptions represents the configuration options of a VCS integration.
type WebRoute ¶
type WebRoute string
const ( // ShutdownTimeout is the time given for outstanding requests to finish // before shutdown. ShutdownTimeout = 1 * time.Second UploadConfigurationVersionRoute WebRoute = "/configuration-versions/%v/upload" GetPlanLogsRoute WebRoute = "plans/%v/logs" GetApplyLogsRoute WebRoute = "applies/%v/logs" )
type Workspace ¶ added in v0.0.8
type Workspace struct { ID string `jsonapi:"primary,workspaces"` Actions *otf.WorkspaceActions `jsonapi:"attr,actions"` AgentPoolID string `jsonapi:"attr,agent-pool-id"` AllowDestroyPlan bool `jsonapi:"attr,allow-destroy-plan"` AutoApply bool `jsonapi:"attr,auto-apply"` CanQueueDestroyPlan bool `jsonapi:"attr,can-queue-destroy-plan"` CreatedAt time.Time `jsonapi:"attr,created-at,iso8601"` Description string `jsonapi:"attr,description"` Environment string `jsonapi:"attr,environment"` ExecutionMode string `jsonapi:"attr,execution-mode"` FileTriggersEnabled bool `jsonapi:"attr,file-triggers-enabled"` GlobalRemoteState bool `jsonapi:"attr,global-remote-state"` Locked bool `jsonapi:"attr,locked"` MigrationEnvironment string `jsonapi:"attr,migration-environment"` Name string `jsonapi:"attr,name"` Operations bool `jsonapi:"attr,operations"` Permissions *otf.WorkspacePermissions `jsonapi:"attr,permissions"` QueueAllRuns bool `jsonapi:"attr,queue-all-runs"` SpeculativeEnabled bool `jsonapi:"attr,speculative-enabled"` SourceName string `jsonapi:"attr,source-name"` SourceURL string `jsonapi:"attr,source-url"` StructuredRunOutputEnabled bool `jsonapi:"attr,structured-run-output-enabled"` TerraformVersion string `jsonapi:"attr,terraform-version"` TriggerPrefixes []string `jsonapi:"attr,trigger-prefixes"` VCSRepo *otf.VCSRepo `jsonapi:"attr,vcs-repo"` WorkingDirectory string `jsonapi:"attr,working-directory"` UpdatedAt time.Time `jsonapi:"attr,updated-at,iso8601"` ResourceCount int `jsonapi:"attr,resource-count"` ApplyDurationAverage time.Duration `jsonapi:"attr,apply-duration-average"` PlanDurationAverage time.Duration `jsonapi:"attr,plan-duration-average"` PolicyCheckFailures int `jsonapi:"attr,policy-check-failures"` RunFailures int `jsonapi:"attr,run-failures"` RunsCount int `jsonapi:"attr,workspace-kpis-runs-count"` // Relations CurrentRun *Run `jsonapi:"relation,current-run"` Organization *Organization `jsonapi:"relation,organization"` }
Workspace represents a Terraform Enterprise workspace.
func WorkspaceJSONAPIObject ¶ added in v0.0.8
WorkspaceJSONAPIObject converts a Workspace to a struct that can be marshalled into a JSON-API object
type WorkspaceList ¶ added in v0.0.8
type WorkspaceList struct { *otf.Pagination Items []*Workspace }
WorkspaceList represents a list of workspaces.
func WorkspaceListJSONAPIObject ¶ added in v0.0.8
func WorkspaceListJSONAPIObject(cvl *otf.WorkspaceList) *WorkspaceList
WorkspaceListJSONAPIObject converts a WorkspaceList to a struct that can be marshalled into a JSON-API object
func (*WorkspaceList) ToDomain ¶ added in v0.0.8
func (wl *WorkspaceList) ToDomain() *otf.WorkspaceList
ToDomain converts http workspace list obj to a domain workspace list obj.
Source Files
¶
- apply.go
- client.go
- client_config.go
- client_factory.go
- client_fake.go
- configuration_version.go
- configuration_version_client.go
- event.go
- event_client.go
- helpers.go
- http.go
- jsonapi.go
- organization.go
- organization_client.go
- plan.go
- run.go
- server.go
- state_version.go
- state_version_client.go
- state_version_output.go
- user.go
- vcs_repo.go
- well_known.go
- workspace.go
- workspace_client.go