Documentation ¶
Index ¶
- Variables
- type ArtifactStore
- type CreateConfigurationVersionInput
- type Event
- type EventSubscriptionOptions
- type GetStateVersionsInput
- type GetWorkspacesInput
- type MockArtifactStore
- func (_m *MockArtifactStore) DownloadConfigurationVersion(ctx context.Context, configurationVersion *models.ConfigurationVersion, ...) error
- func (_m *MockArtifactStore) DownloadPlanCache(ctx context.Context, run *models.Run, writer io.WriterAt) error
- func (_m *MockArtifactStore) DownloadStateVersion(ctx context.Context, stateVersion *models.StateVersion, writer io.WriterAt) error
- func (_m *MockArtifactStore) GetConfigurationVersion(ctx context.Context, configurationVersion *models.ConfigurationVersion) (io.ReadCloser, error)
- func (_m *MockArtifactStore) GetPlanCache(ctx context.Context, run *models.Run) (io.ReadCloser, error)
- func (_m *MockArtifactStore) GetRunVariables(ctx context.Context, run *models.Run) (io.ReadCloser, error)
- func (_m *MockArtifactStore) GetStateVersion(ctx context.Context, stateVersion *models.StateVersion) (io.ReadCloser, error)
- func (_m *MockArtifactStore) UploadConfigurationVersion(ctx context.Context, configurationVersion *models.ConfigurationVersion, ...) error
- func (_m *MockArtifactStore) UploadPlanCache(ctx context.Context, run *models.Run, body io.Reader) error
- func (_m *MockArtifactStore) UploadRunVariables(ctx context.Context, run *models.Run, body io.Reader) error
- func (_m *MockArtifactStore) UploadStateVersion(ctx context.Context, stateVersion *models.StateVersion, body io.Reader) error
- type MockService
- func (_m *MockService) CreateConfigurationVersion(ctx context.Context, options *CreateConfigurationVersionInput) (*models.ConfigurationVersion, error)
- func (_m *MockService) CreateStateVersion(ctx context.Context, stateVersion *models.StateVersion, data *string) (*models.StateVersion, error)
- func (_m *MockService) CreateWorkspace(ctx context.Context, workspace *models.Workspace) (*models.Workspace, error)
- func (_m *MockService) DeleteWorkspace(ctx context.Context, workspace *models.Workspace, force bool) error
- func (_m *MockService) GetConfigurationVersion(ctx context.Context, configurationVersionID string) (*models.ConfigurationVersion, error)
- func (_m *MockService) GetConfigurationVersionContent(ctx context.Context, configurationVersionID string) (io.ReadCloser, error)
- func (_m *MockService) GetConfigurationVersionsByIDs(ctx context.Context, idList []string) ([]models.ConfigurationVersion, error)
- func (_m *MockService) GetCurrentStateVersion(ctx context.Context, workspaceID string) (*models.StateVersion, error)
- func (_m *MockService) GetStateVersion(ctx context.Context, stateVersionID string) (*models.StateVersion, error)
- func (_m *MockService) GetStateVersionContent(ctx context.Context, stateVersionID string) (io.ReadCloser, error)
- func (_m *MockService) GetStateVersionDependencies(ctx context.Context, stateVersion *models.StateVersion) ([]StateVersionDependency, error)
- func (_m *MockService) GetStateVersionOutputs(_a0 context.Context, stateVersionID string) ([]models.StateVersionOutput, error)
- func (_m *MockService) GetStateVersionResources(ctx context.Context, stateVersion *models.StateVersion) ([]StateVersionResource, error)
- func (_m *MockService) GetStateVersions(ctx context.Context, input *GetStateVersionsInput) (*db.StateVersionsResult, error)
- func (_m *MockService) GetStateVersionsByIDs(ctx context.Context, idList []string) ([]models.StateVersion, error)
- func (_m *MockService) GetWorkspaceByFullPath(ctx context.Context, path string) (*models.Workspace, error)
- func (_m *MockService) GetWorkspaceByID(ctx context.Context, id string) (*models.Workspace, error)
- func (_m *MockService) GetWorkspaces(ctx context.Context, input *GetWorkspacesInput) (*db.WorkspacesResult, error)
- func (_m *MockService) GetWorkspacesByIDs(ctx context.Context, idList []string) ([]models.Workspace, error)
- func (_m *MockService) LockWorkspace(ctx context.Context, workspace *models.Workspace) (*models.Workspace, error)
- func (_m *MockService) SubscribeToWorkspaceEvents(ctx context.Context, options *EventSubscriptionOptions) (<-chan *Event, error)
- func (_m *MockService) UnlockWorkspace(ctx context.Context, workspace *models.Workspace) (*models.Workspace, error)
- func (_m *MockService) UpdateWorkspace(ctx context.Context, workspace *models.Workspace) (*models.Workspace, error)
- func (_m *MockService) UploadConfigurationVersion(ctx context.Context, configurationVersionID string, reader io.Reader) error
- type Service
- type StateVersionDependency
- type StateVersionResource
Constants ¶
This section is empty.
Variables ¶
var ( // Error returned when workspace is already locked. WorkspaceLockedError = errors.NewError(errors.EConflict, "workspace locked") // Error returned when workspace is already unlocked. WorkspaceUnlockedError = errors.NewError(errors.EConflict, "workspace unlocked") // Error returned when a workspace unlock is attempted but it's locked by a run. WorkspaceLockedByRunError = errors.NewError(errors.EConflict, "workspace locked by run") )
These error messages must be translated to TFE equivalent by caller.
Functions ¶
This section is empty.
Types ¶
type ArtifactStore ¶
type ArtifactStore interface { DownloadConfigurationVersion(ctx context.Context, configurationVersion *models.ConfigurationVersion, writer io.WriterAt) error UploadConfigurationVersion(ctx context.Context, configurationVersion *models.ConfigurationVersion, body io.Reader) error GetConfigurationVersion(ctx context.Context, configurationVersion *models.ConfigurationVersion) (io.ReadCloser, error) DownloadStateVersion(ctx context.Context, stateVersion *models.StateVersion, writer io.WriterAt) error GetStateVersion(ctx context.Context, stateVersion *models.StateVersion) (io.ReadCloser, error) UploadStateVersion(ctx context.Context, stateVersion *models.StateVersion, body io.Reader) error DownloadPlanCache(ctx context.Context, run *models.Run, writer io.WriterAt) error UploadPlanCache(ctx context.Context, run *models.Run, body io.Reader) error GetPlanCache(ctx context.Context, run *models.Run) (io.ReadCloser, error) UploadRunVariables(ctx context.Context, run *models.Run, body io.Reader) error GetRunVariables(ctx context.Context, run *models.Run) (io.ReadCloser, error) }
ArtifactStore interface encapsulates the logic for saving workspace artifacts
func NewArtifactStore ¶
func NewArtifactStore(objectStore objectstore.ObjectStore) ArtifactStore
NewArtifactStore creates an instance of the ArtifactStore interface
type CreateConfigurationVersionInput ¶
type CreateConfigurationVersionInput struct { VCSEventID *string WorkspaceID string Speculative bool }
CreateConfigurationVersionInput is the input for creating a new configuration version
type EventSubscriptionOptions ¶
type EventSubscriptionOptions struct {
WorkspaceID string
}
EventSubscriptionOptions provides options for subscribing to workspace events
type GetStateVersionsInput ¶
type GetStateVersionsInput struct { // Sort specifies the field to sort on and direction Sort *db.StateVersionSortableField // PaginationOptions supports cursor based pagination PaginationOptions *db.PaginationOptions // Workspace filters state versions by the specified workspace Workspace *models.Workspace }
GetStateVersionsInput is the input for querying a list of state versions
type GetWorkspacesInput ¶
type GetWorkspacesInput struct { // Sort specifies the field to sort on and direction Sort *db.WorkspaceSortableField // PaginationOptions supports cursor based pagination PaginationOptions *db.PaginationOptions // Group filters the workspaces by the specified group Group *models.Group // Search is used to search for a workspace by name or namespace path Search *string }
GetWorkspacesInput is the input for querying a list of workspaces
type MockArtifactStore ¶
MockArtifactStore is an autogenerated mock type for the ArtifactStore type
func NewMockArtifactStore ¶
func NewMockArtifactStore(t mockConstructorTestingTNewMockArtifactStore) *MockArtifactStore
NewMockArtifactStore creates a new instance of MockArtifactStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*MockArtifactStore) DownloadConfigurationVersion ¶
func (_m *MockArtifactStore) DownloadConfigurationVersion(ctx context.Context, configurationVersion *models.ConfigurationVersion, writer io.WriterAt) error
DownloadConfigurationVersion provides a mock function with given fields: ctx, configurationVersion, writer
func (*MockArtifactStore) DownloadPlanCache ¶
func (_m *MockArtifactStore) DownloadPlanCache(ctx context.Context, run *models.Run, writer io.WriterAt) error
DownloadPlanCache provides a mock function with given fields: ctx, run, writer
func (*MockArtifactStore) DownloadStateVersion ¶
func (_m *MockArtifactStore) DownloadStateVersion(ctx context.Context, stateVersion *models.StateVersion, writer io.WriterAt) error
DownloadStateVersion provides a mock function with given fields: ctx, stateVersion, writer
func (*MockArtifactStore) GetConfigurationVersion ¶
func (_m *MockArtifactStore) GetConfigurationVersion(ctx context.Context, configurationVersion *models.ConfigurationVersion) (io.ReadCloser, error)
GetConfigurationVersion provides a mock function with given fields: ctx, configurationVersion
func (*MockArtifactStore) GetPlanCache ¶
func (_m *MockArtifactStore) GetPlanCache(ctx context.Context, run *models.Run) (io.ReadCloser, error)
GetPlanCache provides a mock function with given fields: ctx, run
func (*MockArtifactStore) GetRunVariables ¶
func (_m *MockArtifactStore) GetRunVariables(ctx context.Context, run *models.Run) (io.ReadCloser, error)
GetRunVariables provides a mock function with given fields: ctx, run
func (*MockArtifactStore) GetStateVersion ¶
func (_m *MockArtifactStore) GetStateVersion(ctx context.Context, stateVersion *models.StateVersion) (io.ReadCloser, error)
GetStateVersion provides a mock function with given fields: ctx, stateVersion
func (*MockArtifactStore) UploadConfigurationVersion ¶
func (_m *MockArtifactStore) UploadConfigurationVersion(ctx context.Context, configurationVersion *models.ConfigurationVersion, body io.Reader) error
UploadConfigurationVersion provides a mock function with given fields: ctx, configurationVersion, body
func (*MockArtifactStore) UploadPlanCache ¶
func (_m *MockArtifactStore) UploadPlanCache(ctx context.Context, run *models.Run, body io.Reader) error
UploadPlanCache provides a mock function with given fields: ctx, run, body
func (*MockArtifactStore) UploadRunVariables ¶
func (_m *MockArtifactStore) UploadRunVariables(ctx context.Context, run *models.Run, body io.Reader) error
UploadRunVariables provides a mock function with given fields: ctx, run, body
func (*MockArtifactStore) UploadStateVersion ¶
func (_m *MockArtifactStore) UploadStateVersion(ctx context.Context, stateVersion *models.StateVersion, body io.Reader) error
UploadStateVersion provides a mock function with given fields: ctx, stateVersion, body
type MockService ¶
MockService is an autogenerated mock type for the Service type
func NewMockService ¶
func NewMockService(t mockConstructorTestingTNewMockService) *MockService
NewMockService creates a new instance of MockService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*MockService) CreateConfigurationVersion ¶
func (_m *MockService) CreateConfigurationVersion(ctx context.Context, options *CreateConfigurationVersionInput) (*models.ConfigurationVersion, error)
CreateConfigurationVersion provides a mock function with given fields: ctx, options
func (*MockService) CreateStateVersion ¶
func (_m *MockService) CreateStateVersion(ctx context.Context, stateVersion *models.StateVersion, data *string) (*models.StateVersion, error)
CreateStateVersion provides a mock function with given fields: ctx, stateVersion, data
func (*MockService) CreateWorkspace ¶
func (_m *MockService) CreateWorkspace(ctx context.Context, workspace *models.Workspace) (*models.Workspace, error)
CreateWorkspace provides a mock function with given fields: ctx, workspace
func (*MockService) DeleteWorkspace ¶
func (_m *MockService) DeleteWorkspace(ctx context.Context, workspace *models.Workspace, force bool) error
DeleteWorkspace provides a mock function with given fields: ctx, workspace, force
func (*MockService) GetConfigurationVersion ¶
func (_m *MockService) GetConfigurationVersion(ctx context.Context, configurationVersionID string) (*models.ConfigurationVersion, error)
GetConfigurationVersion provides a mock function with given fields: ctx, configurationVersionID
func (*MockService) GetConfigurationVersionContent ¶
func (_m *MockService) GetConfigurationVersionContent(ctx context.Context, configurationVersionID string) (io.ReadCloser, error)
GetConfigurationVersionContent provides a mock function with given fields: ctx, configurationVersionID
func (*MockService) GetConfigurationVersionsByIDs ¶
func (_m *MockService) GetConfigurationVersionsByIDs(ctx context.Context, idList []string) ([]models.ConfigurationVersion, error)
GetConfigurationVersionsByIDs provides a mock function with given fields: ctx, idList
func (*MockService) GetCurrentStateVersion ¶
func (_m *MockService) GetCurrentStateVersion(ctx context.Context, workspaceID string) (*models.StateVersion, error)
GetCurrentStateVersion provides a mock function with given fields: ctx, workspaceID
func (*MockService) GetStateVersion ¶
func (_m *MockService) GetStateVersion(ctx context.Context, stateVersionID string) (*models.StateVersion, error)
GetStateVersion provides a mock function with given fields: ctx, stateVersionID
func (*MockService) GetStateVersionContent ¶
func (_m *MockService) GetStateVersionContent(ctx context.Context, stateVersionID string) (io.ReadCloser, error)
GetStateVersionContent provides a mock function with given fields: ctx, stateVersionID
func (*MockService) GetStateVersionDependencies ¶
func (_m *MockService) GetStateVersionDependencies(ctx context.Context, stateVersion *models.StateVersion) ([]StateVersionDependency, error)
GetStateVersionDependencies provides a mock function with given fields: ctx, stateVersion
func (*MockService) GetStateVersionOutputs ¶
func (_m *MockService) GetStateVersionOutputs(_a0 context.Context, stateVersionID string) ([]models.StateVersionOutput, error)
GetStateVersionOutputs provides a mock function with given fields: _a0, stateVersionID
func (*MockService) GetStateVersionResources ¶
func (_m *MockService) GetStateVersionResources(ctx context.Context, stateVersion *models.StateVersion) ([]StateVersionResource, error)
GetStateVersionResources provides a mock function with given fields: ctx, stateVersion
func (*MockService) GetStateVersions ¶
func (_m *MockService) GetStateVersions(ctx context.Context, input *GetStateVersionsInput) (*db.StateVersionsResult, error)
GetStateVersions provides a mock function with given fields: ctx, input
func (*MockService) GetStateVersionsByIDs ¶
func (_m *MockService) GetStateVersionsByIDs(ctx context.Context, idList []string) ([]models.StateVersion, error)
GetStateVersionsByIDs provides a mock function with given fields: ctx, idList
func (*MockService) GetWorkspaceByFullPath ¶
func (_m *MockService) GetWorkspaceByFullPath(ctx context.Context, path string) (*models.Workspace, error)
GetWorkspaceByFullPath provides a mock function with given fields: ctx, path
func (*MockService) GetWorkspaceByID ¶
GetWorkspaceByID provides a mock function with given fields: ctx, id
func (*MockService) GetWorkspaces ¶
func (_m *MockService) GetWorkspaces(ctx context.Context, input *GetWorkspacesInput) (*db.WorkspacesResult, error)
GetWorkspaces provides a mock function with given fields: ctx, input
func (*MockService) GetWorkspacesByIDs ¶
func (_m *MockService) GetWorkspacesByIDs(ctx context.Context, idList []string) ([]models.Workspace, error)
GetWorkspacesByIDs provides a mock function with given fields: ctx, idList
func (*MockService) LockWorkspace ¶
func (_m *MockService) LockWorkspace(ctx context.Context, workspace *models.Workspace) (*models.Workspace, error)
LockWorkspace provides a mock function with given fields: ctx, workspace
func (*MockService) SubscribeToWorkspaceEvents ¶
func (_m *MockService) SubscribeToWorkspaceEvents(ctx context.Context, options *EventSubscriptionOptions) (<-chan *Event, error)
SubscribeToWorkspaceEvents provides a mock function with given fields: ctx, options
func (*MockService) UnlockWorkspace ¶
func (_m *MockService) UnlockWorkspace(ctx context.Context, workspace *models.Workspace) (*models.Workspace, error)
UnlockWorkspace provides a mock function with given fields: ctx, workspace
func (*MockService) UpdateWorkspace ¶
func (_m *MockService) UpdateWorkspace(ctx context.Context, workspace *models.Workspace) (*models.Workspace, error)
UpdateWorkspace provides a mock function with given fields: ctx, workspace
func (*MockService) UploadConfigurationVersion ¶
func (_m *MockService) UploadConfigurationVersion(ctx context.Context, configurationVersionID string, reader io.Reader) error
UploadConfigurationVersion provides a mock function with given fields: ctx, configurationVersionID, reader
type Service ¶
type Service interface { SubscribeToWorkspaceEvents(ctx context.Context, options *EventSubscriptionOptions) (<-chan *Event, error) GetWorkspaceByID(ctx context.Context, id string) (*models.Workspace, error) GetWorkspaceByFullPath(ctx context.Context, path string) (*models.Workspace, error) GetWorkspaces(ctx context.Context, input *GetWorkspacesInput) (*db.WorkspacesResult, error) GetWorkspacesByIDs(ctx context.Context, idList []string) ([]models.Workspace, error) CreateWorkspace(ctx context.Context, workspace *models.Workspace) (*models.Workspace, error) UpdateWorkspace(ctx context.Context, workspace *models.Workspace) (*models.Workspace, error) DeleteWorkspace(ctx context.Context, workspace *models.Workspace, force bool) error LockWorkspace(ctx context.Context, workspace *models.Workspace) (*models.Workspace, error) UnlockWorkspace(ctx context.Context, workspace *models.Workspace) (*models.Workspace, error) GetCurrentStateVersion(ctx context.Context, workspaceID string) (*models.StateVersion, error) CreateStateVersion(ctx context.Context, stateVersion *models.StateVersion, data *string) (*models.StateVersion, error) GetStateVersion(ctx context.Context, stateVersionID string) (*models.StateVersion, error) GetStateVersions(ctx context.Context, input *GetStateVersionsInput) (*db.StateVersionsResult, error) GetStateVersionContent(ctx context.Context, stateVersionID string) (io.ReadCloser, error) GetStateVersionsByIDs(ctx context.Context, idList []string) ([]models.StateVersion, error) CreateConfigurationVersion(ctx context.Context, options *CreateConfigurationVersionInput) (*models.ConfigurationVersion, error) GetConfigurationVersion(ctx context.Context, configurationVersionID string) (*models.ConfigurationVersion, error) UploadConfigurationVersion(ctx context.Context, configurationVersionID string, reader io.Reader) error GetConfigurationVersionContent(ctx context.Context, configurationVersionID string) (io.ReadCloser, error) GetConfigurationVersionsByIDs(ctx context.Context, idList []string) ([]models.ConfigurationVersion, error) GetStateVersionOutputs(context context.Context, stateVersionID string) ([]models.StateVersionOutput, error) GetStateVersionResources(ctx context.Context, stateVersion *models.StateVersion) ([]StateVersionResource, error) GetStateVersionDependencies(ctx context.Context, stateVersion *models.StateVersion) ([]StateVersionDependency, error) }
Service implements all workspace related functionality
func NewService ¶
func NewService( logger logger.Logger, dbClient *db.Client, artifactStore ArtifactStore, eventManager *events.EventManager, cliService cli.Service, activityService activityevent.Service, ) Service
NewService creates an instance of Service
type StateVersionDependency ¶
type StateVersionDependency struct { WorkspacePath string WorkspaceID string StateVersionID string }
StateVersionDependency represents a workspace dependency