core

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultShell     = "sh"
	DefaultTTY       = false
	DefaultStdin     = true
	DefaultAutoTTY   = true
	DefaultAutoStdin = true
)

Runtime settings

Variables

View Source
var ErrContainerNotFound = errors.New("Can't find the container")

Functions

This section is empty.

Types

type Client

type Client struct {
	Container ContainerAdapter
}

type Command

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

type CommandConfig

type CommandConfig struct {
	Compose    string   `yaml:"compose,omitempty"`
	TTY        *bool    `yaml:"tty,omitempty"`
	Stdin      *bool    `yaml:"stdin,omitempty"`
	Envs       []string `yaml:"envs,omitempty"`
	User       string   `yaml:"user,omitempty"`
	WorkingDir *string  `yaml:"workdir,omitempty"`
	Shell      string   `yaml:"shell,omitempty"`
	Options    string   `yaml:"options,omitempty"`
}

CommandConfig represents command's configuration

func NewCommandConfig

func NewCommandConfig() *CommandConfig

type CommandExecOptions

type CommandExecOptions struct {
	All        bool
	Print      bool
	Cmd        string
	CmdArgs    []string
	ConfigPath string
	Save       bool
	Shell      string
	Envs       []string
	Compose    string
	User       string
	WorkDir    string
	Stdin      bool
	NoStdin    bool
	Tty        bool
	NoTty      bool
}

type CommandInitOptions

type CommandInitOptions struct {
	Image string
	Name  string
	Skip  bool
}

type CommandLinkOptions

type CommandLinkOptions struct {
	All  bool
	Cmds []string
}

type CommandPathOptions

type CommandPathOptions struct {
	Delete bool
}

type CommandProcessOptions

type CommandProcessOptions struct {
}

type CommandStartOptions

type CommandStartOptions struct {
	Name    string
	Envs    []string
	Ports   []string
	Volumes []string
}

type CommandStopOptions

type CommandStopOptions struct {
}

type Config

type Config struct {
	Image   string   `yaml:"image"`
	Name    string   `yaml:"name"`
	Compose string   `yaml:"compose,omitempty"`
	Path    string   `yaml:"-"`
	Runs    []string `yaml:"runs,omitempty"`
	Envs    []string `yaml:"envs,omitempty"`
	Ports   []string `yaml:"ports,omitempty"`
	Volumes []string `yaml:"volumes,omitempty"`

	// Command's config
	Defaults *CommandConfig           `yaml:"defaults,omitempty"`
	Commands map[string]CommandConfig `yaml:"commands,omitempty"`
}

Config represents global configuration

Loading orders during init & start:

  • core.NewConfig() // without default settings (CommandConfig)
  • command line args

Loading orders during exec:

  • core.NewConfigWithDefaults()
  • dpx.yml
  • runtime defaults
  • command line args

cli args > bin (dpx.yml) > global (dpx.yml) > default

func NewConfig

func NewConfig() *Config

func NewConfigWithDefaults

func NewConfigWithDefaults() *Config

type ConfigSaveOptions

type ConfigSaveOptions struct {
	SaveDefaults bool
}

type ConfigService

type ConfigService interface {
	Command(cmd string, cf *Config) *CommandConfig
	Save(cf *Config, opts ConfigSaveOptions) error
	CreateAliasFile() (Path, error)
	CreateBinFile(cmd string) (Path, error)
}

type Container

type Container struct {
	ID string
}

type ContainerCreateOptions

type ContainerCreateOptions struct {
	Image      string
	Name       string
	Ports      []string
	Envs       []string
	Volumes    []string
	WorkingDir string
}

type ContainerCreateResult

type ContainerCreateResult struct {
	ID string
}

type ContainerCreateService

type ContainerCreateService interface {
	Create(ctx context.Context, options ContainerCreateOptions) (Container, error)
	Start(ctx context.Context, ID string) error
	Stop(ctx context.Context, ID string) error
}

type ContainerExecErr

type ContainerExecErr struct {
	Code int
}

func (*ContainerExecErr) Error

func (e *ContainerExecErr) Error() string

type ContainerExecOptions

type ContainerExecOptions struct {
	ID     string
	Cmd    []string
	Config *CommandConfig
	Output bool
}

type ContainerExecService

type ContainerExecService interface {
	Exec(ctx context.Context, options ContainerExecOptions) error
	Inspect(ctx context.Context, ID string) (ContainerInspectResult, error)
}

type ContainerFindOptions

type ContainerFindOptions struct {
	Name    string
	Image   string
	Compose string
	Volume  string
	All     bool
}

type ContainerFindService

type ContainerFindService interface {
	Find(ctx context.Context, options ContainerFindOptions) (Container, error)
	FindAll(ctx context.Context, options ContainerFindOptions) ([]Container, error)
}

type ContainerInspectResult

type ContainerInspectResult struct {
	Running  bool
	ExitCode int
}

type ContainerStartOptions

type ContainerStartOptions struct{}

type ContainerStartResult

type ContainerStartResult struct{}

type Docker

type Docker interface {
	// NewClient() *Docker
	ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *specs.Platform, containerName string) (container.ContainerCreateCreatedBody, error)
	ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error
	ContainerStop(ctx context.Context, containerID string, timeout *time.Duration) error
	ContainerWait(ctx context.Context, containerID string, condition container.WaitCondition) (<-chan container.ContainerWaitOKBody, <-chan error)

	ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)

	// ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error
	// ContainerCreate() string
	ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, 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
}

type Image

type Image struct {
	ID   string
	Name string
}

type ImageAdapter

type ImageAdapter interface {
	Find(ctx context.Context, image string) ([]Image, error)
	Pull(ctx context.Context, image string) error
}

type Path

type Path string

type Stream

type Stream struct {
}

Jump to

Keyboard shortcuts

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