commands

package
v0.0.0-...-9febfc8 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package commands hosts all CLI commands CTRv2 interacts with. Each command is a struct that represents a CLI command, holds caller-specified arguments, and implements an API to uniformly execute itself.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command interface {
	Execute(context.Context) (string, string, error)
}

Command is the interface of the command pattern. Only support blocking execution for now.

type ContainerInspect

type ContainerInspect struct {
	Names  []string // names (or ids) of containers to be inspected
	Format string   // value for the --format option. e.g. {{.Id}}
}

ContainerInspect represents `docker container inspect`.

func (*ContainerInspect) Execute

func (c *ContainerInspect) Execute(ctx context.Context) (string, string, error)

type ContainerPort

type ContainerPort struct {
	Name string // name (or id) of the container
}

ContainerPort represents `docker container port`.

func (*ContainerPort) Execute

func (c *ContainerPort) Execute(ctx context.Context) (string, string, error)

type ContainerStop

type ContainerStop struct {
	Names []string // names (or ids) of containers to be removed
}

ContainerStop represents `docker container stop`.

func (*ContainerStop) Execute

func (c *ContainerStop) Execute(ctx context.Context) (string, string, error)

type ContextualExecutor

type ContextualExecutor struct{}

ContextualExecutor executes a command using the provided context.

func (*ContextualExecutor) Execute

func (*ContextualExecutor) Execute(ctx context.Context, cmd Command) (string, string, error)

type DockerCp

type DockerCp struct {
	Source      string // source
	Destination string // destination
}

DockerCp represents `docker cp`.

func (*DockerCp) Execute

func (c *DockerCp) Execute(ctx context.Context) (string, string, error)

type DockerExec

type DockerExec struct {
	Name        string   // name of container
	ExecCommand []string // command to be executed
}

DockerExec represents `docker exec`. Example of ExecCommand: ["bash", "-c", "echo $HOME && echo $PATH"] prints the value of environment variables $HOME and $PATH inside the container.

func (*DockerExec) Execute

func (c *DockerExec) Execute(ctx context.Context) (string, string, error)

type DockerInspect

type DockerInspect struct {
	Name   string
	Format string
}

func (*DockerInspect) Execute

func (c *DockerInspect) Execute(ctx context.Context) (string, string, error)

type DockerLogin

type DockerLogin struct {
	*api.LoginRegistryRequest
}

DockerLogin represents `docker login` and is an alias to LoginRegistryRequest

func (*DockerLogin) Execute

func (c *DockerLogin) Execute(ctx context.Context) (string, string, error)

type DockerPull

type DockerPull struct {
	ContainerImage string // ContainerImage is the full location of an image that can directly pulled by docker
}

DockerPull represents `docker pull`

func (*DockerPull) Execute

func (c *DockerPull) Execute(ctx context.Context) (string, string, error)

type DockerRemove

type DockerRemove struct {
	ContainerName string
}

DockerRemove represents `docker rm`

func (*DockerRemove) Execute

func (c *DockerRemove) Execute(ctx context.Context) (string, string, error)

type DockerRun

type DockerRun struct {
	*api.StartContainerRequest
}

DockerRun represents `docker run` and is an alias to StartContainerRequest

func (*DockerRun) Execute

func (c *DockerRun) Execute(ctx context.Context) (string, string, error)

type DockerStop

type DockerStop struct {
	ContainerName string
}

DockerStop represents `docker stop`

func (*DockerStop) Execute

func (c *DockerStop) Execute(ctx context.Context) (string, string, error)

type DockerVersion

type DockerVersion struct{}

DockerVersion represents `docker -v`.

func (*DockerVersion) Execute

func (c *DockerVersion) Execute(ctx context.Context) (string, string, error)

type GcloudAuthServiceAccount

type GcloudAuthServiceAccount struct {
	Args []string
}

GcloudAuthServiceAccount represents `gcloud auth activate-service-account`

func (*GcloudAuthServiceAccount) Execute

type GcloudAuthTokenPrint

type GcloudAuthTokenPrint struct {
}

GcloudAuthTokenPrint represents `gcloud auth print-access-token`

func (*GcloudAuthTokenPrint) Execute

func (c *GcloudAuthTokenPrint) Execute(ctx context.Context) (string, string, error)

type HostIpAddresses

type HostIpAddresses struct{}

HostIpAddresses represents `hostname --all-ip-addresses`. Output is all IP addresses separated by a whitespace.

func (*HostIpAddresses) Execute

func (c *HostIpAddresses) Execute(ctx context.Context) (string, string, error)

type NetworkCreate

type NetworkCreate struct {
	Name string // name of network to be created
}

NetworkCreate represents `docker network create`.

func (*NetworkCreate) Execute

func (c *NetworkCreate) Execute(ctx context.Context) (string, string, error)

type NetworkInspect

type NetworkInspect struct {
	Names  []string // names (or ids) of network to be inspected
	Format string   // value for the --format option
}

NetworkInspect represents `docker network inspect`.

func (*NetworkInspect) Execute

func (c *NetworkInspect) Execute(ctx context.Context) (string, string, error)

type NetworkList

type NetworkList struct {
	Names  []string // names (or ids) of network to be listed
	Format string   // value for the --format option. e.g. {{.ID}}
}

NetworkList represents `docker network ls`.

func (*NetworkList) Execute

func (c *NetworkList) Execute(ctx context.Context) (string, string, error)

type NetworkRemove

type NetworkRemove struct {
	Names []string // names (or ids) of network to be removed
}

NetworkRemove represents `docker network remove`.

func (*NetworkRemove) Execute

func (c *NetworkRemove) Execute(ctx context.Context) (string, string, error)

Jump to

Keyboard shortcuts

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