Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DockerClient ¶
type DockerClient interface {
// RunContainer runs a container with the specified image and options.
RunContainer(image string, opts DockerRunOptions) error
}
DockerClient provides an interface for interacting with Docker containers.
func NewDockerCliClient ¶
func NewDockerCliClient(runner ProcessRunner) DockerClient
NewDockerCliClient creates a new DockerClient that wraps the Docker CLI tool.
type DockerRunOptions ¶
type DockerRunOptions struct {
// Env is a map of environment variables to set in the container.
Env map[string]string
// ExposedPorts is a map of ports to expose on the container.
ExposedPorts []int
// RestartPolicy is the policy to use when the container exits.
RestartPolicy string
}
DockerRunOptions provides options for how to run a container.
type GitClient ¶
type GitClient interface {
// ShallowClone clones a repository to the specified directory with a depth of 1.
// If the directory already exists, it will be deleted and recreated with the new repository.
ShallowClone(url string, directory string, branch string) error
// Checkout checks out a branch in the specified directory.
// If the directory does not exist, it will be created and the repository cloned.
// If the directory exists, it will be updated with the latest changes on the given branch from the repository.
Checkout(url string, directory string, branch string) error
}
GitClient provides an interface for interacting with Git repositories.
func NewGitCliClient ¶
func NewGitCliClient(runner ProcessRunner) GitClient
NewGitCliClient creates a new GitClient that wraps the Git CLI tool.
type ProcessRunner ¶
type ProcessRunner interface {
// Run runs a shell command with the specified arguments and returns the output once the command completes.
Run(cmd string, args ...string) (string, error)
// RunWithOptions runs a shell command with the specified options and returns the output once the command completes.
RunWithOptions(cmd string, options RunnerOpts) (string, error)
}
ProcessRunner provides a helper interface for running shell commands.
func NewProcessRunner ¶
func NewProcessRunner() ProcessRunner
NewProcessRunner creates a new ProcessRunner.
type RunnerOpts ¶
type RunnerOpts struct {
// Args are the arguments to pass to the command.
Args []string
// Env is the environment variables to set for the command, in the form of key-value mappings.
Env map[string]string
// WorkingDir is the working directory to run the command in, or an empty string to use the current working directory.
WorkingDir string
}
RunnerOpts provides options for running shell commands.
type TerraformClient ¶
type TerraformClient interface {
// Init initializes a Terraform project.
Init(directory string) error
// Apply applies a Terraform configuration with variables from the specified file.
Apply(directory string, varFilePath string) error
// Destroy destroys a Terraform project.
Destroy(directory string, varFilePath string) error
}
TerraformClient provides an interface for interacting with Terraform.
func NewTerraformCliClient ¶
func NewTerraformCliClient(runner ProcessRunner) TerraformClient
NewTerraformCliClient creates a new TerraformClient that wraps the Terraform CLI tool.