run

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: MPL-2.0 Imports: 39 Imported by: 0

Documentation

Overview

Package run package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelRunInput

type CancelRunInput struct {
	Comment *string
	RunID   string
	Force   bool
}

CancelRunInput is the input for canceling a run.

type CreateRunInput

type CreateRunInput struct {
	ConfigurationVersionID *string
	Comment                *string
	ModuleSource           *string
	ModuleVersion          *string
	Speculative            *bool // optional field, default depends on module source vs. configuration version
	WorkspaceID            string
	TerraformVersion       string
	Variables              []Variable
	TargetAddresses        []string
	IsDestroy              bool
	Refresh                bool
}

CreateRunInput is the input for creating a new run

func (CreateRunInput) Validate

func (c CreateRunInput) Validate() error

Validate attempts to ensure the CreateRunInput structure is in good form and able to be used.

type Event

type Event struct {
	Action string
	Run    models.Run
}

Event represents a run event

type EventSubscriptionOptions

type EventSubscriptionOptions struct {
	WorkspaceID *string
	RunID       *string // RunID is optional
}

EventSubscriptionOptions provides options for subscribing to run events

type GetRunsInput

type GetRunsInput struct {
	// Sort specifies the field to sort on and direction
	Sort *db.RunSortableField
	// PaginationOptions supports cursor based pagination
	PaginationOptions *pagination.Options
	// Workspace filters the runs by the specified workspace
	Workspace *models.Workspace
	// Group filters the runs by the specified group
	Group *models.Group
}

GetRunsInput is the input for querying a list of runs

type MockModuleResolver added in v0.3.0

type MockModuleResolver struct {
	mock.Mock
}

MockModuleResolver is an autogenerated mock type for the ModuleResolver type

func NewMockModuleResolver added in v0.3.0

func NewMockModuleResolver(t mockConstructorTestingTNewMockModuleResolver) *MockModuleResolver

NewMockModuleResolver creates a new instance of MockModuleResolver. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockModuleResolver) ParseModuleRegistrySource added in v0.3.0

func (_m *MockModuleResolver) ParseModuleRegistrySource(ctx context.Context, moduleSource string) (*ModuleRegistrySource, error)

ParseModuleRegistrySource provides a mock function with given fields: ctx, moduleSource

func (*MockModuleResolver) ResolveModuleVersion added in v0.3.0

func (_m *MockModuleResolver) ResolveModuleVersion(ctx context.Context, source *ModuleRegistrySource, wantVersion *string, variables []Variable) (string, error)

ResolveModuleVersion provides a mock function with given fields: ctx, source, wantVersion, variables

type MockService

type MockService struct {
	mock.Mock
}

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

func (_m *MockService) ApplyRun(ctx context.Context, runID string, comment *string) (*models.Run, error)

ApplyRun provides a mock function with given fields: ctx, runID, comment

func (*MockService) CancelRun

func (_m *MockService) CancelRun(ctx context.Context, options *CancelRunInput) (*models.Run, error)

CancelRun provides a mock function with given fields: ctx, options

func (*MockService) CreateRun

func (_m *MockService) CreateRun(ctx context.Context, options *CreateRunInput) (*models.Run, error)

CreateRun provides a mock function with given fields: ctx, options

func (*MockService) DownloadPlan

func (_m *MockService) DownloadPlan(ctx context.Context, planID string) (io.ReadCloser, error)

DownloadPlan provides a mock function with given fields: ctx, planID

func (*MockService) GetAppliesByIDs

func (_m *MockService) GetAppliesByIDs(ctx context.Context, idList []string) ([]models.Apply, error)

GetAppliesByIDs provides a mock function with given fields: ctx, idList

func (*MockService) GetApply

func (_m *MockService) GetApply(ctx context.Context, applyID string) (*models.Apply, error)

GetApply provides a mock function with given fields: ctx, applyID

func (*MockService) GetLatestJobForApply

func (_m *MockService) GetLatestJobForApply(ctx context.Context, applyID string) (*models.Job, error)

GetLatestJobForApply provides a mock function with given fields: ctx, applyID

func (*MockService) GetLatestJobForPlan

func (_m *MockService) GetLatestJobForPlan(ctx context.Context, planID string) (*models.Job, error)

GetLatestJobForPlan provides a mock function with given fields: ctx, planID

func (*MockService) GetPlan

func (_m *MockService) GetPlan(ctx context.Context, planID string) (*models.Plan, error)

GetPlan provides a mock function with given fields: ctx, planID

func (*MockService) GetPlanDiff added in v0.26.0

func (_m *MockService) GetPlanDiff(ctx context.Context, planID string) (*plan.Diff, error)

GetPlanDiff provides a mock function with given fields: ctx, planID

func (*MockService) GetPlansByIDs

func (_m *MockService) GetPlansByIDs(ctx context.Context, idList []string) ([]models.Plan, error)

GetPlansByIDs provides a mock function with given fields: ctx, idList

func (*MockService) GetRun

func (_m *MockService) GetRun(ctx context.Context, runID string) (*models.Run, error)

GetRun provides a mock function with given fields: ctx, runID

func (*MockService) GetRunVariables

func (_m *MockService) GetRunVariables(ctx context.Context, runID string) ([]Variable, error)

GetRunVariables provides a mock function with given fields: ctx, runID

func (*MockService) GetRuns

func (_m *MockService) GetRuns(ctx context.Context, input *GetRunsInput) (*db.RunsResult, error)

GetRuns provides a mock function with given fields: ctx, input

func (*MockService) GetRunsByIDs

func (_m *MockService) GetRunsByIDs(ctx context.Context, idList []string) ([]models.Run, error)

GetRunsByIDs provides a mock function with given fields: ctx, idList

func (*MockService) GetStateVersionsByRunIDs added in v0.17.1

func (_m *MockService) GetStateVersionsByRunIDs(ctx context.Context, idList []string) ([]models.StateVersion, error)

GetStateVersionsByRunIDs provides a mock function with given fields: ctx, idList

func (*MockService) ProcessPlanData added in v0.26.0

func (_m *MockService) ProcessPlanData(ctx context.Context, planID string, _a2 *tfjson.Plan, providerSchemas *tfjson.ProviderSchemas) error

ProcessPlanData provides a mock function with given fields: ctx, planID, _a2, providerSchemas

func (*MockService) SubscribeToRunEvents

func (_m *MockService) SubscribeToRunEvents(ctx context.Context, options *EventSubscriptionOptions) (<-chan *Event, error)

SubscribeToRunEvents provides a mock function with given fields: ctx, options

func (*MockService) UpdateApply

func (_m *MockService) UpdateApply(ctx context.Context, apply *models.Apply) (*models.Apply, error)

UpdateApply provides a mock function with given fields: ctx, apply

func (*MockService) UpdatePlan

func (_m *MockService) UpdatePlan(ctx context.Context, _a1 *models.Plan) (*models.Plan, error)

UpdatePlan provides a mock function with given fields: ctx, _a1

func (*MockService) UploadPlanBinary added in v0.26.0

func (_m *MockService) UploadPlanBinary(ctx context.Context, planID string, reader io.Reader) error

UploadPlanBinary provides a mock function with given fields: ctx, planID, reader

type ModuleRegistrySource added in v0.3.0

type ModuleRegistrySource struct {
	RegistryURL  *url.URL
	ModuleID     *string // This field is only set for modules in the tharsis module registry
	Host         string
	Namespace    string
	Name         string
	TargetSystem string
}

ModuleRegistrySource is the parsed Terraform module source

type ModuleResolver

type ModuleResolver interface {
	ParseModuleRegistrySource(ctx context.Context, moduleSource string) (*ModuleRegistrySource, error)
	ResolveModuleVersion(ctx context.Context, source *ModuleRegistrySource, wantVersion *string, variables []Variable) (string, error)
}

ModuleResolver encapsulates the logic to resolve module source version string(s).

func NewModuleResolver

func NewModuleResolver(moduleService moduleregistry.Service, httpClient *http.Client, logger logger.Logger, tharsiAPIEndpoint string) ModuleResolver

NewModuleResolver returns

type Service

type Service interface {
	GetRun(ctx context.Context, runID string) (*models.Run, error)
	GetRuns(ctx context.Context, input *GetRunsInput) (*db.RunsResult, error)
	GetRunsByIDs(ctx context.Context, idList []string) ([]models.Run, error)
	CreateRun(ctx context.Context, options *CreateRunInput) (*models.Run, error)
	ApplyRun(ctx context.Context, runID string, comment *string) (*models.Run, error)
	CancelRun(ctx context.Context, options *CancelRunInput) (*models.Run, error)
	GetRunVariables(ctx context.Context, runID string) ([]Variable, error)
	GetPlansByIDs(ctx context.Context, idList []string) ([]models.Plan, error)
	GetPlan(ctx context.Context, planID string) (*models.Plan, error)
	GetPlanDiff(ctx context.Context, planID string) (*plan.Diff, error)
	UpdatePlan(ctx context.Context, plan *models.Plan) (*models.Plan, error)
	DownloadPlan(ctx context.Context, planID string) (io.ReadCloser, error)
	UploadPlanBinary(ctx context.Context, planID string, reader io.Reader) error
	ProcessPlanData(ctx context.Context, planID string, plan *tfjson.Plan, providerSchemas *tfjson.ProviderSchemas) error
	GetAppliesByIDs(ctx context.Context, idList []string) ([]models.Apply, error)
	GetApply(ctx context.Context, applyID string) (*models.Apply, error)
	UpdateApply(ctx context.Context, apply *models.Apply) (*models.Apply, error)
	GetLatestJobForPlan(ctx context.Context, planID string) (*models.Job, error)
	GetLatestJobForApply(ctx context.Context, applyID string) (*models.Job, error)
	SubscribeToRunEvents(ctx context.Context, options *EventSubscriptionOptions) (<-chan *Event, error)
	GetStateVersionsByRunIDs(ctx context.Context, idList []string) ([]models.StateVersion, error)
}

Service encapsulates Terraform Enterprise Support

func NewService

func NewService(
	logger logger.Logger,
	dbClient *db.Client,
	artifactStore workspace.ArtifactStore,
	eventManager *events.EventManager,
	jobService job.Service,
	cliService cli.Service,
	activityService activityevent.Service,
	moduleService moduleregistry.Service,
	moduleResolver ModuleResolver,
	runStateManager *state.RunStateManager,
	limitChecker limits.LimitChecker,
) Service

NewService creates an instance of Service

type Variable

type Variable struct {
	Value         *string                 `json:"value"`
	NamespacePath *string                 `json:"namespacePath"`
	Key           string                  `json:"key"`
	Category      models.VariableCategory `json:"category"`
	Hcl           bool                    `json:"hcl"`
}

Variable represents a run variable

Directories

Path Synopsis
registry
addrs
Package addrs package
Package addrs package
getmodules
Package getmodules package
Package getmodules package
Package rules package
Package rules package
Package state package
Package state package

Jump to

Keyboard shortcuts

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