dockercompose

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusDown   = "down"
	StatusInProg = "in progress"
	StatusUp     = "up"
	StatusCrash  = "crash"
)

Three hacky states just for now to get something into the hud.

Variables

This section is empty.

Functions

func FormatError

func FormatError(cmd *exec.Cmd, stdout []byte, err error) error

Types

type Action

type Action int
const (

	// CONTAINER actions
	ActionUnknown Action = iota
	ActionAttach
	ActionCommit
	ActionCopy
	ActionCreate
	ActionDestroy
	ActionDie
	ActionExecCreate
	ActionExecDetach
	ActionExecDie
	ActionExecStart
	ActionExport
	ActionHealthStatus
	ActionKill
	ActionOom
	ActionPause
	ActionRename
	ActionResize
	ActionRestart
	ActionStart
	ActionStop
	ActionTop
	ActionUnpause
	ActionUpdate
)

func (Action) MarshalJSON added in v0.4.3

func (a Action) MarshalJSON() ([]byte, error)

func (Action) String added in v0.4.3

func (a Action) String() string

func (*Action) UnmarshalJSON

func (a *Action) UnmarshalJSON(b []byte) error

type Attributes

type Attributes struct {
	Name  string `json:"name"`
	Image string `json:"image"`
}

type DockerComposeClient

type DockerComposeClient interface {
	Up(ctx context.Context, configPath, serviceName string, stdout, stderr io.Writer) error
	Down(ctx context.Context, configPath string, stdout, stderr io.Writer) error
	StreamLogs(ctx context.Context, configPath, serviceName string) (io.ReadCloser, error)
	StreamEvents(ctx context.Context, configPath string) (<-chan string, error)
	Config(ctx context.Context, configPath string) (string, error)
	Services(ctx context.Context, configPath string) (string, error)
}

func NewDockerComposeClient

func NewDockerComposeClient() DockerComposeClient

TODO(dmiller): we might want to make this take a path to the docker-compose config so we don't have to keep passing it in.

type Event

type Event struct {
	Time       string     `json:"time"` // todo: time
	Type       Type       `json:"type"`
	Action     Action     `json:"action"`
	ID         string     `json:"id"` // todo: type?
	Service    string     `json:"service"`
	Attributes Attributes `json:"attributes"`
}

func EventFromJsonStr

func EventFromJsonStr(j string) (Event, error)

func (Event) GuessStatus

func (evt Event) GuessStatus() string

func (Event) IsStartupEvent added in v0.4.2

func (evt Event) IsStartupEvent() bool

func (Event) IsStopEvent added in v0.4.3

func (evt Event) IsStopEvent() bool

type FakeDCClient

type FakeDCClient struct {
	RunLogOutput map[model.ManifestName]string
	// contains filtered or unexported fields
}

func NewFakeDockerComposeClient

func NewFakeDockerComposeClient(t *testing.T) *FakeDCClient

func (*FakeDCClient) Config

func (c *FakeDCClient) Config(ctx context.Context, pathToConfig string) (string, error)

func (*FakeDCClient) Down

func (c *FakeDCClient) Down(ctx context.Context, pathToConfig string, stdout, stderr io.Writer) error

func (*FakeDCClient) SendEvent

func (c *FakeDCClient) SendEvent(evt Event) error

func (*FakeDCClient) Services

func (c *FakeDCClient) Services(ctx context.Context, pathToConfig string) (string, error)

func (*FakeDCClient) StreamEvents

func (c *FakeDCClient) StreamEvents(ctx context.Context, pathToConfig string) (<-chan string, error)

func (*FakeDCClient) StreamLogs

func (c *FakeDCClient) StreamLogs(ctx context.Context, pathToConfig, serviceName string) (io.ReadCloser, error)

func (*FakeDCClient) Up

func (c *FakeDCClient) Up(ctx context.Context, pathToConfig, serviceName string, stdout, stderr io.Writer) error

type State

type State struct {
	Status     string
	CurrentLog []byte
	StartTime  time.Time
	IsStopping bool
}

func (State) Log

func (s State) Log() string

func (State) ResourceState

func (State) ResourceState()

func (State) WithCurrentLog

func (s State) WithCurrentLog(b []byte) State

func (State) WithStartTime added in v0.4.2

func (s State) WithStartTime(time time.Time) State

func (State) WithStatus

func (s State) WithStatus(status string) State

TODO(dmiller): this should take a status type or something to guarantee that it's one of the valid statuses

func (State) WithStopping added in v0.4.3

func (s State) WithStopping(stopping bool) State

type Type

type Type int

https://docs.docker.com/engine/reference/commandline/events/

const (
	// Add 'types' here (and to `stringToType` below) as we support them
	TypeUnknown Type = iota
	TypeContainer
)

func (Type) MarshalJSON added in v0.4.3

func (t Type) MarshalJSON() ([]byte, error)

func (Type) String added in v0.4.3

func (t Type) String() string

func (*Type) UnmarshalJSON

func (t *Type) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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