Documentation
¶
Overview ¶
Package app implements services, co-ordinating between the layers of the project.
Index ¶
- type ApplyService
- func (s ApplyService) Finish(ctx context.Context, id string, opts otf.JobFinishOptions) (*otf.Run, error)
- func (s ApplyService) Get(id string) (*otf.Apply, error)
- func (s ApplyService) GetChunk(ctx context.Context, id string, opts otf.GetChunkOptions) ([]byte, error)
- func (s ApplyService) PutChunk(ctx context.Context, id string, chunk []byte, opts otf.PutChunkOptions) error
- func (s ApplyService) Start(ctx context.Context, id string, opts otf.JobStartOptions) (*otf.Run, error)
- type ConfigurationVersionService
- func (s ConfigurationVersionService) Create(workspaceID string, opts otf.ConfigurationVersionCreateOptions) (*otf.ConfigurationVersion, error)
- func (s ConfigurationVersionService) Download(id string) ([]byte, error)
- func (s ConfigurationVersionService) Get(id string) (*otf.ConfigurationVersion, error)
- func (s ConfigurationVersionService) GetLatest(workspaceID string) (*otf.ConfigurationVersion, error)
- func (s ConfigurationVersionService) List(workspaceID string, opts otf.ConfigurationVersionListOptions) (*otf.ConfigurationVersionList, error)
- func (s ConfigurationVersionService) Upload(id string, config []byte) error
- type OrganizationService
- func (s OrganizationService) Create(ctx context.Context, opts otf.OrganizationCreateOptions) (*otf.Organization, error)
- func (s OrganizationService) Delete(name string) error
- func (s OrganizationService) Get(name string) (*otf.Organization, error)
- func (s OrganizationService) GetEntitlements(name string) (*otf.Entitlements, error)
- func (s OrganizationService) List(opts otf.OrganizationListOptions) (*otf.OrganizationList, error)
- func (s OrganizationService) Update(name string, opts *otf.OrganizationUpdateOptions) (*otf.Organization, error)
- type PlanService
- func (s PlanService) Finish(ctx context.Context, id string, opts otf.JobFinishOptions) (*otf.Run, error)
- func (s PlanService) Get(id string) (*otf.Plan, error)
- func (s PlanService) GetChunk(ctx context.Context, id string, opts otf.GetChunkOptions) ([]byte, error)
- func (s PlanService) GetPlanJSON(id string) ([]byte, error)
- func (s PlanService) PutChunk(ctx context.Context, id string, chunk []byte, opts otf.PutChunkOptions) error
- func (s PlanService) Start(ctx context.Context, id string, opts otf.JobStartOptions) (*otf.Run, error)
- type RunService
- func (s RunService) Apply(id string, opts otf.RunApplyOptions) error
- func (s RunService) Cancel(id string, opts otf.RunCancelOptions) error
- func (s RunService) Create(ctx context.Context, opts otf.RunCreateOptions) (*otf.Run, error)
- func (s RunService) Discard(id string, opts otf.RunDiscardOptions) error
- func (s RunService) EnqueuePlan(id string) error
- func (s RunService) ForceCancel(id string, opts otf.RunForceCancelOptions) error
- func (s RunService) Get(id string) (*otf.Run, error)
- func (s RunService) GetPlanFile(ctx context.Context, runID string, opts otf.PlanFileOptions) ([]byte, error)
- func (s RunService) List(opts otf.RunListOptions) (*otf.RunList, error)
- func (s RunService) UploadPlanFile(ctx context.Context, id string, plan []byte, opts otf.PlanFileOptions) error
- func (s RunService) UploadPlanJSON(ctx context.Context, id string, plan []byte) error
- type StateVersionService
- func (s StateVersionService) Create(workspaceID string, opts otf.StateVersionCreateOptions) (*otf.StateVersion, error)
- func (s StateVersionService) Current(workspaceID string) (*otf.StateVersion, error)
- func (s StateVersionService) Download(id string) ([]byte, error)
- func (s StateVersionService) Get(id string) (*otf.StateVersion, error)
- func (s StateVersionService) List(opts otf.StateVersionListOptions) (*otf.StateVersionList, error)
- type WorkspaceService
- func (s WorkspaceService) Create(ctx context.Context, orgName string, opts otf.WorkspaceCreateOptions) (*otf.Workspace, error)
- func (s WorkspaceService) Delete(ctx context.Context, spec otf.WorkspaceSpecifier) error
- func (s WorkspaceService) Get(ctx context.Context, spec otf.WorkspaceSpecifier) (*otf.Workspace, error)
- func (s WorkspaceService) List(ctx context.Context, opts otf.WorkspaceListOptions) (*otf.WorkspaceList, error)
- func (s WorkspaceService) Lock(ctx context.Context, id string, _ otf.WorkspaceLockOptions) (*otf.Workspace, error)
- func (s WorkspaceService) Unlock(ctx context.Context, id string) (*otf.Workspace, error)
- func (s WorkspaceService) Update(ctx context.Context, spec otf.WorkspaceSpecifier, ...) (*otf.Workspace, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplyService ¶
type ApplyService struct {
otf.EventService
logr.Logger
// contains filtered or unexported fields
}
func NewApplyService ¶
func NewApplyService(db otf.RunStore, logs otf.ChunkStore, logger logr.Logger, es otf.EventService) *ApplyService
func (ApplyService) Finish ¶ added in v0.0.8
func (s ApplyService) Finish(ctx context.Context, id string, opts otf.JobFinishOptions) (*otf.Run, error)
Finish marks a apply as having finished. An event is emitted to notify any subscribers of the new state.
func (ApplyService) GetChunk ¶ added in v0.0.8
func (s ApplyService) GetChunk(ctx context.Context, id string, opts otf.GetChunkOptions) ([]byte, error)
GetChunk reads a chunk of logs for a terraform apply.
func (ApplyService) PutChunk ¶ added in v0.0.8
func (s ApplyService) PutChunk(ctx context.Context, id string, chunk []byte, opts otf.PutChunkOptions) error
PutChunk writes a chunk of logs for a terraform apply.
type ConfigurationVersionService ¶
type ConfigurationVersionService struct {
logr.Logger
*otf.ConfigurationVersionFactory
// contains filtered or unexported fields
}
func NewConfigurationVersionService ¶
func NewConfigurationVersionService(db otf.ConfigurationVersionStore, logger logr.Logger, wss otf.WorkspaceService) *ConfigurationVersionService
func (ConfigurationVersionService) Create ¶
func (s ConfigurationVersionService) Create(workspaceID string, opts otf.ConfigurationVersionCreateOptions) (*otf.ConfigurationVersion, error)
func (ConfigurationVersionService) Download ¶
func (s ConfigurationVersionService) Download(id string) ([]byte, error)
func (ConfigurationVersionService) Get ¶
func (s ConfigurationVersionService) Get(id string) (*otf.ConfigurationVersion, error)
func (ConfigurationVersionService) GetLatest ¶
func (s ConfigurationVersionService) GetLatest(workspaceID string) (*otf.ConfigurationVersion, error)
func (ConfigurationVersionService) List ¶
func (s ConfigurationVersionService) List(workspaceID string, opts otf.ConfigurationVersionListOptions) (*otf.ConfigurationVersionList, error)
type OrganizationService ¶
func NewOrganizationService ¶
func NewOrganizationService(db otf.OrganizationStore, logger logr.Logger, es otf.EventService) *OrganizationService
func (OrganizationService) Create ¶
func (s OrganizationService) Create(ctx context.Context, opts otf.OrganizationCreateOptions) (*otf.Organization, error)
func (OrganizationService) Delete ¶
func (s OrganizationService) Delete(name string) error
func (OrganizationService) Get ¶
func (s OrganizationService) Get(name string) (*otf.Organization, error)
func (OrganizationService) GetEntitlements ¶
func (s OrganizationService) GetEntitlements(name string) (*otf.Entitlements, error)
func (OrganizationService) List ¶
func (s OrganizationService) List(opts otf.OrganizationListOptions) (*otf.OrganizationList, error)
func (OrganizationService) Update ¶
func (s OrganizationService) Update(name string, opts *otf.OrganizationUpdateOptions) (*otf.Organization, error)
type PlanService ¶
type PlanService struct {
otf.EventService
logr.Logger
// contains filtered or unexported fields
}
func NewPlanService ¶
func NewPlanService(db otf.RunStore, logs otf.ChunkStore, logger logr.Logger, es otf.EventService) *PlanService
func (PlanService) Finish ¶ added in v0.0.8
func (s PlanService) Finish(ctx context.Context, id string, opts otf.JobFinishOptions) (*otf.Run, error)
Finish marks a plan as having finished. An event is emitted to notify any subscribers of the new state.
func (PlanService) GetChunk ¶ added in v0.0.8
func (s PlanService) GetChunk(ctx context.Context, id string, opts otf.GetChunkOptions) ([]byte, error)
GetChunk reads a chunk of logs for a terraform plan.
func (PlanService) GetPlanJSON ¶
func (s PlanService) GetPlanJSON(id string) ([]byte, error)
GetPlanJSON returns the JSON formatted plan file for the plan.
func (PlanService) PutChunk ¶ added in v0.0.8
func (s PlanService) PutChunk(ctx context.Context, id string, chunk []byte, opts otf.PutChunkOptions) error
PutChunk writes a chunk of logs for a terraform plan.
type RunService ¶
type RunService struct {
logr.Logger
*otf.RunFactory
// contains filtered or unexported fields
}
func NewRunService ¶
func NewRunService(db otf.RunStore, logger logr.Logger, wss otf.WorkspaceService, cvs otf.ConfigurationVersionService, es otf.EventService) *RunService
func (RunService) Apply ¶
func (s RunService) Apply(id string, opts otf.RunApplyOptions) error
func (RunService) Cancel ¶
func (s RunService) Cancel(id string, opts otf.RunCancelOptions) error
Cancel enqueues a cancel request to cancel a currently queued or active plan or apply.
func (RunService) Create ¶
func (s RunService) Create(ctx context.Context, opts otf.RunCreateOptions) (*otf.Run, error)
Create constructs and persists a new run object to the db, before scheduling the run.
func (RunService) Discard ¶
func (s RunService) Discard(id string, opts otf.RunDiscardOptions) error
func (RunService) EnqueuePlan ¶
func (s RunService) EnqueuePlan(id string) error
func (RunService) ForceCancel ¶
func (s RunService) ForceCancel(id string, opts otf.RunForceCancelOptions) error
func (RunService) Get ¶
func (s RunService) Get(id string) (*otf.Run, error)
Get retrieves a run obj with the given ID from the db.
func (RunService) GetPlanFile ¶
func (s RunService) GetPlanFile(ctx context.Context, runID string, opts otf.PlanFileOptions) ([]byte, error)
GetPlanFile returns the plan file for the run.
func (RunService) List ¶
func (s RunService) List(opts otf.RunListOptions) (*otf.RunList, error)
List retrieves multiple run objs. Use opts to filter and paginate the list.
func (RunService) UploadPlanFile ¶ added in v0.0.8
func (s RunService) UploadPlanFile(ctx context.Context, id string, plan []byte, opts otf.PlanFileOptions) error
UploadPlanFile persists a run's plan file. The plan file is expected to have been produced using `terraform plan`. If the plan file is JSON serialized then its parsed for a summary of planned changes and the Plan object is updated accordingly.
func (RunService) UploadPlanJSON ¶ added in v0.0.8
UploadPlanJSON persists a run's JSON-formatted plan file before parsing it and updating the Run's Plan with a summary of planned resource changes. The plan file is expected to have been produced using `terraform show -json plan_file`.
type StateVersionService ¶
type StateVersionService struct {
*otf.StateVersionFactory
logr.Logger
// contains filtered or unexported fields
}
func NewStateVersionService ¶
func NewStateVersionService(db otf.StateVersionStore, logger logr.Logger, wss otf.WorkspaceService) *StateVersionService
func (StateVersionService) Create ¶
func (s StateVersionService) Create(workspaceID string, opts otf.StateVersionCreateOptions) (*otf.StateVersion, error)
func (StateVersionService) Current ¶
func (s StateVersionService) Current(workspaceID string) (*otf.StateVersion, error)
func (StateVersionService) Download ¶
func (s StateVersionService) Download(id string) ([]byte, error)
func (StateVersionService) Get ¶
func (s StateVersionService) Get(id string) (*otf.StateVersion, error)
func (StateVersionService) List ¶
func (s StateVersionService) List(opts otf.StateVersionListOptions) (*otf.StateVersionList, error)
type WorkspaceService ¶
func NewWorkspaceService ¶
func NewWorkspaceService(db otf.WorkspaceStore, logger logr.Logger, os otf.OrganizationService, es otf.EventService) *WorkspaceService
func (WorkspaceService) Create ¶
func (s WorkspaceService) Create(ctx context.Context, orgName string, opts otf.WorkspaceCreateOptions) (*otf.Workspace, error)
func (WorkspaceService) Delete ¶
func (s WorkspaceService) Delete(ctx context.Context, spec otf.WorkspaceSpecifier) error
func (WorkspaceService) Get ¶
func (s WorkspaceService) Get(ctx context.Context, spec otf.WorkspaceSpecifier) (*otf.Workspace, error)
func (WorkspaceService) List ¶
func (s WorkspaceService) List(ctx context.Context, opts otf.WorkspaceListOptions) (*otf.WorkspaceList, error)
func (WorkspaceService) Lock ¶
func (s WorkspaceService) Lock(ctx context.Context, id string, _ otf.WorkspaceLockOptions) (*otf.Workspace, error)
func (WorkspaceService) Update ¶
func (s WorkspaceService) Update(ctx context.Context, spec otf.WorkspaceSpecifier, opts otf.WorkspaceUpdateOptions) (*otf.Workspace, error)