exec

package
v0.5.51 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const TypeLocalExec string = "local_exec"

TypeExecLocal is the resource string for a LocalExec resource

View Source
const TypeRemoteExec string = "remote_exec"

TypeExecRemote is the resource string for a ExecRemote resource

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalExec

type LocalExec struct {
	// embedded type holding name, etc
	types.ResourceMetadata `hcl:",remain"`

	// Script []string `hcl:"script,optional" json:"script,omitempty"` // Script to execute
	Command          []string          `hcl:"command,optional" json:"command,omitempty"`                     // Command to execute
	WorkingDirectory string            `hcl:"working_directory,optional" json:"working_directory,omitempty"` // Working directory to execute commands
	Daemon           bool              `hcl:"daemon,optional" json:"daemon,omitempty"`                       // Should the process run as a daemon
	Timeout          string            `hcl:"timeout,optional" json:"timeout,omitempty"`                     // Set the timeout for the command
	Environment      map[string]string `hcl:"environment,optional" json:"environment,omitempty"`             // environment variables to set

	// Pid stores the ID of the created connector service
	Pid int `hcl:"pid,optional" json:"pid,omitempty"`
}

ExecLocal allows commands to be executed on the local machine

func (*LocalExec) Process

func (e *LocalExec) Process() error

type LocalProvider

type LocalProvider struct {
	// contains filtered or unexported fields
}

ExecLocal provider allows the execution of arbitrary commands on the local machine

func (*LocalProvider) Changed

func (p *LocalProvider) Changed() (bool, error)

func (*LocalProvider) Create

func (p *LocalProvider) Create() error

Create a new exec

func (*LocalProvider) Destroy

func (p *LocalProvider) Destroy() error

Destroy satisfies the interface method but is not implemented by LocalExec

func (*LocalProvider) Init

func (p *LocalProvider) Init(cfg htypes.Resource, l logger.Logger) error

Intit creates a new Local Exec provider

func (*LocalProvider) Lookup

func (p *LocalProvider) Lookup() ([]string, error)

Lookup satisfies the interface method but is not implemented by LocalExec

func (*LocalProvider) Refresh

func (p *LocalProvider) Refresh() error

type RemoteExec

type RemoteExec struct {
	types.ResourceMetadata `hcl:",remain"`

	Networks []ctypes.NetworkAttachment `hcl:"network,block" json:"networks,omitempty"` // Attach to the correct network // only when Image is specified

	// Either Image or Target must be specified
	Image  *ctypes.Image     `hcl:"image,block" json:"image,omitempty"`      // Create a new container and exec
	Target *ctypes.Container `hcl:"target,optional" json:"target,omitempty"` // Attach to a running target and exec

	// Either Script or Command must be specified
	Script           string `hcl:"script,optional" json:"script,omitempty"`                       // Path to a script to execute
	WorkingDirectory string `hcl:"working_directory,optional" json:"working_directory,omitempty"` // Working directory to execute commands

	Volumes     []ctypes.Volume   `hcl:"volume,block" json:"volumes,omitempty"`             // Volumes to mount to container
	Environment map[string]string `hcl:"environment,optional" json:"environment,omitempty"` // environment variables to set when starting the container

	// User block for mapping the user id and group id inside the container
	RunAs *ctypes.User `hcl:"run_as,block" json:"run_as,omitempty"`
}

ExecRemote allows commands to be executed in remote containers

func (*RemoteExec) Process

func (e *RemoteExec) Process() error

type RemoteProvider

type RemoteProvider struct {
	// contains filtered or unexported fields
}

ExecRemote provider allows the execution of arbitrary commands on an existing target or can create a new container before running

func (*RemoteProvider) Changed

func (p *RemoteProvider) Changed() (bool, error)

func (*RemoteProvider) Create

func (p *RemoteProvider) Create() error

Create a new execution instance

func (*RemoteProvider) Destroy

func (p *RemoteProvider) Destroy() error

Destroy satisfies the interface requirements but is not used as the resource is not persistent

func (*RemoteProvider) Init

func (p *RemoteProvider) Init(cfg htypes.Resource, l logger.Logger) error

func (*RemoteProvider) Lookup

func (p *RemoteProvider) Lookup() ([]string, error)

Lookup satisfies the interface requirements but is not used as the resource is not persistent

func (*RemoteProvider) Refresh

func (p *RemoteProvider) Refresh() error

Jump to

Keyboard shortcuts

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