Documentation ¶
Index ¶
- Constants
- Variables
- func CheckLatestVersion()
- func DebugPrint(msg string)
- func GetConfigOpts() (opts map[string]*CliOpts, err error)
- func GetEnvs() (envs map[string]*ContainerOpts, err error)
- func GetLatestVersion(getRequest callback) (string, error)
- func GetRequest(url string) (map[string]interface{}, error)
- func LatestVersion(repository string) string
- func MonitorTtySize(ctx context.Context, cli ContainerClient, id string, isExec bool) error
- func PrintConfig(envName string, opts *ContainerOpts)
- func PrintEnvNotFoundMsg(envName string)
- func PrintStartHelpMessage(envName string)
- func SetEnvs(envs map[string]*ContainerOpts)
- type BuildOpts
- type Cli
- func (cli *Cli) ApiClient() *DockerAPIService
- func (cli *Cli) Container(envName string) (*types.Container, error)
- func (cli *Cli) ContainerIsRunning(envName string) bool
- func (cli *Cli) Containers() map[string]*ContainerOpts
- func (cli *Cli) DockerClient() *DockerService
- func (cli *Cli) Err() io.Writer
- func (cli *Cli) In() *streams.In
- func (cli *Cli) Out() *streams.Out
- func (cli *Cli) Validator() *Validator
- type CliOpts
- type ContainerClient
- type ContainerOpts
- type DockerAPI
- type DockerAPIService
- func (d *DockerAPIService) ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error)
- func (d *DockerAPIService) ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error)
- func (d *DockerAPIService) ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)
- func (d *DockerAPIService) ContainerExecResize(ctx context.Context, id string, options types.ResizeOptions) error
- func (d *DockerAPIService) ContainerExecStart(ctx context.Context, execID string, config types.ExecStartCheck) error
- func (d *DockerAPIService) ContainerInspect(ctx context.Context, container string) (types.ContainerJSON, error)
- func (d *DockerAPIService) ContainerResize(ctx context.Context, id string, options types.ResizeOptions) error
- func (d *DockerAPIService) CreateExecInteractive(ctx context.Context, cliClient ContainerClient, container string, ...) error
- func (d *DockerAPIService) InteractiveExec(ctx context.Context, cliClient ContainerClient, execConfig *types.ExecConfig, ...) error
- type DockerClient
- type DockerService
- func (d *DockerService) BuildImageWithContext(ctx context.Context, out *streams.Out, contextDirPath string, ...) (err error)
- func (d *DockerService) ContainerCreate(ctx context.Context, config *container.Config, ...) (container.ContainerCreateCreatedBody, error)
- func (d *DockerService) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
- func (d *DockerService) ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error
- func (d *DockerService) ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error
- func (d *DockerService) ContainerStop(ctx context.Context, containerID string, timeout *time.Duration) error
- func (d *DockerService) CreateContainer(ctx context.Context, config *container.Config, containerName string, ...) (container.ContainerCreateCreatedBody, error)
- func (d *DockerService) GetRunning(filters filters.Args, print bool) ([]types.Container, error)
- func (d *DockerService) ImageBuild(ctx context.Context, buildContext io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
- func (d *DockerService) ImagePull(ctx context.Context, refStr string, options types.ImagePullOptions) (io.ReadCloser, error)
- func (d *DockerService) PullImage(ctx context.Context, out *streams.Out, imageName string) error
- func (d *DockerService) RemoveContainer(ctx context.Context, containerName string) error
- func (d *DockerService) StartContainer(ctx context.Context, containerID string) error
- func (d *DockerService) StopContainer(ctx context.Context, containerID string, timeout *time.Duration) error
- type ErrorDetail
- type HostConfig
- type PullOpts
- type Validate
- type Validator
Constants ¶
View Source
const ( RepositoryUrl = "https://github.com/camerondurham/ch" Repository = "camerondurham/ch" ApiPath = "https://api.github.com/repos/%s/releases/latest" )
Variables ¶
View Source
var (
ErrDoesNotExist = errors.New("does not exist")
)
Functions ¶
func CheckLatestVersion ¶ added in v0.3.1
func CheckLatestVersion()
func GetConfigOpts ¶ added in v0.2.5
GetConfigOpts retrieves optional settings from ~/.ch.yaml
func GetEnvs ¶
func GetEnvs() (envs map[string]*ContainerOpts, err error)
GetEnvs retrieves the environments managed by ch from ~/.ch.yaml
func GetLatestVersion ¶ added in v0.2.3
func GetRequest ¶ added in v0.2.3
func LatestVersion ¶ added in v0.2.3
func MonitorTtySize ¶
MonitorTtySize updates the container tty size when the terminal tty changes size
func PrintConfig ¶
func PrintConfig(envName string, opts *ContainerOpts)
func PrintEnvNotFoundMsg ¶
func PrintEnvNotFoundMsg(envName string)
func PrintStartHelpMessage ¶
func PrintStartHelpMessage(envName string)
func SetEnvs ¶
func SetEnvs(envs map[string]*ContainerOpts)
Types ¶
type Cli ¶
type Cli struct {
// contains filtered or unexported fields
}
Cli TODO: add config/env settings to use Cli in other commands
func NewCliClient ¶
func NewCliClientWithDockerService ¶
func NewCliClientWithDockerService(dockerClient DockerClient, dockerService *DockerService) *Cli
func (*Cli) ApiClient ¶
func (cli *Cli) ApiClient() *DockerAPIService
func (*Cli) ContainerIsRunning ¶
func (*Cli) Containers ¶
func (cli *Cli) Containers() map[string]*ContainerOpts
func (*Cli) DockerClient ¶
func (cli *Cli) DockerClient() *DockerService
type ContainerClient ¶
type ContainerClient interface { ApiClient() *DockerAPIService DockerClient() *DockerService Out() *streams.Out In() *streams.In Err() io.Writer Containers() map[string]*ContainerOpts Container(envName string) (*types.Container, error) ContainerIsRunning(envName string) bool Validator() *Validator }
type ContainerOpts ¶
type ContainerOpts struct { BuildOpts *BuildOpts PullOpts *PullOpts HostConfig *HostConfig Shell string }
type DockerAPI ¶
type DockerAPI interface { ContainerInspect(ctx context.Context, container string) (types.ContainerJSON, error) ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error) ContainerExecStart(ctx context.Context, execID string, config types.ExecStartCheck) error ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error) ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error) ContainerExecResize(ctx context.Context, execID string, options types.ResizeOptions) error ContainerResize(ctx context.Context, containerID string, options types.ResizeOptions) error }
type DockerAPIService ¶
type DockerAPIService struct {
// contains filtered or unexported fields
}
func NewDockerAPIService ¶
func NewDockerAPIService(client DockerService) *DockerAPIService
func (*DockerAPIService) ContainerExecAttach ¶
func (d *DockerAPIService) ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error)
func (*DockerAPIService) ContainerExecCreate ¶
func (d *DockerAPIService) ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error)
func (*DockerAPIService) ContainerExecInspect ¶
func (d *DockerAPIService) ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)
func (*DockerAPIService) ContainerExecResize ¶
func (d *DockerAPIService) ContainerExecResize(ctx context.Context, id string, options types.ResizeOptions) error
func (*DockerAPIService) ContainerExecStart ¶
func (d *DockerAPIService) ContainerExecStart(ctx context.Context, execID string, config types.ExecStartCheck) error
func (*DockerAPIService) ContainerInspect ¶
func (d *DockerAPIService) ContainerInspect(ctx context.Context, container string) (types.ContainerJSON, error)
func (*DockerAPIService) ContainerResize ¶
func (d *DockerAPIService) ContainerResize(ctx context.Context, id string, options types.ResizeOptions) error
func (*DockerAPIService) CreateExecInteractive ¶
func (d *DockerAPIService) CreateExecInteractive(ctx context.Context, cliClient ContainerClient, container string, config types.ExecConfig) error
CreateExecInteractive creates an exec config to run an exec process
func (*DockerAPIService) InteractiveExec ¶
func (d *DockerAPIService) InteractiveExec(ctx context.Context, cliClient ContainerClient, execConfig *types.ExecConfig, execID string) error
type DockerClient ¶
type DockerClient interface { ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error) ImagePull(ctx context.Context, refStr string, options types.ImagePullOptions) (io.ReadCloser, error) ImageBuild(ctx context.Context, buildContext io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *specs.Platform, containerName string) (container.ContainerCreateCreatedBody, error) ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error ContainerStop(ctx context.Context, containerID string, timeout *time.Duration) error }
type DockerService ¶
type DockerService struct {
// contains filtered or unexported fields
}
func NewDockerService ¶
func NewDockerService() (*DockerService, error)
func NewDockerServiceFromClient ¶
func NewDockerServiceFromClient(cli DockerClient) *DockerService
func (*DockerService) BuildImageWithContext ¶
func (d *DockerService) BuildImageWithContext(ctx context.Context, out *streams.Out, contextDirPath string, imageTagName string, dockerfile string) (err error)
BuildImageWithContext accepts a build context path and relative Dockerfile path
func (*DockerService) ContainerCreate ¶
func (d *DockerService) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *specs.Platform, containerName string) (container.ContainerCreateCreatedBody, error)
func (*DockerService) ContainerList ¶
func (d *DockerService) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
func (*DockerService) ContainerRemove ¶
func (d *DockerService) ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error
func (*DockerService) ContainerStart ¶
func (d *DockerService) ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error
func (*DockerService) ContainerStop ¶
func (*DockerService) CreateContainer ¶
func (d *DockerService) CreateContainer(ctx context.Context, config *container.Config, containerName string, hostConfig *container.HostConfig) (container.ContainerCreateCreatedBody, error)
CreateContainer create container with name
func (*DockerService) GetRunning ¶
GetRunning lists running containers like docker ps
func (*DockerService) ImageBuild ¶
func (d *DockerService) ImageBuild(ctx context.Context, buildContext io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
func (*DockerService) ImagePull ¶
func (d *DockerService) ImagePull(ctx context.Context, refStr string, options types.ImagePullOptions) (io.ReadCloser, error)
func (*DockerService) RemoveContainer ¶
func (d *DockerService) RemoveContainer(ctx context.Context, containerName string) error
RemoveContainer delete container
func (*DockerService) StartContainer ¶
func (d *DockerService) StartContainer(ctx context.Context, containerID string) error
StartContainer with given name
func (*DockerService) StopContainer ¶
func (d *DockerService) StopContainer(ctx context.Context, containerID string, timeout *time.Duration) error
StopContainer from running
type ErrorDetail ¶
ErrorDetail Docker Build Response
type HostConfig ¶
type HostConfig struct { Binds []string // List of volume bindings for this container SecurityOpt []string // List of string values to customize labels for MLS systems, such as SELinux. PortBindings nat.PortMap // Map of host to container ports Privileged bool // Is the container in privileged mode CapAdd strslice.StrSlice // List of kernel capabilities to add to the container }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.