mock

package
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2021 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package mock implements mocked services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOrganization

func NewOrganization(name, email string) *otf.Organization

func NewOrganizationList

func NewOrganizationList(name, email string, opts otf.OrganizationListOptions) *otf.OrganizationList

func NewWorkspace

func NewWorkspace(name, id, org string) *otf.Workspace

func NewWorkspaceList

func NewWorkspaceList(name, id, org string, opts otf.WorkspaceListOptions) *otf.WorkspaceList

Types

type ConfigurationVersionService

type ConfigurationVersionService struct {
	CreateFn    func(workspaceID string, opts otf.ConfigurationVersionCreateOptions) (*otf.ConfigurationVersion, error)
	GetFn       func(id string) (*otf.ConfigurationVersion, error)
	GetLatestFn func(workspaceID string) (*otf.ConfigurationVersion, error)
	ListFn      func(workspaceID string, opts otf.ConfigurationVersionListOptions) (*otf.ConfigurationVersionList, error)
	UploadFn    func(id string, payload []byte) error
	DownloadFn  func(id string) ([]byte, error)
}

func (ConfigurationVersionService) Create

func (ConfigurationVersionService) Download

func (s ConfigurationVersionService) Download(id string) ([]byte, error)

func (ConfigurationVersionService) Get

func (ConfigurationVersionService) GetLatest

func (s ConfigurationVersionService) GetLatest(workspaceID string) (*otf.ConfigurationVersion, error)

func (ConfigurationVersionService) List

func (ConfigurationVersionService) Upload

func (s ConfigurationVersionService) Upload(id string, payload []byte) error

type EventService

type EventService struct {
	PublishFn   func(event otf.Event)
	SubscribeFn func(id string) otf.Subscription
}

func (EventService) Publish

func (s EventService) Publish(event otf.Event)

func (EventService) Subscribe

func (s EventService) Subscribe(id string) (otf.Subscription, error)

type OrganizationService

type OrganizationService struct {
	CreateOrganizationFn func(opts otf.OrganizationCreateOptions) (*otf.Organization, error)
	UpdateOrganizationFn func(name string, opts *otf.OrganizationUpdateOptions) (*otf.Organization, error)
	GetOrganizationFn    func(name string) (*otf.Organization, error)
	ListOrganizationFn   func(opts otf.OrganizationListOptions) (*otf.OrganizationList, error)
	DeleteOrganizationFn func(name string) error
	GetEntitlementsFn    func(name string) (*otf.Entitlements, error)
}

func (OrganizationService) Create

func (OrganizationService) Delete

func (s OrganizationService) Delete(name string) error

func (OrganizationService) Get

func (OrganizationService) GetEntitlements

func (s OrganizationService) GetEntitlements(name string) (*otf.Entitlements, error)

func (OrganizationService) List

func (OrganizationService) Update

type PlanService

type PlanService struct {
	GetFn         func(id string) (*otf.Plan, error)
	GetPlanJSONFn func(id string) ([]byte, error)
	StartFn       func(ctx context.Context, id string, opts otf.JobStartOptions) (*otf.Run, error)
	FinishFn      func(ctx context.Context, id string, opts otf.JobFinishOptions) (*otf.Run, error)
	GetChunkFn    func(ctx context.Context, id string, opts otf.GetChunkOptions) ([]byte, error)
	PutChunkFn    func(ctx context.Context, id string, chunk []byte, opts otf.PutChunkOptions) error
}

func (PlanService) Finish added in v0.0.8

func (s PlanService) Finish(ctx context.Context, id string, opts otf.JobFinishOptions) (*otf.Run, error)

func (PlanService) Get

func (s PlanService) Get(id string) (*otf.Plan, error)

func (PlanService) GetChunk added in v0.0.8

func (s PlanService) GetChunk(ctx context.Context, id string, opts otf.GetChunkOptions) ([]byte, error)

func (PlanService) GetPlanJSON

func (s PlanService) GetPlanJSON(id string) ([]byte, error)

func (PlanService) PutChunk added in v0.0.8

func (s PlanService) PutChunk(ctx context.Context, id string, chunk []byte, opts otf.PutChunkOptions) error

func (PlanService) Start added in v0.0.8

func (s PlanService) Start(ctx context.Context, id string, opts otf.JobStartOptions) (*otf.Run, error)

type Queue

type Queue struct {
	Runs []*otf.Run
}

func (*Queue) Add

