Documentation
¶
Index ¶
- Variables
- type DockerClientFactory
- type DockerConfig
- type DockerProvider
- func (d DockerProvider) AvailableParams() []ParameterSchema
- func (d DockerProvider) Deprovision(ctx context.Context, infra *Infrastructure) (*Infrastructure, error)
- func (d DockerProvider) Exec(_ context.Context, _ *Infrastructure, _ []string) (io.Reader, io.Reader, error)
- func (d DockerProvider) Find(ctx context.Context, spacePath string, resourceKey string, params []Parameter) (*Infrastructure, error)
- func (d DockerProvider) Provision(ctx context.Context, spacePath string, resourceKey string, params []Parameter) (*Infrastructure, error)
- func (d DockerProvider) ProvisioningType() enum.InfraProvisioningType
- func (d DockerProvider) Stop(_ context.Context, infra *Infrastructure) (*Infrastructure, error)
- func (d DockerProvider) TemplateParams() []ParameterSchema
- func (d DockerProvider) ValidateParams(_ []Parameter) error
- type Factory
- type InfraProvider
- type Infrastructure
- type Parameter
- type ParameterSchema
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 *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, ) *DockerProvider
func ProvideDockerProvider ¶
func ProvideDockerProvider( config *DockerConfig, dockerClientFactory *DockerClientFactory, ) *DockerProvider
func (DockerProvider) AvailableParams ¶
func (d DockerProvider) AvailableParams() []ParameterSchema
AvailableParams returns empty slice as no params are defined.
func (DockerProvider) Deprovision ¶
func (d DockerProvider) Deprovision(ctx context.Context, infra *Infrastructure) (*Infrastructure, error)
Deprovision deletes the host machine directory created by Provision. It does not stop the docker engine.
func (DockerProvider) Exec ¶
func (d DockerProvider) Exec(_ context.Context, _ *Infrastructure, _ []string) (io.Reader, io.Reader, error)
func (DockerProvider) Find ¶
func (d DockerProvider) Find( ctx context.Context, spacePath string, resourceKey string, params []Parameter, ) (*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, spacePath string, resourceKey string, params []Parameter, ) (*Infrastructure, error)
Provision assumes a docker engine is already running on the gitness host machine and re-uses that as infra. It does not start docker engine. It creates a directory in the host machine using the given resource key.
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(_ context.Context, infra *Infrastructure) (*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() []ParameterSchema
TemplateParams returns nil as no template params are used.
func (DockerProvider) ValidateParams ¶
func (d DockerProvider) ValidateParams(_ []Parameter) error
ValidateParams returns nil as no params are defined.
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
func NewFactory ¶
func NewFactory(dockerProvider *DockerProvider) Factory
func ProvideFactory ¶
func ProvideFactory(dockerProvider *DockerProvider) Factory
func (*Factory) GetInfraProvider ¶
func (f *Factory) GetInfraProvider(providerType enum.InfraProviderType) (InfraProvider, error)
type InfraProvider ¶
type InfraProvider interface { // Provision provisions infrastructure against a resourceKey with the provided parameters. Provision(ctx context.Context, spacePath string, resourceKey string, parameters []Parameter) (*Infrastructure, error) // Find finds infrastructure provisioned against a resourceKey. Find(ctx context.Context, spacePath string, resourceKey string, parameters []Parameter) (*Infrastructure, error) // Stop frees up the resources allocated against a resourceKey, which can be freed. Stop(ctx context.Context, infra *Infrastructure) (*Infrastructure, error) // Deprovision removes all infrastructure provisioned againest the resourceKey. Deprovision(ctx context.Context, infra *Infrastructure) (*Infrastructure, error) // AvailableParams provides a schema to define the infrastructure. AvailableParams() []ParameterSchema // ValidateParams validates the supplied params before defining the infrastructure resource . ValidateParams(parameters []Parameter) error // TemplateParams provides a list of params which are of type template. TemplateParams() []ParameterSchema // ProvisioningType specifies whether the provider will provision new infra resources or it will reuse existing. ProvisioningType() enum.InfraProvisioningType // Exec executes a shell command in the infrastructure. Exec(ctx context.Context, infra *Infrastructure, cmd []string) (io.Reader, io.Reader, error) }