Documentation
¶
Overview ¶
Package otf is responsible for domain logic.
Index ¶
- Constants
- Variables
- func Absolute(r *http.Request, path string) string
- func AddSubjectToContext(ctx context.Context, subj Subject) context.Context
- func Bool(b bool) *bool
- func ConfigVersionCacheKey(id string) string
- func ContainsRunStatus(statuses []RunStatus, status RunStatus) bool
- func ConvertID(id, resource string) string
- func CurrentTimestamp() time.Time
- func ExclusiveScheduler(ctx context.Context, logger logr.Logger, app LockableApplication)
- func Exists(path string) bool
- func GenerateAuthToken(accountType string) (string, error)
- func GenerateRandomString(size int) string
- func GenerateToken() (string, error)
- func GetMapKeys(m map[string]interface{}) []string
- func Int(i int) *int
- func Int64(i int64) *int64
- func LockFileCacheKey(id string) string
- func LogCacheKey(runID string, phase PhaseType) string
- func MarshalWorkspaceLockParams(ws *Workspace) (pggen.UpdateWorkspaceLockByIDParams, error)
- func NewID(rtype string) string
- func PrefixSlice(slice []string, prefix string) (ret []string)
- func StateVersionCacheKey(id string) string
- func String(str string) *string
- func Time(t time.Time) *time.Time
- func UInt(i uint) *uint
- func Unpack(r io.Reader, dst string) error
- func UpdateHost(u, host string) (string, error)
- func UpdateOrganizationFromOpts(org *Organization, opts OrganizationUpdateOptions) error
- func ValidStringID(v *string) bool
- func ValidateExecutionMode(m ExecutionMode) error
- type Action
- type AgentToken
- func (t *AgentToken) CanAccessOrganization(action Action, name string) bool
- func (*AgentToken) CanAccessSite(action Action) bool
- func (t *AgentToken) CanAccessWorkspace(action Action, policy *WorkspacePolicy) bool
- func (t *AgentToken) CreatedAt() time.Time
- func (t *AgentToken) Description() string
- func (t *AgentToken) HideToken()
- func (t *AgentToken) ID() string
- func (t *AgentToken) OrganizationName() string
- func (t *AgentToken) String() string
- func (t *AgentToken) Token() *string
- type AgentTokenCreateOptions
- type AgentTokenRow
- type AgentTokenService
- type AgentTokenStore
- type AllowAllSubject
- type AppUser
- type Application
- type Apply
- type Cache
- type Change
- type ChangeAction
- type Chunk
- func (c Chunk) AddEndMarker() Chunk
- func (c Chunk) AddStartMarker() Chunk
- func (c Chunk) Cut(opts GetChunkOptions) Chunk
- func (c Chunk) IsEnd() bool
- func (c Chunk) IsStart() bool
- func (c Chunk) Key() string
- func (c Chunk) NextOffset() int
- func (c Chunk) RemoveEndMarker() Chunk
- func (c Chunk) RemoveStartMarker() Chunk
- type ChunkService
- type ChunkStore
- type ConfigUploader
- type ConfigurationSource
- type ConfigurationStatus
- type ConfigurationVersion
- func NewConfigurationVersion(workspaceID string, opts ConfigurationVersionCreateOptions) (*ConfigurationVersion, error)
- func NewTestConfigurationVersion(t *testing.T, ws *Workspace, opts ConfigurationVersionCreateOptions) *ConfigurationVersion
- func UnmarshalConfigurationVersionResult(result ConfigurationVersionResult) (*ConfigurationVersion, error)
- func (cv *ConfigurationVersion) AddStatusTimestamp(status ConfigurationStatus, timestamp time.Time)
- func (cv *ConfigurationVersion) AutoQueueRuns() bool
- func (cv *ConfigurationVersion) CreatedAt() time.Time
- func (cv *ConfigurationVersion) ID() string
- func (cv *ConfigurationVersion) Source() ConfigurationSource
- func (cv *ConfigurationVersion) Speculative() bool
- func (cv *ConfigurationVersion) Status() ConfigurationStatus
- func (cv *ConfigurationVersion) StatusTimestamp(status ConfigurationStatus) (time.Time, error)
- func (cv *ConfigurationVersion) StatusTimestamps() []ConfigurationVersionStatusTimestamp
- func (cv *ConfigurationVersion) String() string
- func (cv *ConfigurationVersion) Upload(ctx context.Context, config []byte, uploader ConfigUploader) error
- func (cv *ConfigurationVersion) WorkspaceID() string
- type ConfigurationVersionCreateOptions
- type ConfigurationVersionGetOptions
- type ConfigurationVersionList
- type ConfigurationVersionListOptions
- type ConfigurationVersionResult
- type ConfigurationVersionService
- type ConfigurationVersionStatusTimestamp
- type ConfigurationVersionStore
- type CurrentRunService
- type DB
- type Downloader
- type Entitlements
- type Environment
- type EnvironmentFunc
- type Event
- type EventService
- type EventType
- type ExecutionMode
- type FakeWorkspaceLockService
- type GetChunkOptions
- type Identity
- type JobWriter
- type ListOptions
- type LocalAgent
- type LockableApplication
- type LogService
- type NewSessionOption
- type NewTeamOption
- type NewUserOption
- type Organization
- func (org *Organization) CreatedAt() time.Time
- func (org *Organization) ID() string
- func (org *Organization) Name() string
- func (org *Organization) OrganizationName() string
- func (org *Organization) SessionRemember() int
- func (org *Organization) SessionTimeout() int
- func (org *Organization) String() string
- func (org *Organization) UpdatedAt() time.Time
- type OrganizationAccess
- type OrganizationCreateOptions
- type OrganizationList
- type OrganizationListOptions
- type OrganizationService
- type OrganizationStore
- type OrganizationUpdateOptions
- type Pagination
- type PersistedChunk
- type Phase
- type PhaseFinishOptions
- type PhaseSpec
- type PhaseStartOptions
- type PhaseStatus
- type PhaseStatusTimestamp
- type PhaseType
- type Plan
- type PlanFile
- type PlanFormat
- type PubSubService
- type PutChunkOptions
- type ResourceChange
- type ResourceReport
- type Run
- func (r *Run) Apply() *Apply
- func (r *Run) CanAccessOrganization(action Action, name string) bool
- func (*Run) CanAccessSite(action Action) bool
- func (r *Run) CanAccessWorkspace(action Action, policy *WorkspacePolicy) bool
- func (r *Run) CanLock(requestor Identity) error
- func (r *Run) CanUnlock(requestor Identity, force bool) error
- func (r *Run) Cancel() (enqueue bool, err error)
- func (r *Run) Cancelable() bool
- func (r *Run) ConfigurationVersionID() string
- func (r *Run) Confirmable() bool
- func (r *Run) CreatedAt() time.Time
- func (r *Run) Discard() error
- func (r *Run) Discardable() bool
- func (r *Run) Do(env Environment) error
- func (r *Run) Done() bool
- func (r *Run) EnqueueApply() error
- func (r *Run) EnqueuePlan(ctx context.Context, svc WorkspaceLockService) error
- func (r *Run) ExecutionMode() ExecutionMode
- func (r *Run) Finish(phase PhaseType, opts PhaseFinishOptions) error
- func (r *Run) ForceCancel() error
- func (r *Run) ForceCancelAvailableAt() *time.Time
- func (r *Run) HasApply() bool
- func (r *Run) HasChanges() bool
- func (r *Run) ID() string
- func (r *Run) IncludeWorkspace(ws *Workspace)
- func (r *Run) IsDestroy() bool
- func (r *Run) Latest() bool
- func (r *Run) Message() string
- func (r *Run) OrganizationName() string
- func (r *Run) Phase() PhaseType
- func (r *Run) Plan() *Plan
- func (r *Run) PlanOnly() bool
- func (r *Run) Queued() bool
- func (r *Run) Refresh() bool
- func (r *Run) RefreshOnly() bool
- func (r *Run) ReplaceAddrs() []string
- func (r *Run) RunID() string
- func (r *Run) Speculative() bool
- func (r *Run) Start(phase PhaseType) error
- func (r *Run) Status() RunStatus
- func (r *Run) StatusTimestamp(status RunStatus) (time.Time, error)
- func (r *Run) StatusTimestamps() []RunStatusTimestamp
- func (r *Run) String() string
- func (r *Run) TargetAddrs() []string
- func (r *Run) Workspace() *Workspace
- func (r *Run) WorkspaceID() string
- func (r *Run) WorkspaceName() string
- type RunApplyOptions
- type RunCancelOptions
- type RunCreateOptions
- type RunDiscardOptions
- type RunFactory
- type RunForceCancelOptions
- type RunList
- type RunListOptions
- type RunResult
- type RunService
- type RunStatus
- type RunStatusTimestamp
- type RunStore
- type Scheduler
- type Session
- type SessionResult
- type SessionService
- type SessionStore
- type State
- type StateCreateOptions
- type StateOutput
- type StateVersion
- func NewStateVersion(opts StateVersionCreateOptions) (*StateVersion, error)
- func NewTestStateVersion(t *testing.T, outputs ...StateOutput) *StateVersion
- func UnmarshalStateVersionJSONAPI(dto *jsonapi.StateVersion) *StateVersion
- func UnmarshalStateVersionResult(row StateVersionResult) (*StateVersion, error)
- type StateVersionCreateOptions
- type StateVersionGetOptions
- type StateVersionList
- type StateVersionListOptions
- type StateVersionOutput
- type StateVersionResult
- type StateVersionService
- type StateVersionStore
- type Subject
- type Team
- func (u *Team) CreatedAt() time.Time
- func (u *Team) ID() string
- func (u *Team) IsOwners() bool
- func (u *Team) Name() string
- func (u *Team) Organization() *Organization
- func (u *Team) OrganizationAccess() OrganizationAccess
- func (u *Team) OrganizationName() string
- func (u *Team) String() string
- func (u *Team) TeamName() string
- func (u *Team) Update(opts TeamUpdateOptions) error
- type TeamResult
- type TeamService
- type TeamSpec
- type TeamStore
- type TeamUpdateOptions
- type TestRunCreateOptions
- type Token
- type TokenCreateOptions
- type TokenService
- type TokenStore
- type Unlocked
- type User
- func (u *User) CanAccessOrganization(action Action, name string) bool
- func (u *User) CanAccessSite(action Action) bool
- func (u *User) CanAccessWorkspace(action Action, policy *WorkspacePolicy) bool
- func (u *User) CanLock(requestor Identity) error
- func (u *User) CanUnlock(requestor Identity, force bool) error
- func (u *User) CreatedAt() time.Time
- func (u *User) ID() string
- func (u *User) IsOwner(organization string) bool
- func (u *User) IsSiteAdmin() bool
- func (u *User) IsUnprivilegedUser(organization string) bool
- func (u *User) Organizations() []*Organization
- func (u *User) String() string
- func (u *User) SyncMemberships(ctx context.Context, store UserStore, orgs []*Organization, teams []*Team) error
- func (u *User) Team(name, organization string) (*Team, error)
- func (u *User) Teams() []*Team
- func (u *User) TeamsByOrganization(organization string) []*Team
- func (u *User) UpdatedAt() time.Time
- func (u *User) Username() string
- type UserListOptions
- type UserResult
- type UserService
- type UserSpec
- type UserStore
- type WatchLogsOptions
- type WatchOptions
- type Workspace
- func NewTestWorkspace(t *testing.T, org *Organization, opts WorkspaceCreateOptions) *Workspace
- func NewWorkspace(organization *Organization, opts WorkspaceCreateOptions) (*Workspace, error)
- func UnmarshalWorkspaceJSONAPI(w *dto.Workspace) *Workspace
- func UnmarshalWorkspaceResult(result WorkspaceResult) (*Workspace, error)
- func (ws *Workspace) AllowDestroyPlan() bool
- func (ws *Workspace) AutoApply() bool
- func (ws *Workspace) CanQueueDestroyPlan() bool
- func (ws *Workspace) CreatedAt() time.Time
- func (ws *Workspace) Description() string
- func (ws *Workspace) Environment() string
- func (ws *Workspace) ExecutionMode() ExecutionMode
- func (ws *Workspace) ExecutionModes() []string
- func (ws *Workspace) FileTriggersEnabled() bool
- func (ws *Workspace) GetLock() WorkspaceLockState
- func (ws *Workspace) GlobalRemoteState() bool
- func (ws *Workspace) ID() string
- func (ws *Workspace) LatestRunID() *string
- func (ws *Workspace) Lock(lock WorkspaceLockState) error
- func (ws *Workspace) Locked() bool
- func (ws *Workspace) MigrationEnvironment() string
- func (ws *Workspace) Name() string
- func (ws *Workspace) Organization() *Organization
- func (ws *Workspace) OrganizationID() string
- func (ws *Workspace) OrganizationName() string
- func (ws *Workspace) QualifiedName() WorkspaceQualifiedName
- func (ws *Workspace) QueueAllRuns() bool
- func (ws *Workspace) SourceName() string
- func (ws *Workspace) SourceURL() string
- func (ws *Workspace) SpecID() WorkspaceSpec
- func (ws *Workspace) SpecName() WorkspaceSpec
- func (ws *Workspace) SpeculativeEnabled() bool
- func (ws *Workspace) String() string
- func (ws *Workspace) StructuredRunOutputEnabled() bool
- func (ws *Workspace) TerraformVersion() string
- func (ws *Workspace) TriggerPrefixes() []string
- func (ws *Workspace) Unlock(iden Identity, force bool) error
- func (ws *Workspace) UpdateWithOptions(ctx context.Context, opts WorkspaceUpdateOptions) error
- func (ws *Workspace) UpdatedAt() time.Time
- func (ws *Workspace) WorkingDirectory() string
- func (ws *Workspace) WorkspaceName() string
- type WorkspaceCreateOptions
- type WorkspaceFactory
- type WorkspaceList
- type WorkspaceListOptions
- type WorkspaceLockOptions
- type WorkspaceLockService
- type WorkspaceLockState
- type WorkspacePermission
- type WorkspacePermissionResult
- type WorkspacePermissionService
- type WorkspacePolicy
- type WorkspaceQualifiedName
- type WorkspaceQueue
- type WorkspaceResult
- type WorkspaceRole
- type WorkspaceService
- type WorkspaceSpec
- type WorkspaceStore
- type WorkspaceUnlockOptions
- type WorkspaceUpdateOptions
Constants ¶
const ( DefaultAutoQueueRuns = true DefaultConfigurationSource = "tfe-api" // List all available configuration version statuses. ConfigurationErrored ConfigurationStatus = "errored" ConfigurationPending ConfigurationStatus = "pending" ConfigurationUploaded ConfigurationStatus = "uploaded" // Maximum config size is 10mb. ConfigMaxSize int64 = 1024 * 1024 * 10 )
const ( // ChunkStartMarker is the special byte that prefixes the first chunk ChunkStartMarker = byte(2) // ChunkEndMarker is the special byte that suffixes the last chunk ChunkEndMarker = byte(3) )
const ( DefaultPageNumber = 1 DefaultPageSize = 10 MaxPageSize = 100 )
const ( PendingPhase PhaseType = "pending" PlanPhase PhaseType = "plan" ApplyPhase PhaseType = "apply" FinalPhase PhaseType = "final" UnknownPhase PhaseType = "unknown" PhasePending PhaseStatus = "pending" PhaseQueued PhaseStatus = "queued" PhaseRunning PhaseStatus = "running" PhaseFinished PhaseStatus = "finished" PhaseCanceled PhaseStatus = "canceled" PhaseErrored PhaseStatus = "errored" PhaseUnreachable PhaseStatus = "unreachable" )
const ( LocalStateFilename = "terraform.tfstate" PlanFilename = "plan.out" JSONPlanFilename = "plan.out.json" LockFilename = ".terraform.lock.hcl" )
const ( DefaultUserID = "user-123" DefaultUsername = "otf" )
const ( DefaultAllowDestroyPlan = true DefaultFileTriggersEnabled = true DefaultTerraformVersion = "1.0.10" RemoteExecutionMode ExecutionMode = "remote" LocalExecutionMode ExecutionMode = "local" AgentExecutionMode ExecutionMode = "agent" )
const (
DefaultSessionExpiry = 24 * time.Hour
)
const (
DefaultStateVersion = 4
)
const SchedulerLockID int64 = 5577006791947779410
SchedulerLockID is shared by one or more schedulers and is used to guarantee that only one scheduler will run at any time.
Variables ¶
var ( // ErrAccessNotPermitted is returned when an authorization check fails. ErrAccessNotPermitted = errors.New("access to the resource is not permitted") ErrUnauthorized = errors.New("unauthorized") // ErrResourceNotFound is returned when a receiving a 404. ErrResourceNotFound = errors.New("resource not found") // ErrResourceAlreadyExists is returned when attempting to create a resource // that already exists. ErrResourceAlreadyExists = errors.New("resource already exists") // ErrRequiredName is returned when a name option is not present. ErrRequiredName = errors.New("name is required") // ErrInvalidName is returned when the name option has invalid value. ErrInvalidName = errors.New("invalid value for name") )
Generic errors applicable to all resources.
var ( // ErrInvalidTerraformVersion is returned when a terraform version string is // not a semantic version string (major.minor.patch). ErrInvalidTerraformVersion = errors.New("invalid terraform version") // ErrInvalidWorkspaceID is returned when the workspace ID is invalid. ErrInvalidWorkspaceID = errors.New("invalid value for workspace ID") // ErrWorkspaceInvalidSpec is returned when a workspace specification is // invalid. ErrWorkspaceInvalidSpec = errors.New("invalid workspace specification") // ErrInvalidWorkspaceValue is returned when workspace value is invalid. ErrInvalidWorkspaceValue = errors.New("invalid value for workspace") // ErrInvalidOrg is returned when the organization option has an invalid value. ErrInvalidOrg = errors.New("invalid value for organization") )
Resource Errors
var ( DefaultSessionTimeout = 20160 DefaultSessionExpiration = 20160 )
var ( ErrStatusTimestampNotFound = errors.New("corresponding status timestamp not found") ErrRunDiscardNotAllowed = errors.New("run was not paused for confirmation or priority; discard not allowed") ErrRunCancelNotAllowed = errors.New("run was not planning or applying; cancel not allowed") ErrRunForceCancelNotAllowed = errors.New("run was not planning or applying, has not been canceled non-forcefully, or the cool-off period has not yet passed") ErrInvalidRunGetOptions = errors.New("invalid run get options") ErrInvalidRunStateTransition = errors.New("invalid run state transition") ActiveRun = []RunStatus{ RunApplyQueued, RunApplying, RunConfirmed, RunPlanQueued, RunPlanned, RunPlanning, } IncompleteRun = append(ActiveRun, RunPending) CompletedRun = []RunStatus{ RunApplied, RunErrored, RunDiscarded, RunCanceled, RunForceCanceled, } )
var ( SiteAdminID = "user-site-admin" SiteAdmin = User{/* contains filtered or unexported fields */} )
var ( // Build-time parameters set -ldflags Version = "unknown" Commit = "unknown" Built = "unknown" // BuildInt is an integer representation of Built BuiltInt int )
var ( ErrWorkspaceAlreadyLocked = errors.New("workspace already locked") ErrWorkspaceLockedByDifferentUser = errors.New("workspace locked by different user") ErrWorkspaceAlreadyUnlocked = errors.New("workspace already unlocked") ErrWorkspaceUnlockDenied = errors.New("unauthorized to unlock workspace") ErrWorkspaceInvalidLock = errors.New("invalid workspace lock") EventWorkspaceLocked EventType = "workspace_locked" EventWorkspaceUnlocked EventType = "workspace_unlocked" )
var ( WorkspaceReadRole = WorkspaceRole{ // contains filtered or unexported fields } WorkspacePlanRole = WorkspaceRole{ // contains filtered or unexported fields } WorkspaceWriteRole = WorkspaceRole{ // contains filtered or unexported fields } WorkspaceAdminRole = WorkspaceRole{ // contains filtered or unexported fields } WorkspaceManagerRole = WorkspaceRole{ // contains filtered or unexported fields } )
var DefaultCacheTTL = 10 * time.Minute
DefaultCacheTTL is the default TTL for cached objects
var ErrInvalidConfigurationVersionGetOptions = errors.New("invalid configuration version get options")
var ErrInvalidStateVersionGetOptions = errors.New("invalid state version get options")
var ErrInvalidTeamSpec = errors.New("invalid team spec options")
var ErrInvalidWorkspaceSpec = errors.New("invalid workspace spec options")
var ErrPhaseAlreadyStarted = errors.New("phase already started")
Functions ¶
func Absolute ¶ added in v0.0.12
Absolute returns an absolute URL for the given path. It uses the http request to determine the correct hostname and scheme to use. Handles situations where otf is sitting behind a reverse proxy, using the X-Forwarded-* headers the proxy sets.
TODO: move to http pkg
func AddSubjectToContext ¶ added in v0.0.12
AddSubjectToContext adds a subject to a context
func ConfigVersionCacheKey ¶ added in v0.0.11
func ContainsRunStatus ¶ added in v0.0.12
func ConvertID ¶ added in v0.0.12
ConvertID converts an ID for use with a different resource, e.g. convert run-123 to plan-123.
func CurrentTimestamp ¶ added in v0.0.12
CurrentTimestamp is *the* way to get a current timestamps in otf and time.Now() should be avoided.
We want timestamps to be rounded to nearest millisecond so that they can be persisted/serialised and not lose precision thereby making comparisons and testing easier.
We also want timestamps to be in the UTC time zone. Again it makes testing easier because libs such as testify's assert use DeepEqual rather than time.Equal to compare times (and structs containing times). That means the internal representation is compared, including the time zone which may differ even though two times refer to the same instant.
In any case, the time zone of the server is often not of importance, whereas that of the user often is, and conversion to their time zone is necessary regardless.
func ExclusiveScheduler ¶ added in v0.0.12
func ExclusiveScheduler(ctx context.Context, logger logr.Logger, app LockableApplication)
ExclusiveScheduler runs a scheduler, ensuring it is the *only* scheduler running.
func GenerateAuthToken ¶ added in v0.0.12
GenerateAuthToken generates an authentication token for a type of account e.g. agent, user
func GenerateRandomString ¶
GenerateRandomString generates a random string composed of alphanumeric characters of length size.
func GenerateToken ¶ added in v0.0.12
func GetMapKeys ¶ added in v0.0.8
func LockFileCacheKey ¶ added in v0.0.12
func LogCacheKey ¶ added in v0.0.11
func MarshalWorkspaceLockParams ¶ added in v0.0.12
func MarshalWorkspaceLockParams(ws *Workspace) (pggen.UpdateWorkspaceLockByIDParams, error)
func NewID ¶ added in v0.0.8
NewID constructs resource IDs, which are composed of the resource type and a random 16 character string, separated by a hyphen.
func PrefixSlice ¶ added in v0.0.8
PrefixSlice prefixes each string in a slice with another string.
func StateVersionCacheKey ¶ added in v0.0.11
func UpdateHost ¶ added in v0.0.12
UpdateHost updates the hostname in a URL
func UpdateOrganizationFromOpts ¶ added in v0.0.12
func UpdateOrganizationFromOpts(org *Organization, opts OrganizationUpdateOptions) error
func ValidStringID ¶ added in v0.0.8
ValidStringID checks if the given string pointer is non-nil and contains a typical string identifier.
func ValidateExecutionMode ¶ added in v0.0.12
func ValidateExecutionMode(m ExecutionMode) error
Types ¶
type Action ¶ added in v0.0.12
type Action string
Action symbolizes an action performed on a resource.
const ( WatchAction Action = "watch" CreateOrganizationAction Action = "create_organization" UpdateOrganizationAction Action = "update_organization" GetOrganizationAction Action = "get_organization" GetEntitlementsAction Action = "get_entitlements" DeleteOrganizationAction Action = "delete_organization" CreateAgentTokenAction Action = "create_agent_token" ListAgentTokenActions Action = "list_agent_tokens" DeleteAgentTokenAction Action = "delete_agent_token" GetRunAction Action = "get_run" ListRunsAction Action = "list_runs" ApplyRunAction Action = "apply_run" CreateRunAction Action = "create_run" DiscardRunAction Action = "discard_run" DeleteRunAction Action = "delete_run" CancelRunAction Action = "cancel_run" EnqueuePlanAction Action = "enqueue_plan" StartPhaseAction Action = "start_run_phase" FinishPhaseAction Action = "finish_run_phase" PutChunkAction Action = "put_log_chunk" TailLogsAction Action = "tail_logs" GetPlanFileAction Action = "get_plan_file" UploadPlanFileAction Action = "upload_plan_file" GetLockFileAction Action = "get_lock_file" UploadLockFileAction Action = "upload_lock_file" ListWorkspacesAction Action = "list_workspaces" GetWorkspaceAction Action = "get_workspace" CreateWorkspaceAction Action = "create_workspace" DeleteWorkspaceAction Action = "delete_workspace" SetWorkspacePermissionAction Action = "set_workspace_permission" UnsetWorkspacePermissionAction Action = "unset_workspace_permission" LockWorkspaceAction Action = "lock_workspace" UnlockWorkspaceAction Action = "unlock_workspace" UpdateWorkspaceAction Action = "update_workspace" CreateStateVersionAction Action = "create_state_version" ListStateVersionsAction Action = "list_state_versions" GetStateVersionAction Action = "get_state_version" DownloadStateAction Action = "download_state" CreateConfigurationVersionAction Action = "create_configuration_version" ListConfigurationVersionsAction Action = "list_configuration_versions" GetConfigurationVersionAction Action = "get_configuration_version" DownloadConfigurationVersionAction Action = "download_configuration_version" ListUsersAction Action = "list_users" CreateTeamAction Action = "create_team" UpdateTeamAction Action = "update_team" GetTeamAction Action = "get_team" ListTeamsAction Action = "list_teams" )
type AgentToken ¶ added in v0.0.12
type AgentToken struct {
// contains filtered or unexported fields
}
AgentToken is an authentication token for an agent.
func AgentFromContext ¶ added in v0.0.12
func AgentFromContext(ctx context.Context) (*AgentToken, error)
AgentFromContext retrieves an agent(-token) from a context
func NewAgentToken ¶ added in v0.0.12
func NewAgentToken(opts AgentTokenCreateOptions) (*AgentToken, error)
func UnmarshalAgentTokenJSONAPI ¶ added in v0.0.12
func UnmarshalAgentTokenJSONAPI(dto *jsonapi.AgentToken) *AgentToken
func UnmarshalAgentTokenResult ¶ added in v0.0.12
func UnmarshalAgentTokenResult(row AgentTokenRow) *AgentToken
UnmarshalAgentTokenResult unmarshals a row from the database.
func (*AgentToken) CanAccessOrganization ¶ added in v0.0.12
func (t *AgentToken) CanAccessOrganization(action Action, name string) bool
func (*AgentToken) CanAccessSite ¶ added in v0.0.12
func (*AgentToken) CanAccessSite(action Action) bool
func (*AgentToken) CanAccessWorkspace ¶ added in v0.0.12
func (t *AgentToken) CanAccessWorkspace(action Action, policy *WorkspacePolicy) bool
func (*AgentToken) CreatedAt ¶ added in v0.0.12
func (t *AgentToken) CreatedAt() time.Time
func (*AgentToken) Description ¶ added in v0.0.12
func (t *AgentToken) Description() string
func (*AgentToken) HideToken ¶ added in v0.0.12
func (t *AgentToken) HideToken()
HideToken nullifies the authentication token contained within, rendering AgentToken suitable for exposure outside of otfd.
func (*AgentToken) ID ¶ added in v0.0.12
func (t *AgentToken) ID() string
func (*AgentToken) OrganizationName ¶ added in v0.0.12
func (t *AgentToken) OrganizationName() string
func (*AgentToken) String ¶ added in v0.0.12
func (t *AgentToken) String() string
func (*AgentToken) Token ¶ added in v0.0.12
func (t *AgentToken) Token() *string
type AgentTokenCreateOptions ¶ added in v0.0.12
type AgentTokenRow ¶ added in v0.0.12
type AgentTokenService ¶ added in v0.0.12
type AgentTokenService interface { CreateAgentToken(ctx context.Context, opts AgentTokenCreateOptions) (*AgentToken, error) // GetAgentToken retrieves AgentToken using its cryptographic // authentication token. GetAgentToken(ctx context.Context, token string) (*AgentToken, error) ListAgentTokens(ctx context.Context, organizationName string) ([]*AgentToken, error) DeleteAgentToken(ctx context.Context, id string, organizationName string) error }
AgentTokenService provides access to agent tokens
type AgentTokenStore ¶ added in v0.0.12
type AgentTokenStore interface { CreateAgentToken(ctx context.Context, at *AgentToken) error // GetAgentToken retrieves agent token using its cryptographic // authentication token. GetAgentToken(ctx context.Context, token string) (*AgentToken, error) ListAgentTokens(ctx context.Context, organizationName string) ([]*AgentToken, error) DeleteAgentToken(ctx context.Context, id string) error }
AgentTokenStore persists agent authentication tokens.
type AllowAllSubject ¶ added in v0.0.12
type AllowAllSubject struct{}
AllowAllSubject is a subject with unlimited privileges. Only to be used for by-passing authz in tests.
func (*AllowAllSubject) CanAccessOrganization ¶ added in v0.0.12
func (*AllowAllSubject) CanAccessOrganization(Action, string) bool
func (*AllowAllSubject) CanAccessSite ¶ added in v0.0.12
func (*AllowAllSubject) CanAccessSite(action Action) bool
func (*AllowAllSubject) CanAccessWorkspace ¶ added in v0.0.12
func (*AllowAllSubject) CanAccessWorkspace(Action, *WorkspacePolicy) bool
func (*AllowAllSubject) ID ¶ added in v0.0.12
func (*AllowAllSubject) ID() string
func (*AllowAllSubject) String ¶ added in v0.0.12
func (*AllowAllSubject) String() string
type AppUser ¶ added in v0.0.12
type AppUser struct{}
AppUser identifies the otf app itself for purposes of authentication. Some processes require more privileged access than the invoking user possesses, so it is necessary to escalate privileges by "sudo'ing" to this user.
func (*AppUser) CanAccessOrganization ¶ added in v0.0.12
func (*AppUser) CanAccessSite ¶ added in v0.0.12
func (*AppUser) CanAccessWorkspace ¶ added in v0.0.12
func (*AppUser) CanAccessWorkspace(Action, *WorkspacePolicy) bool
type Application ¶ added in v0.0.12
type Application interface { OrganizationService WorkspaceService StateVersionService ConfigurationVersionService RunService EventService UserService SessionService TokenService TeamService AgentTokenService CurrentRunService LockableApplication }
Application provides access to the otf application services
type Apply ¶
type Apply struct { // ResourcesReport is a report of applied resource changes *ResourceReport // contains filtered or unexported fields }
Apply is the apply phase of a run
func (Apply) Status ¶
func (p Apply) Status() PhaseStatus
func (Apply) StatusTimestamp ¶ added in v0.0.12
func (p Apply) StatusTimestamp(status PhaseStatus) (time.Time, error)
func (Apply) StatusTimestamps ¶
func (p Apply) StatusTimestamps() []PhaseStatusTimestamp
type Change ¶
type Change struct {
Actions []ChangeAction
}
Change represents the type of change being made
type ChangeAction ¶
type ChangeAction string
const ( CreateAction ChangeAction = "create" UpdateAction ChangeAction = "update" DeleteAction ChangeAction = "delete" // PlanFormatBinary is the binary representation of the plan file PlanFormatBinary = "bin" // PlanFormatJSON is the JSON representation of the plan file PlanFormatJSON = "json" )
type Chunk ¶ added in v0.0.12
type Chunk struct { // ID of run that generated the chunk RunID string `schema:"run_id,required"` // Phase that generated the chunk Phase PhaseType `schema:"phase,required"` // Position within logs. Offset int `schema:"offset,required"` // The chunk of logs Data []byte }
Chunk is a section of logs.
func (Chunk) AddEndMarker ¶ added in v0.0.12
func (Chunk) AddStartMarker ¶ added in v0.0.12
func (Chunk) Cut ¶ added in v0.0.12
func (c Chunk) Cut(opts GetChunkOptions) Chunk
Cut returns a new, smaller chunk.
func (Chunk) NextOffset ¶ added in v0.0.12
func (Chunk) RemoveEndMarker ¶ added in v0.0.12
func (Chunk) RemoveStartMarker ¶ added in v0.0.12
type ChunkService ¶ added in v0.0.12
type ChunkService interface { // GetChunk fetches a chunk. GetChunk(ctx context.Context, opts GetChunkOptions) (Chunk, error) // PutChunk uploads a chunk. PutChunk(ctx context.Context, chunk Chunk) error }
ChunkService provides interaction with chunks.
type ChunkStore ¶ added in v0.0.8
type ChunkStore interface { // GetChunk fetches a chunk of logs. GetChunk(ctx context.Context, opts GetChunkOptions) (Chunk, error) // GetChunkByID fetches a specific chunk with the given ID. GetChunkByID(ctx context.Context, id int) (PersistedChunk, error) // PutChunk uploads a chunk, receiving back the chunk along with a unique // ID. PutChunk(ctx context.Context, chunk Chunk) (PersistedChunk, error) }
ChunkStore implementations provide a persistent store from and to which chunks can be fetched and uploaded.
type ConfigUploader ¶ added in v0.0.12
type ConfigUploader interface { // Upload uploads the config tarball and returns a status indicating success // or failure. Upload(ctx context.Context, config []byte) (ConfigurationStatus, error) // SetErrored sets the config version status to 'errored' in the store. SetErrored(ctx context.Context) error }
ConfigUploader uploads a config
type ConfigurationSource ¶ added in v0.0.8
type ConfigurationSource string
ConfigurationSource represents a source of a configuration version.
type ConfigurationStatus ¶ added in v0.0.8
type ConfigurationStatus string
ConfigurationStatus represents a configuration version status.
type ConfigurationVersion ¶
type ConfigurationVersion struct {
// contains filtered or unexported fields
}
ConfigurationVersion is a representation of an uploaded or ingressed Terraform configuration in A workspace must have at least one configuration version before any runs may be queued on it.
func NewConfigurationVersion ¶ added in v0.0.12
func NewConfigurationVersion(workspaceID string, opts ConfigurationVersionCreateOptions) (*ConfigurationVersion, error)
NewConfigurationVersion creates a ConfigurationVersion object from scratch
func NewTestConfigurationVersion ¶ added in v0.0.12
func NewTestConfigurationVersion(t *testing.T, ws *Workspace, opts ConfigurationVersionCreateOptions) *ConfigurationVersion
func UnmarshalConfigurationVersionResult ¶ added in v0.0.12
func UnmarshalConfigurationVersionResult(result ConfigurationVersionResult) (*ConfigurationVersion, error)
func (*ConfigurationVersion) AddStatusTimestamp ¶ added in v0.0.12
func (cv *ConfigurationVersion) AddStatusTimestamp(status ConfigurationStatus, timestamp time.Time)
func (*ConfigurationVersion) AutoQueueRuns ¶
func (cv *ConfigurationVersion) AutoQueueRuns() bool
func (*ConfigurationVersion) CreatedAt ¶ added in v0.0.12
func (cv *ConfigurationVersion) CreatedAt() time.Time
func (*ConfigurationVersion) ID ¶
func (cv *ConfigurationVersion) ID() string
func (*ConfigurationVersion) Source ¶
func (cv *ConfigurationVersion) Source() ConfigurationSource
func (*ConfigurationVersion) Speculative ¶
func (cv *ConfigurationVersion) Speculative() bool
func (*ConfigurationVersion) Status ¶
func (cv *ConfigurationVersion) Status() ConfigurationStatus
func (*ConfigurationVersion) StatusTimestamp ¶ added in v0.0.12
func (cv *ConfigurationVersion) StatusTimestamp(status ConfigurationStatus) (time.Time, error)
func (*ConfigurationVersion) StatusTimestamps ¶
func (cv *ConfigurationVersion) StatusTimestamps() []ConfigurationVersionStatusTimestamp
func (*ConfigurationVersion) String ¶ added in v0.0.8
func (cv *ConfigurationVersion) String() string
func (*ConfigurationVersion) Upload ¶ added in v0.0.12
func (cv *ConfigurationVersion) Upload(ctx context.Context, config []byte, uploader ConfigUploader) error
Upload saves the config to the db and updates status accordingly.
func (*ConfigurationVersion) WorkspaceID ¶ added in v0.0.12
func (cv *ConfigurationVersion) WorkspaceID() string
type ConfigurationVersionCreateOptions ¶ added in v0.0.8
ConfigurationVersionCreateOptions represents the options for creating a configuration version. See dto.ConfigurationVersionCreateOptions for more details.
type ConfigurationVersionGetOptions ¶
type ConfigurationVersionGetOptions struct { // ID of config version to retrieve ID *string // Get latest config version for this workspace ID WorkspaceID *string // A list of relations to include Include *string `schema:"include"` }
ConfigurationVersionGetOptions are options for retrieving a single config version. Either ID *or* WorkspaceID must be specfiied.
type ConfigurationVersionList ¶
type ConfigurationVersionList struct { *Pagination Items []*ConfigurationVersion }
ConfigurationVersionList represents a list of configuration versions.
type ConfigurationVersionListOptions ¶
type ConfigurationVersionListOptions struct { // A list of relations to include Include *string `schema:"include"` ListOptions }
ConfigurationVersionListOptions are options for paginating and filtering a list of configuration versions
type ConfigurationVersionResult ¶ added in v0.0.12
type ConfigurationVersionResult struct { ConfigurationVersionID pgtype.Text `json:"configuration_version_id"` CreatedAt pgtype.Timestamptz `json:"created_at"` AutoQueueRuns bool `json:"auto_queue_runs"` Source pgtype.Text `json:"source"` Speculative bool `json:"speculative"` Status pgtype.Text `json:"status"` WorkspaceID pgtype.Text `json:"workspace_id"` ConfigurationVersionStatusTimestamps []pggen.ConfigurationVersionStatusTimestamps `json:"configuration_version_status_timestamps"` }
ConfigurationVersionResult represents the result of a database query for a configuration version.
type ConfigurationVersionService ¶
type ConfigurationVersionService interface { CreateConfigurationVersion(ctx context.Context, workspaceID string, opts ConfigurationVersionCreateOptions) (*ConfigurationVersion, error) GetConfigurationVersion(ctx context.Context, id string) (*ConfigurationVersion, error) GetLatestConfigurationVersion(ctx context.Context, workspaceID string) (*ConfigurationVersion, error) ListConfigurationVersions(ctx context.Context, workspaceID string, opts ConfigurationVersionListOptions) (*ConfigurationVersionList, error) // Upload handles verification and upload of the config tarball, updating // the config version upon success or failure. UploadConfig(ctx context.Context, id string, config []byte) error // Download retrieves the config tarball for the given config version ID. DownloadConfig(ctx context.Context, id string) ([]byte, error) }
type ConfigurationVersionStatusTimestamp ¶ added in v0.0.12
type ConfigurationVersionStatusTimestamp struct { Status ConfigurationStatus Timestamp time.Time }
type ConfigurationVersionStore ¶
type ConfigurationVersionStore interface { // Creates a config version. CreateConfigurationVersion(ctx context.Context, cv *ConfigurationVersion) error // Get retrieves a config version. GetConfigurationVersion(ctx context.Context, opts ConfigurationVersionGetOptions) (*ConfigurationVersion, error) // GetConfig retrieves the config tarball for the given config version ID. GetConfig(ctx context.Context, id string) ([]byte, error) // List lists config versions for the given workspace. ListConfigurationVersions(ctx context.Context, workspaceID string, opts ConfigurationVersionListOptions) (*ConfigurationVersionList, error) // Delete deletes the config version from the store DeleteConfigurationVersion(ctx context.Context, id string) error // Upload uploads a config tarball for the given config version ID UploadConfigurationVersion(ctx context.Context, id string, fn func(cv *ConfigurationVersion, uploader ConfigUploader) error) error }
type CurrentRunService ¶ added in v0.0.12
type CurrentRunService interface { // SetCurrentRun sets the ID of the latest run for a workspace. // // Take full run obj as param SetCurrentRun(ctx context.Context, workspaceID, runID string) error }
CurrentRunService provides interaction with the current run for a workspace, i.e. the current, or most recently current, non-speculative, run.
type DB ¶ added in v0.0.12
type DB interface { // Tx provides a transaction within which to operate on the store. Tx(ctx context.Context, tx func(DB) error) error // WaitAndLock obtains a DB with a session-level advisory lock. WaitAndLock(ctx context.Context, id int64, cb func(DB) error) error Close() UserStore TeamStore OrganizationStore WorkspaceStore RunStore SessionStore StateVersionStore TokenStore ConfigurationVersionStore ChunkStore AgentTokenStore }
DB provides access to otf database
type Downloader ¶ added in v0.0.12
type Downloader interface { // Download version, return path. Download(ctx context.Context, version string, w io.Writer) (path string, err error) }
Downloader is capable of downloading a version of software.
type Entitlements ¶
type Entitlements struct { ID string Agents bool AuditLogging bool CostEstimation bool Operations bool PrivateModuleRegistry bool SSO bool Sentinel bool StateStorage bool Teams bool VCSIntegrations bool }
Entitlements represents the entitlements of an organization. Unlike TFE/TFC, OTF is free and therefore the user is entitled to all currently supported services.
func DefaultEntitlements ¶
func DefaultEntitlements(organizationID string) *Entitlements
DefaultEntitlements constructs an Entitlements struct with currently supported entitlements.
type Environment ¶ added in v0.0.8
type Environment interface { Path() string RunTerraform(cmd string, args ...string) error RunCLI(name string, args ...string) error RunFunc(fn EnvironmentFunc) error TerraformPath() string // All app services should be made available to the environment Application // For downloading TF CLI Downloader // Permits job to write to output that'll be shown to the user io.Writer }
Environment provides a Job with access to various otf services, a working directory, and the ability to invoke arbitrary commands and go functions. Invoking commands and functions via the environment means the environment can handle canceling them if necessary.
type EnvironmentFunc ¶ added in v0.0.8
type EnvironmentFunc func(context.Context, Environment) error
EnvironmentFunc is a go func that is invoked within an environment (and with access to the environment).
type Event ¶
type Event struct { Type EventType Payload interface{} }
Event represents an event in the lifecycle of an otf resource
type EventService ¶
type EventService interface { // Watch provides access to a stream of events. The WatchOptions filters // events. Watch(context.Context, WatchOptions) (<-chan Event, error) // WatchLogs provides access to a stream of phase logs. The WatchLogsOptions filters // events. WatchLogs(context.Context, WatchLogsOptions) (<-chan Chunk, error) }
EventService allows interacting with events. Access is authenticated.
type EventType ¶
type EventType string
EventType identifies the type of event
const ( EventOrganizationCreated EventType = "organization_created" EventOrganizationDeleted EventType = "organization_deleted" EventWorkspaceCreated EventType = "workspace_created" EventWorkspaceRenamed EventType = "workspace_renamed" EventWorkspaceDeleted EventType = "workspace_deleted" EventRunCreated EventType = "run_created" EventRunStatusUpdate EventType = "run_status_update" EventRunDeleted EventType = "run_deleted" EventRunCancel EventType = "run_cancel" EventRunForceCancel EventType = "run_force_cancel" EventError EventType = "error" EventInfo EventType = "info" EventLogChunk EventType = "log_update" )
type ExecutionMode ¶ added in v0.0.12
type ExecutionMode string
type FakeWorkspaceLockService ¶ added in v0.0.12
type FakeWorkspaceLockService struct {
WorkspaceLockService
}
func (*FakeWorkspaceLockService) LockWorkspace ¶ added in v0.0.12
func (f *FakeWorkspaceLockService) LockWorkspace(context.Context, WorkspaceSpec, WorkspaceLockOptions) (*Workspace, error)
type GetChunkOptions ¶
type GetChunkOptions struct { RunID string `schema:"run_id"` Phase PhaseType `schema:"phase"` // Limit is the size of the chunk to retrieve Limit int `schema:"limit"` // Offset is the position in the data from which to retrieve the chunk. Offset int `schema:"offset"` }
func (GetChunkOptions) Key ¶ added in v0.0.12
func (c GetChunkOptions) Key() string
Key returns an identifier for looking up chunks in a cache
type Identity ¶ added in v0.0.12
type Identity interface { // Human friendly identification of the entity. String() string // Uniquely identifies the entity. ID() string }
Identity is an identifiable otf entity.
type JobWriter ¶
type JobWriter struct { // ID of run to write logs on behalf of. ID string // run phase Phase PhaseType // LogService for uploading logs to server LogService logr.Logger // contains filtered or unexported fields }
JobWriter writes logs on behalf of a run phase.
TODO: rename to LogWriter or PhaseWriter
func NewJobWriter ¶ added in v0.0.12
type ListOptions ¶ added in v0.0.8
type ListOptions struct { // The page number to request. The results vary based on the PageSize. PageNumber int `schema:"page[number],omitempty"` // The number of elements returned in a single page. PageSize int `schema:"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".
func (ListOptions) GetLimit ¶ added in v0.0.8
func (o ListOptions) GetLimit() int
GetLimit calculates the limit for use in SQL queries.
func (ListOptions) GetOffset ¶ added in v0.0.8
func (o ListOptions) GetOffset() int
GetOffset calculates the offset for use in SQL queries.
func (ListOptions) NextPageQuery ¶ added in v0.0.12
func (o ListOptions) NextPageQuery() string
NextPageQuery produces query params for the next page
func (ListOptions) PrevPageQuery ¶ added in v0.0.12
func (o ListOptions) PrevPageQuery() string
PrevPageQuery produces query params for the previous page
type LocalAgent ¶ added in v0.0.12
type LocalAgent struct{}
LocalAgent identifies the built-in agent for authentication purposes. (Built-in agent is distinct from 'proper' agents deployed outside of otfd).
func (*LocalAgent) CanAccessOrganization ¶ added in v0.0.12
func (*LocalAgent) CanAccessOrganization(Action, string) bool
CanAccessOrganization - unlike proper agents, the local agent can access any organization.
func (*LocalAgent) CanAccessSite ¶ added in v0.0.12
func (*LocalAgent) CanAccessSite(action Action) bool
CanAccessSite - local agent needs to retrieve runs across site
func (*LocalAgent) CanAccessWorkspace ¶ added in v0.0.12
func (*LocalAgent) CanAccessWorkspace(Action, *WorkspacePolicy) bool
CanAccessWorkspace - unlike proper agents, the local agent can acess any workspace
func (*LocalAgent) ID ¶ added in v0.0.12
func (*LocalAgent) ID() string
func (*LocalAgent) String ¶ added in v0.0.12
func (*LocalAgent) String() string
type LockableApplication ¶ added in v0.0.12
type LockableApplication interface {
WithLock(ctx context.Context, id int64, cb func(Application) error) error
}
LockableApplication is an application that holds an exclusive lock with the given ID.
type LogService ¶ added in v0.0.12
type LogService ChunkService
LogService is an alias for ChunkService
type NewSessionOption ¶ added in v0.0.12
type NewSessionOption func(*Session)
func SessionExpiry ¶ added in v0.0.12
func SessionExpiry(expiry time.Time) NewSessionOption
type NewTeamOption ¶ added in v0.0.12
type NewTeamOption func(*Team)
type NewUserOption ¶ added in v0.0.12
type NewUserOption func(*User)
func WithOrganizationMemberships ¶ added in v0.0.12
func WithOrganizationMemberships(memberships ...*Organization) NewUserOption
func WithTeamMemberships ¶ added in v0.0.12
func WithTeamMemberships(memberships ...*Team) NewUserOption
type Organization ¶
type Organization struct {
// contains filtered or unexported fields
}
Organization represents a Terraform Enterprise organization.
func NewOrganization ¶
func NewOrganization(opts OrganizationCreateOptions) (*Organization, error)
func NewTestOrganization ¶ added in v0.0.12
func NewTestOrganization(t *testing.T) *Organization
func UnmarshalOrganizationJSONAPI ¶ added in v0.0.12
func UnmarshalOrganizationJSONAPI(model *dto.Organization) *Organization
func UnmarshalOrganizationRow ¶ added in v0.0.12
func UnmarshalOrganizationRow(row pggen.Organizations) *Organization
UnmarshalOrganizationRow converts an organization database row into an organization.
func (*Organization) CreatedAt ¶ added in v0.0.12
func (org *Organization) CreatedAt() time.Time
func (*Organization) ID ¶
func (org *Organization) ID() string
func (*Organization) Name ¶
func (org *Organization) Name() string
func (*Organization) OrganizationName ¶ added in v0.0.12
func (org *Organization) OrganizationName() string
func (*Organization) SessionRemember ¶
func (org *Organization) SessionRemember() int
func (*Organization) SessionTimeout ¶
func (org *Organization) SessionTimeout() int
func (*Organization) String ¶ added in v0.0.8
func (org *Organization) String() string
func (*Organization) UpdatedAt ¶ added in v0.0.12
func (org *Organization) UpdatedAt() time.Time
type OrganizationAccess ¶ added in v0.0.12
type OrganizationAccess struct {
ManageWorkspaces bool
}
OrganizationAccess defines a team's organization access.
type OrganizationCreateOptions ¶ added in v0.0.8
type OrganizationCreateOptions struct { Name *string `schema:"name,required"` SessionRemember *int SessionTimeout *int }
OrganizationCreateOptions represents the options for creating an organization. See dto.OrganizationCreateOptions for more details.
func (*OrganizationCreateOptions) Validate ¶ added in v0.0.12
func (opts *OrganizationCreateOptions) Validate() error
type OrganizationList ¶
type OrganizationList struct { *Pagination Items []*Organization }
OrganizationList represents a list of Organizations.
type OrganizationListOptions ¶ added in v0.0.8
type OrganizationListOptions struct {
ListOptions
}
OrganizationListOptions represents the options for listing organizations.
type OrganizationService ¶
type OrganizationService interface { CreateOrganization(ctx context.Context, opts OrganizationCreateOptions) (*Organization, error) EnsureCreatedOrganization(ctx context.Context, opts OrganizationCreateOptions) (*Organization, error) GetOrganization(ctx context.Context, name string) (*Organization, error) ListOrganizations(ctx context.Context, opts OrganizationListOptions) (*OrganizationList, error) UpdateOrganization(ctx context.Context, name string, opts *OrganizationUpdateOptions) (*Organization, error) DeleteOrganization(ctx context.Context, name string) error GetEntitlements(ctx context.Context, name string) (*Entitlements, error) }
type OrganizationStore ¶
type OrganizationStore interface { CreateOrganization(ctx context.Context, org *Organization) error GetOrganization(ctx context.Context, name string) (*Organization, error) ListOrganizations(ctx context.Context, opts OrganizationListOptions) (*OrganizationList, error) UpdateOrganization(ctx context.Context, name string, fn func(*Organization) error) (*Organization, error) DeleteOrganization(ctx context.Context, name string) error GetOrganizationNameByWorkspaceID(ctx context.Context, workspaceID string) (string, error) }
type OrganizationUpdateOptions ¶ added in v0.0.8
OrganizationUpdateOptions represents the options for updating an organization. See dto.OrganizationUpdateOptions for more details.
type Pagination ¶ added in v0.0.8
type Pagination struct {
// contains filtered or unexported fields
}
Pagination is used to return the pagination details of an API request.
func NewPagination ¶
func NewPagination(opts ListOptions, count int) *Pagination
NewPagination constructs a Pagination obj.
func UnmarshalPaginationJSONAPI ¶ added in v0.0.12
func UnmarshalPaginationJSONAPI(json *jsonapi.Pagination) *Pagination
UnmarshalPaginationJSONAPI converts a JSON-API DTO into a pagination object.
func (*Pagination) CurrentPage ¶ added in v0.0.8
func (p *Pagination) CurrentPage() int
func (*Pagination) NextPage ¶ added in v0.0.8
func (p *Pagination) NextPage() *int
NextPage returns the next page number or nil if there isn't one.
func (*Pagination) PrevPage ¶ added in v0.0.12
func (p *Pagination) PrevPage() *int
PrevPage returns the previous page number or nil if there isn't one.
func (*Pagination) ToJSONAPI ¶ added in v0.0.12
func (p *Pagination) ToJSONAPI() *jsonapi.Pagination
ToJSONAPI assembles a JSON-API DTO for wire serialization.
func (*Pagination) TotalCount ¶ added in v0.0.8
func (p *Pagination) TotalCount() int
func (*Pagination) TotalPages ¶ added in v0.0.8
func (p *Pagination) TotalPages() int
type PersistedChunk ¶ added in v0.0.12
PersistedChunk is a chunk that has been persisted to the backend.
func (PersistedChunk) ID ¶ added in v0.0.12
func (c PersistedChunk) ID() string
func (PersistedChunk) String ¶ added in v0.0.12
func (c PersistedChunk) String() string
type Phase ¶
type Phase interface { // Run ID ID() string // phase type Phase() PhaseType // current phase status Status() PhaseStatus // Get job status timestamps StatusTimestamps() []PhaseStatusTimestamp // Lookup timestamp for status StatusTimestamp(PhaseStatus) (time.Time, error) }
Phase is a section of work performed by a run.
type PhaseFinishOptions ¶ added in v0.0.12
type PhaseFinishOptions struct { // Errored is true if the phase finished unsuccessfully. Errored bool `jsonapi:"attr,errored,omitempty"` }
PhaseFinishOptions report the status of a phase upon finishing.
type PhaseStartOptions ¶ added in v0.0.12
type PhaseStartOptions struct {
AgentID string `jsonapi:"attr,agent-id,omitempty"`
}
type PhaseStatus ¶ added in v0.0.12
type PhaseStatus string
func (PhaseStatus) String ¶ added in v0.0.12
func (r PhaseStatus) String() string
type PhaseStatusTimestamp ¶ added in v0.0.12
type PhaseStatusTimestamp struct { Status PhaseStatus Timestamp time.Time }
type Plan ¶
type Plan struct { // report of planned resource changes *ResourceReport // contains filtered or unexported fields }
Plan is the plan phase of a run
func (*Plan) HasChanges ¶
HasChanges determines whether plan has any changes (adds/changes/deletions).
func (Plan) Status ¶
func (p Plan) Status() PhaseStatus
func (Plan) StatusTimestamp ¶ added in v0.0.12
func (p Plan) StatusTimestamp(status PhaseStatus) (time.Time, error)
func (Plan) StatusTimestamps ¶
func (p Plan) StatusTimestamps() []PhaseStatusTimestamp
type PlanFile ¶
type PlanFile struct {
ResourceChanges []ResourceChange `json:"resource_changes"`
}
PlanFile represents the schema of a plan file
func (*PlanFile) Changes ¶
func (pf *PlanFile) Changes() (tally ResourceReport)
Changes provides a tally of the types of changes proposed in the plan file.
type PlanFormat ¶ added in v0.0.12
type PlanFormat string
PlanFormat is the format of the plan file
func (PlanFormat) CacheKey ¶ added in v0.0.12
func (f PlanFormat) CacheKey(id string) string
func (PlanFormat) SQLColumn ¶ added in v0.0.12
func (f PlanFormat) SQLColumn() string
type PubSubService ¶ added in v0.0.12
type PubSubService interface { // Publish an event Publish(Event) // Subscribe creates a subscription to a stream of errors. Name is a // unique identifier describing the subscriber. Subscribe(ctx context.Context, name string) (<-chan Event, error) }
PubSubService provides low-level access to pub-sub behaviours. Access is unauthenticated.
type PutChunkOptions ¶
type ResourceChange ¶
type ResourceChange struct {
Change Change
}
ResourceChange represents a proposed change to a resource in a plan file
type ResourceReport ¶ added in v0.0.12
ResourceReport reports a summary of additions, changes, and deletions of resources in a plan or an apply.
func CompilePlanReport ¶ added in v0.0.12
func CompilePlanReport(planJSON []byte) (ResourceReport, error)
CompilePlanReport compiles a report of planned changes from a JSON representation of a plan file.
func ParseApplyOutput ¶ added in v0.0.8
func ParseApplyOutput(output string) (ResourceReport, error)
func (ResourceReport) HasChanges ¶ added in v0.0.12
func (r ResourceReport) HasChanges() bool
type Run ¶
type Run struct {
// contains filtered or unexported fields
}
func NewRun ¶ added in v0.0.12
func NewRun(cv *ConfigurationVersion, ws *Workspace, opts RunCreateOptions) *Run
NewRun creates a new run with defaults.
func NewTestRun ¶ added in v0.0.12
func NewTestRun(t *testing.T, opts TestRunCreateOptions) *Run
NewTestRun creates a new run. Expressly for testing purposes.
func UnmarshalRunJSONAPI ¶ added in v0.0.12
func UnmarshalRunResult ¶ added in v0.0.12
func (*Run) CanAccessOrganization ¶ added in v0.0.12
func (*Run) CanAccessSite ¶ added in v0.0.12
func (*Run) CanAccessWorkspace ¶ added in v0.0.12
func (r *Run) CanAccessWorkspace(action Action, policy *WorkspacePolicy) bool
func (*Run) Cancel ¶
Cancel run. Returns a boolean indicating whether a cancel request should be enqueued (for an agent to kill an in progress process)
func (*Run) Cancelable ¶ added in v0.0.12
Cancelable determines whether run can be cancelled.
func (*Run) ConfigurationVersionID ¶ added in v0.0.12
func (*Run) Confirmable ¶ added in v0.0.12
Confirmable determines whether run can be confirmed.
func (*Run) Discardable ¶ added in v0.0.12
Discardable determines whether run can be discarded.
func (*Run) Done ¶ added in v0.0.12
Done determines whether run has reached an end state, e.g. applied, discarded, etc.
func (*Run) EnqueueApply ¶ added in v0.0.12
func (*Run) EnqueuePlan ¶ added in v0.0.12
func (r *Run) EnqueuePlan(ctx context.Context, svc WorkspaceLockService) error
EnqueuePlan enqueues a plan for the run. It also sets the run as the latest run for its workspace (speculative runs are ignored).
func (*Run) ExecutionMode ¶ added in v0.0.12
func (r *Run) ExecutionMode() ExecutionMode
func (*Run) Finish ¶
func (r *Run) Finish(phase PhaseType, opts PhaseFinishOptions) error
Finish updates the run to reflect its plan or apply phase having finished.
func (*Run) ForceCancel ¶
ForceCancel force cancels a run. A cool-off period of 10 seconds must have elapsed following a cancelation request before a run can be force canceled.
func (*Run) ForceCancelAvailableAt ¶
func (*Run) HasApply ¶ added in v0.0.12
HasApply determines whether the run has started applying yet.
func (*Run) HasChanges ¶ added in v0.0.12
func (*Run) IncludeWorkspace ¶ added in v0.0.12
IncludeWorkspace adds a workspace for inclusion in the run's JSON-API object.
func (*Run) Latest ¶ added in v0.0.12
Latest determines whether run is the latest run for a workspace, i.e. its current run, or the most recent current run.
func (*Run) OrganizationName ¶ added in v0.0.12
func (*Run) RefreshOnly ¶
func (*Run) ReplaceAddrs ¶
func (*Run) Speculative ¶ added in v0.0.12
func (*Run) StatusTimestamp ¶ added in v0.0.12
func (*Run) StatusTimestamps ¶
func (r *Run) StatusTimestamps() []RunStatusTimestamp
func (*Run) TargetAddrs ¶
func (*Run) WorkspaceID ¶ added in v0.0.12
func (*Run) WorkspaceName ¶ added in v0.0.12
type RunApplyOptions ¶ added in v0.0.8
type RunApplyOptions struct { // An optional comment about the run. Comment *string `json:"comment,omitempty"` }
RunApplyOptions represents the options for applying a run.
type RunCancelOptions ¶ added in v0.0.8
type RunCancelOptions struct { // An optional explanation for why the run was canceled. Comment *string `jsonapi:"attr,comment,omitempty"` }
RunCancelOptions represents the options for canceling a run.
type RunCreateOptions ¶ added in v0.0.8
type RunCreateOptions struct { IsDestroy *bool Refresh *bool RefreshOnly *bool Message *string ConfigurationVersionID *string WorkspaceID *string TargetAddrs []string ReplaceAddrs []string WorkspaceSpec WorkspaceSpec }
RunCreateOptions represents the options for creating a new run. See dto.RunCreateOptions for further detail.
type RunDiscardOptions ¶ added in v0.0.8
type RunDiscardOptions struct { // An optional explanation for why the run was discarded. Comment *string `jsonapi:"attr,comment,omitempty"` }
RunDiscardOptions represents the options for discarding a run.
type RunFactory ¶
type RunFactory struct { ConfigurationVersionService ConfigurationVersionService WorkspaceService WorkspaceService }
RunFactory is a factory for constructing Run objects.
func (*RunFactory) NewRun ¶
func (f *RunFactory) NewRun(ctx context.Context, workspaceSpec WorkspaceSpec, opts RunCreateOptions) (*Run, error)
NewRun constructs a new run at the beginning of its lifecycle using the provided options.
type RunForceCancelOptions ¶ added in v0.0.8
type RunForceCancelOptions struct { // An optional comment explaining the reason for the force-cancel. Comment *string `jsonapi:"attr,comment,omitempty"` }
RunForceCancelOptions represents the options for force-canceling a run.
type RunList ¶
type RunList struct { *Pagination Items []*Run }
RunList represents a list of runs.
func UnmarshalRunListJSONAPI ¶ added in v0.0.12
UnmarshalRunListJSONAPI converts a DTO into a run list
type RunListOptions ¶
type RunListOptions struct { ListOptions // Filter by run statuses (with an implicit OR condition) Statuses []RunStatus `schema:"statuses,omitempty"` // Filter by workspace ID WorkspaceID *string `schema:"workspace_id,omitempty"` // Filter by organization name OrganizationName *string `schema:"organization_name,omitempty"` // Filter by workspace name WorkspaceName *string `schema:"workspace_name,omitempty"` // Filter by speculative or non-speculative Speculative *bool `schema:"-"` // A list of relations to include. See available resources: // https://www.terraform.io/docs/cloud/api/run.html#available-related-resources Include *string `schema:"include,omitempty"` }
RunListOptions are options for paginating and filtering a list of runs
func (RunListOptions) LogFields ¶ added in v0.0.12
func (opts RunListOptions) LogFields() (fields []interface{})
LogFields provides fields for logging
type RunResult ¶ added in v0.0.12
type RunResult struct { RunID pgtype.Text `json:"run_id"` CreatedAt pgtype.Timestamptz `json:"created_at"` ForceCancelAvailableAt pgtype.Timestamptz `json:"force_cancel_available_at"` IsDestroy bool `json:"is_destroy"` PositionInQueue int `json:"position_in_queue"` Refresh bool `json:"refresh"` RefreshOnly bool `json:"refresh_only"` Status pgtype.Text `json:"status"` PlanStatus pgtype.Text `json:"plan_status"` ApplyStatus pgtype.Text `json:"apply_status"` ReplaceAddrs []string `json:"replace_addrs"` TargetAddrs []string `json:"target_addrs"` PlannedChanges *pggen.Report `json:"planned_changes"` AppliedChanges *pggen.Report `json:"applied_changes"` ConfigurationVersionID pgtype.Text `json:"configuration_version_id"` WorkspaceID pgtype.Text `json:"workspace_id"` Speculative bool `json:"speculative"` AutoApply bool `json:"auto_apply"` WorkspaceName pgtype.Text `json:"workspace_name"` ExecutionMode pgtype.Text `json:"execution_mode"` Latest bool `json:"latest"` OrganizationName pgtype.Text `json:"organization_name"` RunStatusTimestamps []pggen.RunStatusTimestamps `json:"run_status_timestamps"` PlanStatusTimestamps []pggen.PhaseStatusTimestamps `json:"plan_status_timestamps"` ApplyStatusTimestamps []pggen.PhaseStatusTimestamps `json:"apply_status_timestamps"` }
RunResult represents the result of a database query for a run.
type RunService ¶
type RunService interface { // Create a new run with the given options. CreateRun(ctx context.Context, ws WorkspaceSpec, opts RunCreateOptions) (*Run, error) // Get retrieves a run with the given ID. GetRun(ctx context.Context, id string) (*Run, error) // List lists runs according to the given options. ListRuns(ctx context.Context, opts RunListOptions) (*RunList, error) // Delete deletes a run with the given ID. DeleteRun(ctx context.Context, id string) error // EnqueuePlan enqueues a plan EnqueuePlan(ctx context.Context, id string) (*Run, error) // Apply a run with the given ID. ApplyRun(ctx context.Context, id string, opts RunApplyOptions) error // Discard discards a run with the given ID. DiscardRun(ctx context.Context, id string, opts RunDiscardOptions) error // Cancel run. CancelRun(ctx context.Context, id string, opts RunCancelOptions) error // Forcefully cancel a run. ForceCancelRun(ctx context.Context, id string, opts RunForceCancelOptions) error // Start a run phase. StartPhase(ctx context.Context, id string, phase PhaseType, opts PhaseStartOptions) (*Run, error) // Finish a run phase. FinishPhase(ctx context.Context, id string, phase PhaseType, opts PhaseFinishOptions) (*Run, error) // GetPlanFile retrieves a run's plan file with the requested format. GetPlanFile(ctx context.Context, id string, format PlanFormat) ([]byte, error) // UploadPlanFile saves a run's plan file with the requested format. UploadPlanFile(ctx context.Context, id string, plan []byte, format PlanFormat) error // GetLockFile retrieves a run's lock file (.terraform.lock.hcl) GetLockFile(ctx context.Context, id string) ([]byte, error) // UploadLockFile saves a run's lock file (.terraform.lock.hcl) UploadLockFile(ctx context.Context, id string, lockFile []byte) error // Read and write logs for run phases. LogService // Tail logs of a run phase Tail(ctx context.Context, opts GetChunkOptions) (<-chan Chunk, error) }
RunService implementations allow interactions with runs
type RunStatus ¶ added in v0.0.8
type RunStatus string
RunStatus represents a run state.
const ( // DefaultRefresh specifies that the state be refreshed prior to running a // plan DefaultRefresh = true // List all available run statuses supported in OTF. RunApplied RunStatus = "applied" RunApplyQueued RunStatus = "apply_queued" RunApplying RunStatus = "applying" RunCanceled RunStatus = "canceled" RunForceCanceled RunStatus = "force_canceled" RunConfirmed RunStatus = "confirmed" RunDiscarded RunStatus = "discarded" RunErrored RunStatus = "errored" RunPending RunStatus = "pending" RunPlanQueued RunStatus = "plan_queued" RunPlanned RunStatus = "planned" RunPlannedAndFinished RunStatus = "planned_and_finished" RunPlanning RunStatus = "planning" )
type RunStatusTimestamp ¶ added in v0.0.8
type RunStore ¶
type RunStore interface { CreateRun(ctx context.Context, run *Run) error GetRun(ctx context.Context, id string) (*Run, error) SetPlanFile(ctx context.Context, id string, file []byte, format PlanFormat) error GetPlanFile(ctx context.Context, id string, format PlanFormat) ([]byte, error) SetLockFile(ctx context.Context, id string, file []byte) error GetLockFile(ctx context.Context, id string) ([]byte, error) ListRuns(ctx context.Context, opts RunListOptions) (*RunList, error) // UpdateStatus updates the run's status, providing a func with which to // perform updates in a transaction. UpdateStatus(ctx context.Context, id string, fn func(*Run) error) (*Run, error) CreatePlanReport(ctx context.Context, id string, report ResourceReport) error CreateApplyReport(ctx context.Context, id string, report ResourceReport) error DeleteRun(ctx context.Context, id string) error }
RunStore implementations persist Run objects.
type Scheduler ¶ added in v0.0.12
type Scheduler struct { Application logr.Logger // contains filtered or unexported fields }
Scheduler enqueues pending runs onto workspace queues and current runs onto the global queue (for processing by agents).
func NewScheduler ¶ added in v0.0.12
func NewScheduler(logger logr.Logger, app Application) *Scheduler
NewScheduler constructs and initialises the scheduler.
type Session ¶ added in v0.0.12
type Session struct {
// contains filtered or unexported fields
}
Session is a user session
func NewSession ¶ added in v0.0.12
func NewTestSession ¶ added in v0.0.12
func NewTestSession(t *testing.T, userID string, opts ...NewSessionOption) *Session
func UnmarshalSessionResult ¶ added in v0.0.12
func UnmarshalSessionResult(result SessionResult) *Session
type SessionResult ¶ added in v0.0.12
type SessionResult struct { Token pgtype.Text `json:"token"` CreatedAt pgtype.Timestamptz `json:"created_at"` Address pgtype.Text `json:"address"` Expiry pgtype.Timestamptz `json:"expiry"` UserID pgtype.Text `json:"user_id"` }
type SessionService ¶ added in v0.0.12
type SessionService interface { // CreateSession creates a user session. CreateSession(ctx context.Context, userID, address string) (*Session, error) // GetSession retrieves a session using its token. GetSessionByToken(ctx context.Context, token string) (*Session, error) // ListSessions lists current sessions for a user ListSessions(ctx context.Context, userID string) ([]*Session, error) // DeleteSession deletes the session with the given token DeleteSession(ctx context.Context, token string) error }
type SessionStore ¶ added in v0.0.12
type SessionStore interface { // CreateSession persists a new session to the store. CreateSession(ctx context.Context, session *Session) error // GetSession retrieves a session using its token. GetSessionByToken(ctx context.Context, token string) (*Session, error) // ListSessions lists current sessions for a user ListSessions(ctx context.Context, userID string) ([]*Session, error) // DeleteSession deletes a session DeleteSession(ctx context.Context, token string) error }
SessionStore is a persistence store for user sessions.
type State ¶
type State struct { Version int Serial int64 Lineage string Outputs map[string]StateOutput }
State is terraform state.
func NewState ¶ added in v0.0.12
func NewState(opts StateCreateOptions, outputs ...StateOutput) *State
NewState constructs a new state
func UnmarshalState ¶ added in v0.0.12
UnmarshalState unmarshals terraform state from a raw byte slice.
type StateCreateOptions ¶ added in v0.0.12
StateCreateOptions are options for creating state
type StateOutput ¶
StateOutput is a terraform state output.
type StateVersion ¶
type StateVersion struct {
// contains filtered or unexported fields
}
StateVersion represents a Terraform Enterprise state version.
func NewStateVersion ¶ added in v0.0.12
func NewStateVersion(opts StateVersionCreateOptions) (*StateVersion, error)
NewStateVersion constructs a new state version.
func NewTestStateVersion ¶ added in v0.0.12
func NewTestStateVersion(t *testing.T, outputs ...StateOutput) *StateVersion
func UnmarshalStateVersionJSONAPI ¶ added in v0.0.12
func UnmarshalStateVersionJSONAPI(dto *jsonapi.StateVersion) *StateVersion
func UnmarshalStateVersionResult ¶ added in v0.0.12
func UnmarshalStateVersionResult(row StateVersionResult) (*StateVersion, error)
UnmarshalStateVersionResult unmarshals a database result query into a state version.
func (*StateVersion) CreatedAt ¶ added in v0.0.12
func (sv *StateVersion) CreatedAt() time.Time
func (*StateVersion) ID ¶
func (sv *StateVersion) ID() string
func (*StateVersion) Outputs ¶
func (sv *StateVersion) Outputs() []*StateVersionOutput
func (*StateVersion) Serial ¶
func (sv *StateVersion) Serial() int64
func (*StateVersion) State ¶ added in v0.0.8
func (sv *StateVersion) State() []byte
func (*StateVersion) String ¶ added in v0.0.8
func (sv *StateVersion) String() string
type StateVersionCreateOptions ¶ added in v0.0.8
type StateVersionCreateOptions struct { Lineage *string Serial *int64 State *string MD5 *string Run *Run }
StateVersionCreateOptions represents the options for creating a state version. See dto.StateVersionCreateOptions for more details.
func (*StateVersionCreateOptions) Valid ¶ added in v0.0.12
func (opts *StateVersionCreateOptions) Valid() error
Valid validates state version create options
TODO: perform validation, check md5, etc
type StateVersionGetOptions ¶
type StateVersionGetOptions struct { // ID of state version to retrieve ID *string // Get current state version belonging to workspace with this ID WorkspaceID *string }
StateVersionGetOptions are options for retrieving a single StateVersion. Either ID *or* WorkspaceID must be specfiied.
type StateVersionList ¶
type StateVersionList struct { *Pagination Items []*StateVersion }
StateVersionList represents a list of state versions.
type StateVersionListOptions ¶ added in v0.0.8
type StateVersionListOptions struct { ListOptions Organization string `schema:"filter[organization][name],required"` Workspace string `schema:"filter[workspace][name],required"` }
StateVersionListOptions represents the options for listing state versions.
type StateVersionOutput ¶
type StateVersionOutput struct { Name string Sensitive bool Type string Value string // contains filtered or unexported fields }
func UnmarshalStateVersionOutputRow ¶ added in v0.0.12
func UnmarshalStateVersionOutputRow(row pggen.StateVersionOutputs) *StateVersionOutput
UnmarshalStateVersionOutputRow unmarshals a database row into a state version output.
func (*StateVersionOutput) ID ¶
func (svo *StateVersionOutput) ID() string
func (*StateVersionOutput) String ¶ added in v0.0.8
func (svo *StateVersionOutput) String() string
type StateVersionResult ¶ added in v0.0.12
type StateVersionResult struct { StateVersionID pgtype.Text `json:"state_version_id"` CreatedAt pgtype.Timestamptz `json:"created_at"` Serial int `json:"serial"` State []byte `json:"state"` WorkspaceID pgtype.Text `json:"workspace_id"` StateVersionOutputs []pggen.StateVersionOutputs `json:"state_version_outputs"` }
StateVersionResult represents the result of a database query for a state version.
type StateVersionService ¶
type StateVersionService interface { CreateStateVersion(ctx context.Context, workspaceID string, opts StateVersionCreateOptions) (*StateVersion, error) CurrentStateVersion(ctx context.Context, workspaceID string) (*StateVersion, error) GetStateVersion(ctx context.Context, id string) (*StateVersion, error) DownloadState(ctx context.Context, id string) ([]byte, error) ListStateVersions(ctx context.Context, opts StateVersionListOptions) (*StateVersionList, error) }
type StateVersionStore ¶
type StateVersionStore interface { CreateStateVersion(ctx context.Context, workspaceID string, sv *StateVersion) error GetStateVersion(ctx context.Context, opts StateVersionGetOptions) (*StateVersion, error) GetState(ctx context.Context, id string) ([]byte, error) ListStateVersions(ctx context.Context, opts StateVersionListOptions) (*StateVersionList, error) DeleteStateVersion(ctx context.Context, id string) error }
type Subject ¶ added in v0.0.12
type Subject interface { CanAccessSite(action Action) bool CanAccessOrganization(action Action, name string) bool CanAccessWorkspace(action Action, policy *WorkspacePolicy) bool Identity }
Subject is an entity attempting to carry out an action on a resource.
type Team ¶ added in v0.0.12
type Team struct {
// contains filtered or unexported fields
}
Team is a group of users sharing a level of authorization.
func NewTeam ¶ added in v0.0.12
func NewTeam(name string, org *Organization, opts ...NewTeamOption) *Team
func NewTestTeam ¶ added in v0.0.12
func NewTestTeam(t *testing.T, org *Organization, opts ...NewTeamOption) *Team
func UnmarshalTeamResult ¶ added in v0.0.12
func UnmarshalTeamResult(row TeamResult, opts ...NewTeamOption) *Team
func (*Team) Organization ¶ added in v0.0.12
func (u *Team) Organization() *Organization
func (*Team) OrganizationAccess ¶ added in v0.0.12
func (u *Team) OrganizationAccess() OrganizationAccess
func (*Team) OrganizationName ¶ added in v0.0.12
func (*Team) Update ¶ added in v0.0.12
func (u *Team) Update(opts TeamUpdateOptions) error
type TeamResult ¶ added in v0.0.12
type TeamResult struct { TeamID pgtype.Text `json:"team_id"` Name pgtype.Text `json:"name"` CreatedAt pgtype.Timestamptz `json:"created_at"` OrganizationID pgtype.Text `json:"organization_id"` PermissionManageWorkspaces bool `json:"permission_manage_workspaces"` Organization *pggen.Organizations `json:"organization"` }
TeamResult represents the result of a database query for a team.
type TeamService ¶ added in v0.0.12
type TeamService interface { // CreateTeam creates a team with the given name belong to the named // organization. CreateTeam(ctx context.Context, name, organization string) (*Team, error) UpdateTeam(ctx context.Context, name, organization string, opts TeamUpdateOptions) (*Team, error) // EnsureCreatedTeam retrieves a team; if they don't exist they'll be // created. EnsureCreatedTeam(ctx context.Context, name, organization string) (*Team, error) // Get retrieves a team according to the spec. GetTeam(ctx context.Context, name, organization string) (*Team, error) // ListTeams lists teams in an organization. ListTeams(ctx context.Context, organization string) ([]*Team, error) }
TeamService provides methods to interact with team accounts and their sessions.
type TeamStore ¶ added in v0.0.12
type TeamStore interface { CreateTeam(ctx context.Context, team *Team) error UpdateTeam(ctx context.Context, name, organization string, fn func(*Team) error) (*Team, error) GetTeam(ctx context.Context, name, organization string) (*Team, error) DeleteTeam(ctx context.Context, name, organization string) error ListTeams(ctx context.Context, organization string) ([]*Team, error) }
TeamStore is a persistence store for team accounts.
type TeamUpdateOptions ¶ added in v0.0.12
type TeamUpdateOptions struct {
ManageWorkspaces bool `schema:"manage_workspaces"`
}
type TestRunCreateOptions ¶ added in v0.0.12
type TestRunCreateOptions struct { // override ID of run ID *string Speculative bool Status RunStatus AutoApply bool }
TestRunCreateOptions is for testing purposes only.
type Token ¶ added in v0.0.12
type Token struct {
// contains filtered or unexported fields
}
Token is a user authentication token.
func UnmarshalTokenResult ¶ added in v0.0.12
func UnmarshalTokenResult(result pggen.FindTokensByUserIDRow) *Token
func (*Token) Description ¶ added in v0.0.12
type TokenCreateOptions ¶ added in v0.0.12
type TokenCreateOptions struct {
Description string
}
type TokenService ¶ added in v0.0.12
type TokenService interface { // CreateToken creates a user token. CreateToken(ctx context.Context, userID string, opts *TokenCreateOptions) (*Token, error) // ListTokens lists API tokens for a user ListTokens(ctx context.Context, userID string) ([]*Token, error) // DeleteToken deletes a user token. DeleteToken(ctx context.Context, userID string, tokenID string) error }
type TokenStore ¶ added in v0.0.12
type TokenStore interface { // CreateToken creates a user token. CreateToken(ctx context.Context, token *Token) error // ListTokens lists user tokens. ListTokens(ctx context.Context, userID string) ([]*Token, error) // DeleteToken deletes a user token. DeleteToken(ctx context.Context, id string) error }
TokenStore is a persistence store for user authentication tokens.
type Unlocked ¶ added in v0.0.12
type Unlocked struct { // zero identity because an unlocked workspace lock state has no identity Identity }
Unlocked is an unlocked workspace lock
type User ¶ added in v0.0.12
type User struct {
// contains filtered or unexported fields
}
User represents an otf user account.
func NewTestUser ¶ added in v0.0.12
func NewTestUser(t *testing.T, opts ...NewUserOption) *User
func NewUser ¶ added in v0.0.12
func NewUser(username string, opts ...NewUserOption) *User
func UnmarshalUserResult ¶ added in v0.0.12
func UnmarshalUserResult(row UserResult, opts ...NewUserOption) (*User, error)
func UserFromContext ¶ added in v0.0.12
UserFromContext retrieves a user from a context
func (*User) CanAccessOrganization ¶ added in v0.0.12
func (*User) CanAccessSite ¶ added in v0.0.12
func (*User) CanAccessWorkspace ¶ added in v0.0.12
func (u *User) CanAccessWorkspace(action Action, policy *WorkspacePolicy) bool
func (*User) CanLock ¶ added in v0.0.12
CanLock always returns an error because nothing can replace a user lock
func (*User) CanUnlock ¶ added in v0.0.12
CanUnlock decides whether to permits requestor to unlock a user lock
func (*User) IsOwner ¶ added in v0.0.12
IsOwner determines if the user is an owner of an organization
func (*User) IsSiteAdmin ¶ added in v0.0.12
func (*User) IsUnprivilegedUser ¶ added in v0.0.12
func (*User) Organizations ¶ added in v0.0.12
func (u *User) Organizations() []*Organization
func (*User) SyncMemberships ¶ added in v0.0.12
func (u *User) SyncMemberships(ctx context.Context, store UserStore, orgs []*Organization, teams []*Team) error
SyncMemberships synchronises the user's organization and team memberships to match those given, adding and removing memberships in the persistence store accordingly.
func (*User) TeamsByOrganization ¶ added in v0.0.12
TeamsByOrganization return a user's teams filtered by organization name
type UserListOptions ¶ added in v0.0.12
UserListOptions are options for the ListUsers endpoint.
type UserResult ¶ added in v0.0.12
type UserResult struct { UserID pgtype.Text `json:"user_id"` Username pgtype.Text `json:"username"` CreatedAt pgtype.Timestamptz `json:"created_at"` UpdatedAt pgtype.Timestamptz `json:"updated_at"` Organizations []pggen.Organizations `json:"organizations"` Teams []pggen.Teams `json:"teams"` }
UserResult represents the result of a database query for a user.
type UserService ¶ added in v0.0.12
type UserService interface { // CreateUser creates a user with the given username. CreateUser(ctx context.Context, username string) (*User, error) // EnsureCreatedUser retrieves a user; if they don't exist they'll be // created. EnsureCreatedUser(ctx context.Context, username string) (*User, error) // Get retrieves a user according to the spec. GetUser(ctx context.Context, spec UserSpec) (*User, error) // SyncUserMemberships makes the user a member of the specified organizations // and teams and removes any existing memberships not specified. SyncUserMemberships(ctx context.Context, user *User, orgs []*Organization, teams []*Team) (*User, error) // ListUsers lists users. ListUsers(ctx context.Context, opts UserListOptions) ([]*User, error) }
UserService provides methods to interact with user accounts and their sessions.
type UserSpec ¶ added in v0.0.12
type UserStore ¶ added in v0.0.12
type UserStore interface { CreateUser(ctx context.Context, user *User) error GetUser(ctx context.Context, spec UserSpec) (*User, error) // ListUsers lists users. ListUsers(ctx context.Context, opts UserListOptions) ([]*User, error) DeleteUser(ctx context.Context, spec UserSpec) error // AddOrganizationMembership adds a user as a member of an organization AddOrganizationMembership(ctx context.Context, id, orgID string) error // RemoveOrganizationMembership removes a user as a member of an // organization RemoveOrganizationMembership(ctx context.Context, id, orgID string) error // AddTeamMembership adds a user as a member of a team AddTeamMembership(ctx context.Context, id, teamID string) error // RemoveTeamMembership removes a user as a member of an // team RemoveTeamMembership(ctx context.Context, id, teamID string) error }
UserStore is a persistence store for user accounts.
type WatchLogsOptions ¶ added in v0.0.12
type WatchLogsOptions WatchOptions
WatchLogsOptions filters logs returned by the WatchLogs endpoint.
type WatchOptions ¶ added in v0.0.12
type WatchOptions struct { // Name to uniquely describe the watcher. If not provided then a // name will be auto generated. Name *string // Filter by organization name OrganizationName *string `schema:"organization_name"` // Filter by workspace name. Must be specified in tandem with // OrganizationName. WorkspaceName *string `schema:"workspace_name"` }
WatchOptions filters events returned by the Watch endpoint.
type Workspace ¶
type Workspace struct {
// contains filtered or unexported fields
}
Workspace represents a Terraform Enterprise workspace.
func NewTestWorkspace ¶ added in v0.0.12
func NewTestWorkspace(t *testing.T, org *Organization, opts WorkspaceCreateOptions) *Workspace
func NewWorkspace ¶
func NewWorkspace(organization *Organization, opts WorkspaceCreateOptions) (*Workspace, error)
func UnmarshalWorkspaceJSONAPI ¶ added in v0.0.12
func UnmarshalWorkspaceResult ¶ added in v0.0.12
func UnmarshalWorkspaceResult(result WorkspaceResult) (*Workspace, error)
func (*Workspace) AllowDestroyPlan ¶
func (*Workspace) CanQueueDestroyPlan ¶
func (*Workspace) Description ¶
func (*Workspace) Environment ¶
func (*Workspace) ExecutionMode ¶
func (ws *Workspace) ExecutionMode() ExecutionMode
func (*Workspace) ExecutionModes ¶ added in v0.0.12
ExecutionModes returns a list of possible execution modes
func (*Workspace) FileTriggersEnabled ¶
func (*Workspace) GetLock ¶ added in v0.0.12
func (ws *Workspace) GetLock() WorkspaceLockState
func (*Workspace) GlobalRemoteState ¶
func (*Workspace) LatestRunID ¶ added in v0.0.12
func (*Workspace) Lock ¶ added in v0.0.12
func (ws *Workspace) Lock(lock WorkspaceLockState) error
Lock transfers a workspace into the given lock state
func (*Workspace) MigrationEnvironment ¶
func (*Workspace) Organization ¶
func (ws *Workspace) Organization() *Organization
func (*Workspace) OrganizationID ¶ added in v0.0.12
func (*Workspace) OrganizationName ¶ added in v0.0.12
func (*Workspace) QualifiedName ¶ added in v0.0.12
func (ws *Workspace) QualifiedName() WorkspaceQualifiedName
QualifiedName returns the workspace's qualified name including the name of its organization
func (*Workspace) QueueAllRuns ¶
func (*Workspace) SourceName ¶
func (*Workspace) SpecID ¶ added in v0.0.12
func (ws *Workspace) SpecID() WorkspaceSpec
func (*Workspace) SpecName ¶ added in v0.0.12
func (ws *Workspace) SpecName() WorkspaceSpec
func (*Workspace) SpeculativeEnabled ¶
func (*Workspace) StructuredRunOutputEnabled ¶
func (*Workspace) TerraformVersion ¶
func (*Workspace) TriggerPrefixes ¶
func (*Workspace) UpdateWithOptions ¶ added in v0.0.12
func (ws *Workspace) UpdateWithOptions(ctx context.Context, opts WorkspaceUpdateOptions) error
UpdateWithOptions updates the workspace with the given options.
TODO: validate options
func (*Workspace) WorkingDirectory ¶
func (*Workspace) WorkspaceName ¶ added in v0.0.12
type WorkspaceCreateOptions ¶ added in v0.0.8
type WorkspaceCreateOptions struct { AllowDestroyPlan *bool AutoApply *bool Description *string ExecutionMode *ExecutionMode FileTriggersEnabled *bool GlobalRemoteState *bool MigrationEnvironment *string Name string QueueAllRuns *bool SpeculativeEnabled *bool SourceName *string SourceURL *string StructuredRunOutputEnabled *bool TerraformVersion *string TriggerPrefixes []string WorkingDirectory *string OrganizationName string `schema:"organization_name"` // Options for testing purposes only LatestRunID *string }
WorkspaceCreateOptions represents the options for creating a new workspace.
func (WorkspaceCreateOptions) Valid ¶ added in v0.0.8
func (o WorkspaceCreateOptions) Valid() error
type WorkspaceFactory ¶ added in v0.0.12
type WorkspaceFactory struct {
OrganizationService OrganizationService
}
func (*WorkspaceFactory) NewWorkspace ¶ added in v0.0.12
func (f *WorkspaceFactory) NewWorkspace(ctx context.Context, opts WorkspaceCreateOptions) (*Workspace, error)
type WorkspaceList ¶
type WorkspaceList struct { *Pagination Items []*Workspace }
WorkspaceList represents a list of Workspaces.
func UnmarshalWorkspaceListJSONAPI ¶ added in v0.0.12
func UnmarshalWorkspaceListJSONAPI(json *dto.WorkspaceList) *WorkspaceList
UnmarshalWorkspaceListJSONAPI converts a DTO into a workspace list
type WorkspaceListOptions ¶
type WorkspaceListOptions struct { // Pagination ListOptions // Filter workspaces with name matching prefix. Prefix string `schema:"search[name],omitempty"` // OrganizationName filters workspaces by organization name. OrganizationName *string `schema:"organization_name,omitempty"` // Filter by those for which user has workspace-level permissions. UserID *string }
WorkspaceListOptions are options for paginating and filtering a list of Workspaces
type WorkspaceLockOptions ¶ added in v0.0.8
type WorkspaceLockOptions struct { // Specifies the reason for locking the workspace. Reason *string `jsonapi:"attr,reason,omitempty"` }
WorkspaceLockOptions represents the options for locking a workspace.
type WorkspaceLockService ¶ added in v0.0.12
type WorkspaceLockService interface { LockWorkspace(ctx context.Context, spec WorkspaceSpec, opts WorkspaceLockOptions) (*Workspace, error) UnlockWorkspace(ctx context.Context, spec WorkspaceSpec, opts WorkspaceUnlockOptions) (*Workspace, error) }
type WorkspaceLockState ¶ added in v0.0.12
type WorkspaceLockState interface { // CanLock checks whether it can be locked by subject CanLock(subject Identity) error // CanUnlock checks whether it can be unlocked by subject CanUnlock(subject Identity, force bool) error // A lock state has an identity, i.e. the name of the run or user that has // locked the workspace Identity }
WorkspaceLockState is the state a workspace lock is currently in (i.e. unlocked, run-locked, or user-locked)
func LockFromContext ¶ added in v0.0.12
func LockFromContext(ctx context.Context) (WorkspaceLockState, error)
LockFromContext retrieves a workspace lock from a context
type WorkspacePermission ¶ added in v0.0.12
type WorkspacePermission struct { Team *Team Role WorkspaceRole }
WorkspacePermission binds a role to a team.
func UnmarshalWorkspacePermissionResult ¶ added in v0.0.12
func UnmarshalWorkspacePermissionResult(row WorkspacePermissionResult) (*WorkspacePermission, error)
type WorkspacePermissionResult ¶ added in v0.0.12
type WorkspacePermissionResult struct { Role pgtype.Text `json:"role"` Team *pggen.Teams `json:"team"` Organization *pggen.Organizations `json:"organization"` }
WorkspacePermissionResult represents the result of a database query for a workspace permission.
type WorkspacePermissionService ¶ added in v0.0.12
type WorkspacePermissionService interface { SetWorkspacePermission(ctx context.Context, spec WorkspaceSpec, team string, role WorkspaceRole) error ListWorkspacePermissions(ctx context.Context, spec WorkspaceSpec) ([]*WorkspacePermission, error) UnsetWorkspacePermission(ctx context.Context, spec WorkspaceSpec, team string) error }
type WorkspacePolicy ¶ added in v0.0.12
type WorkspacePolicy struct { OrganizationName string WorkspaceID string Permissions []*WorkspacePermission }
WorkspacePolicy binds workspace permissions to a workspace
type WorkspaceQualifiedName ¶ added in v0.0.12
WorkspaceQualifiedName is the workspace's fully qualified name including the name of its organization
type WorkspaceQueue ¶
type WorkspaceQueue struct { Application logr.Logger // contains filtered or unexported fields }
WorkspaceQueue schedules runs for a workspace
type WorkspaceResult ¶ added in v0.0.12
type WorkspaceResult struct { WorkspaceID pgtype.Text `json:"workspace_id"` CreatedAt pgtype.Timestamptz `json:"created_at"` UpdatedAt pgtype.Timestamptz `json:"updated_at"` AllowDestroyPlan bool `json:"allow_destroy_plan"` AutoApply bool `json:"auto_apply"` CanQueueDestroyPlan bool `json:"can_queue_destroy_plan"` Description pgtype.Text `json:"description"` Environment pgtype.Text `json:"environment"` ExecutionMode pgtype.Text `json:"execution_mode"` FileTriggersEnabled bool `json:"file_triggers_enabled"` GlobalRemoteState bool `json:"global_remote_state"` MigrationEnvironment pgtype.Text `json:"migration_environment"` Name pgtype.Text `json:"name"` QueueAllRuns bool `json:"queue_all_runs"` SpeculativeEnabled bool `json:"speculative_enabled"` SourceName pgtype.Text `json:"source_name"` SourceURL pgtype.Text `json:"source_url"` StructuredRunOutputEnabled bool `json:"structured_run_output_enabled"` TerraformVersion pgtype.Text `json:"terraform_version"` TriggerPrefixes []string `json:"trigger_prefixes"` WorkingDirectory pgtype.Text `json:"working_directory"` OrganizationID pgtype.Text `json:"organization_id"` LockRunID pgtype.Text `json:"lock_run_id"` LockUserID pgtype.Text `json:"lock_user_id"` LatestRunID pgtype.Text `json:"latest_run_id"` Organization *pggen.Organizations `json:"organization"` UserLock *pggen.Users `json:"user_lock"` RunLock *pggen.Runs `json:"run_lock"` }
WorkspaceResult represents the result of a database query for a workspace.
type WorkspaceRole ¶ added in v0.0.12
type WorkspaceRole struct {
// contains filtered or unexported fields
}
WorkspaceRole is a set of permitted actions
func WorkspaceRoleFromString ¶ added in v0.0.12
func WorkspaceRoleFromString(role string) (WorkspaceRole, error)
func (WorkspaceRole) IsAllowed ¶ added in v0.0.12
func (r WorkspaceRole) IsAllowed(action Action) bool
func (WorkspaceRole) String ¶ added in v0.0.12
func (r WorkspaceRole) String() string
type WorkspaceService ¶
type WorkspaceService interface { CreateWorkspace(ctx context.Context, opts WorkspaceCreateOptions) (*Workspace, error) GetWorkspace(ctx context.Context, spec WorkspaceSpec) (*Workspace, error) ListWorkspaces(ctx context.Context, opts WorkspaceListOptions) (*WorkspaceList, error) UpdateWorkspace(ctx context.Context, spec WorkspaceSpec, opts WorkspaceUpdateOptions) (*Workspace, error) DeleteWorkspace(ctx context.Context, spec WorkspaceSpec) error WorkspaceLockService CurrentRunService WorkspacePermissionService }
type WorkspaceSpec ¶ added in v0.0.12
type WorkspaceSpec struct { // Specify workspace using its ID ID *string // Specify workspace using its name and organization Name *string `schema:"workspace_name"` OrganizationName *string `schema:"organization_name"` }
WorkspaceSpec is used for identifying an individual workspace. Either ID *or* both Name and OrganizationName must be specfiied.
func (WorkspaceSpec) LogFields ¶ added in v0.0.12
func (spec WorkspaceSpec) LogFields() (fields []interface{})
LogFields provides fields for logging
func (*WorkspaceSpec) String ¶ added in v0.0.12
func (spec *WorkspaceSpec) String() string
func (*WorkspaceSpec) Valid ¶ added in v0.0.12
func (spec *WorkspaceSpec) Valid() error
type WorkspaceStore ¶
type WorkspaceStore interface { CreateWorkspace(ctx context.Context, ws *Workspace) error GetWorkspace(ctx context.Context, spec WorkspaceSpec) (*Workspace, error) ListWorkspaces(ctx context.Context, opts WorkspaceListOptions) (*WorkspaceList, error) ListWorkspacesByUserID(ctx context.Context, userID string, organization string, opts ListOptions) (*WorkspaceList, error) UpdateWorkspace(ctx context.Context, spec WorkspaceSpec, ws func(ws *Workspace) error) (*Workspace, error) DeleteWorkspace(ctx context.Context, spec WorkspaceSpec) error GetWorkspaceID(ctx context.Context, spec WorkspaceSpec) (string, error) GetWorkspaceIDByRunID(ctx context.Context, runID string) (string, error) GetWorkspaceIDByStateVersionID(ctx context.Context, svID string) (string, error) GetWorkspaceIDByCVID(ctx context.Context, cvID string) (string, error) WorkspaceLockService CurrentRunService WorkspacePermissionService }
type WorkspaceUnlockOptions ¶ added in v0.0.12
type WorkspaceUnlockOptions struct { // Specifies the reason for locking the workspace. Reason *string `jsonapi:"attr,reason,omitempty"` // Force unlock of workspace Force bool }
WorkspaceUnlockOptions represents the options for unlocking a workspace.
type WorkspaceUpdateOptions ¶ added in v0.0.8
type WorkspaceUpdateOptions struct { AllowDestroyPlan *bool AutoApply *bool Name *string Description *string ExecutionMode *ExecutionMode `schema:"execution_mode"` FileTriggersEnabled *bool GlobalRemoteState *bool Operations *bool QueueAllRuns *bool SpeculativeEnabled *bool StructuredRunOutputEnabled *bool TerraformVersion *string `schema:"terraform_version"` TriggerPrefixes []string WorkingDirectory *string }
WorkspaceUpdateOptions represents the options for updating a workspace.
func (WorkspaceUpdateOptions) Valid ¶ added in v0.0.8
func (o WorkspaceUpdateOptions) Valid() error
Source Files
¶
- action.go
- agent.go
- agent_token.go
- apply.go
- authz.go
- cache.go
- chunk.go
- configuration_version.go
- configuration_version_unmarshaller.go
- entitlements.go
- environment.go
- errors.go
- events.go
- hcl_rewriter.go
- job_writer.go
- organization.go
- organization_unmarshaller.go
- otf.go
- pagination.go
- parse_apply_output.go
- phase.go
- plan.go
- plan_file.go
- run.go
- run_factory.go
- run_factory_test_helpers.go
- run_test_helper.go
- run_unmarshaller.go
- scheduler.go
- scheduler_exclusive.go
- scheduler_workspace_queue.go
- session.go
- state.go
- state_version.go
- state_version_output.go
- team.go
- team_unmarshaller.go
- test_helpers.go
- token.go
- unpack.go
- user.go
- user_unmarshaller.go
- version.go
- workspace.go
- workspace_factory.go
- workspace_lock.go
- workspace_role.go
- workspace_unmarshaller.go
Directories
¶
Path | Synopsis |
---|---|
Package agent provides a daemon capable of running remote operations on behalf of a user.
|
Package agent provides a daemon capable of running remote operations on behalf of a user. |
mock
Package mock provides mocks for the parent agent package
|
Package mock provides mocks for the parent agent package |
Package app implements services, co-ordinating between the layers of the project.
|
Package app implements services, co-ordinating between the layers of the project. |
Package cmd provides CLI functionality.
|
Package cmd provides CLI functionality. |
Package http provides an HTTP interface allowing HTTP clients to interact with OTF.
|
Package http provides an HTTP interface allowing HTTP clients to interact with OTF. |
decode
Package decode contains decoders for various HTTP artefacts
|
Package decode contains decoders for various HTTP artefacts |
dto
Package dto provides DTO models for serialization/deserialization to/from JSON-API
|
Package dto provides DTO models for serialization/deserialization to/from JSON-API |
html
Package html provides the otf web app, serving up HTML formatted pages and associated assets (CSS, JS, etc).
|
Package html provides the otf web app, serving up HTML formatted pages and associated assets (CSS, JS, etc). |
Package inmem implements a layer of services in memory using purely Go constructs.
|
Package inmem implements a layer of services in memory using purely Go constructs. |
Package sql implements persistent storage using the sql database.
|
Package sql implements persistent storage using the sql database. |