func (q *Queue) Add(run *otf.Run) error

func (*Queue) Remove

func (q *Queue) Remove(run *otf.Run) error

type RunService

type RunService struct {
	CreateFn         func(ctx context.Context, opts otf.RunCreateOptions) (*otf.Run, error)
	GetFn            func(id string) (*otf.Run, error)
	ListFn           func(opts otf.RunListOptions) (*otf.RunList, error)
	ApplyFn          func(id string, opts otf.RunApplyOptions) error
	DiscardFn        func(id string, opts otf.RunDiscardOptions) error
	CancelFn         func(id string, opts otf.RunCancelOptions) error
	ForceCancelFn    func(id string, opts otf.RunForceCancelOptions) error
	GetPlanLogsFn    func(id string, opts otf.GetChunkOptions) ([]byte, error)
	GetApplyLogsFn   func(id string, opts otf.GetChunkOptions) ([]byte, error)
	EnqueuePlanFn    func(id string) error
	UpdateStatusFn   func(id string, status otf.RunStatus) (*otf.Run, error)
	StartFn          func(id string, opts otf.JobStartOptions) (otf.Job, error)
	FinishFn         func(id string, opts otf.JobFinishOptions) (otf.Job, error)
	GetPlanFileFn    func(ctx context.Context, id string, opts otf.PlanFileOptions) ([]byte, error)
	UploadPlanFileFn func(ctx context.Context, id string, plan []byte, opts otf.PlanFileOptions) error
}

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

func (RunService) Create

func (s RunService) Create(ctx context.Context, opts otf.RunCreateOptions) (*otf.Run, error)

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) Finish

func (s RunService) Finish(id string, opts otf.JobFinishOptions) (otf.Job, 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)

func (RunService) GetApplyLogs

func (s RunService) GetApplyLogs(id string, opts otf.GetChunkOptions) ([]byte, error)

func (RunService) GetPlanFile

func (s RunService) GetPlanFile(ctx context.Context, id string, opts otf.PlanFileOptions) ([]byte, error)

func (RunService) GetPlanLogs

func (s RunService) GetPlanLogs(id string, opts otf.GetChunkOptions) ([]byte, error)

func (RunService) List

func (s RunService) List(opts otf.RunListOptions) (*otf.RunList, error)

func (RunService) Start

func (s RunService) Start(id string, opts otf.JobStartOptions) (otf.Job, error)

func (RunService) UpdateStatus

func (s RunService) UpdateStatus(id string, status otf.RunStatus) (*otf.Run, error)

func (RunService) UploadPlanFile added in v0.0.8

func (s RunService) UploadPlanFile(ctx context.Context, id string, plan []byte, opts otf.PlanFileOptions) error

type StateVersionService

type StateVersionService struct {
	CreateFn   func(workspaceID string, opts otf.StateVersionCreateOptions) (*otf.StateVersion, error)
	CurrentFn  func(workspaceID string) (*otf.StateVersion, error)
	GetFn      func(id string) (*otf.StateVersion, error)
	DownloadFn func(id string) ([]byte, error)
	ListFn     func(opts otf.StateVersionListOptions) (*otf.StateVersionList, error)
}

func (StateVersionService) Create

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 (StateVersionService) List

type WorkspaceService

type WorkspaceService struct {
	CreateWorkspaceFn func(org string, opts otf.WorkspaceCreateOptions) (*otf.Workspace, error)
	UpdateWorkspaceFn func(spec otf.WorkspaceSpecifier, opts otf.WorkspaceUpdateOptions) (*otf.Workspace, error)
	GetWorkspaceFn    func(spec otf.WorkspaceSpecifier) (*otf.Workspace, error)
	ListWorkspaceFn   func(opts otf.WorkspaceListOptions) (*otf.WorkspaceList, error)
	DeleteWorkspaceFn func(spec otf.WorkspaceSpecifier) error
	LockWorkspaceFn   func(id string, opts otf.WorkspaceLockOptions) (*otf.Workspace, error)
	UnlockWorkspaceFn func(id string) (*otf.Workspace, error)
}

func (WorkspaceService) Create

func (WorkspaceService) Delete

func (WorkspaceService) Get

func (WorkspaceService) List

func (WorkspaceService) Lock

func (WorkspaceService) Unlock

func (s WorkspaceService) Unlock(ctx context.Context, id string) (*otf.Workspace, error)

func (WorkspaceService) Update

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL