Documentation
¶
Index ¶
- Variables
- type DockerClientFactory
- type DockerConfig
- type DockerProvider
- func (d DockerProvider) AvailableParams() []types.InfraProviderParameterSchema
- func (d DockerProvider) Deprovision(ctx context.Context, infra types.Infrastructure) error
- func (d DockerProvider) Find(ctx context.Context, spaceID int64, spacePath string, ...) (*types.Infrastructure, error)
- func (d DockerProvider) Provision(ctx context.Context, spaceID int64, spacePath string, ...) error
- func (d DockerProvider) ProvisioningType() enum.InfraProvisioningType
- func (d DockerProvider) Stop(ctx context.Context, infra types.Infrastructure) error
- func (d DockerProvider) TemplateParams() []types.InfraProviderParameterSchema
- func (d DockerProvider) ValidateParams(_ []types.InfraProviderParameter) error
- type Factory
- type InfraProvider
Constants ¶
This section is empty.
Variables ¶
var WireSet = wire.NewSet( ProvideDockerProvider, ProvideFactory, ProvideDockerClientFactory, )
WireSet provides a wire set for this package.
Functions ¶
This section is empty.
Types ¶
type DockerClientFactory ¶
type DockerClientFactory struct {
// contains filtered or unexported fields
}
func NewDockerClientFactory ¶
func NewDockerClientFactory(config *DockerConfig) *DockerClientFactory
func ProvideDockerClientFactory ¶
func ProvideDockerClientFactory(config *DockerConfig) *DockerClientFactory
func (*DockerClientFactory) NewDockerClient ¶
func (d *DockerClientFactory) NewDockerClient( _ context.Context, infra types.Infrastructure, ) (*client.Client, error)
NewDockerClient returns a new docker client created using the docker config and infra.
type DockerConfig ¶
type DockerProvider ¶
type DockerProvider struct {
// contains filtered or unexported fields
}
func NewDockerProvider ¶
func NewDockerProvider( config *DockerConfig, dockerClientFactory *DockerClientFactory, eventReporter *events.Reporter, ) *DockerProvider
func ProvideDockerProvider ¶
func ProvideDockerProvider( config *DockerConfig, dockerClientFactory *DockerClientFactory, eventReporter *events.Reporter, ) *DockerProvider
func (DockerProvider) AvailableParams ¶
func (d DockerProvider) AvailableParams() []types.InfraProviderParameterSchema
AvailableParams returns empty slice as no params are defined.
func (DockerProvider) Deprovision ¶
func (d DockerProvider) Deprovision(ctx context.Context, infra types.Infrastructure) error
Deprovision deletes the volume created by Provision. It does not stop the docker engine.
func (DockerProvider) Find ¶
func (d DockerProvider) Find( ctx context.Context, spaceID int64, spacePath string, gitspaceConfigIdentifier string, _ string, _ int, _ []types.GitspacePort, inputParameters []types.InfraProviderParameter, ) (*types.Infrastructure, error)
Find fetches the infrastructure with the current state, the method has no side effects on the infra.
func (DockerProvider) Provision ¶
func (d DockerProvider) Provision( ctx context.Context, spaceID int64, spacePath string, gitspaceConfigIdentifier string, _ string, _ int, requiredGitspacePorts []types.GitspacePort, inputParameters []types.InfraProviderParameter, ) error
Provision assumes a docker engine is already running on the Harness host machine and re-uses that as infra. It does not start docker engine. It creates a docker volume using the given gitspace config identifier.
func (DockerProvider) ProvisioningType ¶
func (d DockerProvider) ProvisioningType() enum.InfraProvisioningType
ProvisioningType returns existing as docker provider doesn't create new resources.
func (DockerProvider) Stop ¶
func (d DockerProvider) Stop(ctx context.Context, infra types.Infrastructure) error
Stop is NOOP as this provider uses already running docker engine. It does not stop the docker engine.
func (DockerProvider) TemplateParams ¶
func (d DockerProvider) TemplateParams() []types.InfraProviderParameterSchema
TemplateParams returns nil as no template params are used.
func (DockerProvider) ValidateParams ¶
func (d DockerProvider) ValidateParams(_ []types.InfraProviderParameter) error
ValidateParams returns nil as no params are defined.
type Factory ¶
type Factory interface {
GetInfraProvider(providerType enum.InfraProviderType) (InfraProvider, error)
}
func NewFactory ¶
func NewFactory(dockerProvider *DockerProvider) Factory
func ProvideFactory ¶
func ProvideFactory(dockerProvider *DockerProvider) Factory
type InfraProvider ¶
type InfraProvider interface {
// Provision provisions infrastructure against a gitspace with the provided parameters.
Provision(
ctx context.Context,
spaceID int64,
spacePath string,
gitspaceConfigIdentifier string,
gitspaceInstanceIdentifier string,
agentPort int,
requiredGitspacePorts []types.GitspacePort,
inputParameters []types.InfraProviderParameter,
) error
// Find finds infrastructure provisioned against a gitspace.
Find(
ctx context.Context,
spaceID int64,
spacePath string,
gitspaceConfigIdentifier string,
gitspaceInstanceIdentifier string,
agentPort int,
requiredGitspacePorts []types.GitspacePort,
inputParameters []types.InfraProviderParameter,
) (*types.Infrastructure, error)
// Stop frees up the resources allocated against a gitspace, which can be freed.
Stop(ctx context.Context, infra types.Infrastructure) error
// Deprovision removes all infrastructure provisioned against the gitspace.
Deprovision(ctx context.Context, infra types.Infrastructure) error
// AvailableParams provides a schema to define the infrastructure.
AvailableParams() []types.InfraProviderParameterSchema
// ValidateParams validates the supplied params before defining the infrastructure resource .
ValidateParams(inputParameters []types.InfraProviderParameter) error
// TemplateParams provides a list of params which are of type template.
TemplateParams() []types.InfraProviderParameterSchema
// ProvisioningType specifies whether the provider will provision new infra resources or it will reuse existing.
ProvisioningType() enum.InfraProvisioningType
}