crane

package
v3.4.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2018 License: MIT Imports: 28 Imported by: 10

Documentation

Index

Constants

View Source
const Pro = false
View Source
const Version = "3.4.2"

Variables

This section is empty.

Functions

func RealMain

func RealMain()

Types

type AcceleratedMount

type AcceleratedMount interface {
	Run()
	Reset()
	Logs(follow bool)
	VolumeArg() string
	Volume() string
}

type AcceleratedMountMap

type AcceleratedMountMap map[string]AcceleratedMount

type BuildParameters

type BuildParameters struct {
	RawContext    string      `json:"context" yaml:"context"`
	RawFile       string      `json:"file" yaml:"file"`
	RawDockerfile string      `json:"dockerfile" yaml:"dockerfile"`
	RawBuildArgs  interface{} `json:"build-arg" yaml:"build-arg"`
	RawArgs       interface{} `json:"args" yaml:"args"`
}

func (BuildParameters) BuildArgs

func (b BuildParameters) BuildArgs() []string

func (BuildParameters) Context

func (b BuildParameters) Context() string

func (BuildParameters) File

func (b BuildParameters) File() string

type Config

type Config interface {
	DependencyMap() map[string]*Dependencies
	ContainersForReference(reference string) (result []string)
	Path() string
	UniqueID() string
	Prefix() string
	Tag() string
	NetworkNames() []string
	VolumeNames() []string
	Cmds() map[string][]string
	AcceleratedMountNames() []string
	Network(name string) Network
	Volume(name string) Volume
	Cmd(name string) []string
	AcceleratedMount(volume string) AcceleratedMount
	ContainerMap() ContainerMap
	Container(name string) Container
	ContainerInfo(name string) ContainerInfo
}

func NewConfig

func NewConfig(files []string, prefix string, tag string) Config

NewConfig retus a new config based on given location. Containers will be ordered so that they can be brought up and down with Docker.

type Container

type Container interface {
	ContainerInfo
	Exists() bool
	Running() bool
	Paused() bool
	Status() [][]string
	Provision(nocache bool)
	PullImage()
	Create(cmds []string)
	Run(cmds []string, targeted bool, detachFlag bool)
	Start(targeted bool)
	Kill()
	Stop()
	Pause()
	Unpause()
	Exec(cmds []string, privileged bool, user string)
	Rm(force bool, volumes bool)
	Logs(follow bool, since string, tail string) (sources []LogSource)
	Push()
	SetCommandsOutput(stdout, stderr io.Writer)
	CommandsOut() io.Writer
	CommandsErr() io.Writer
	BindMounts(volumeNames []string) []string
	VolumeSources() []string
	Net() string
	Networks() map[string]NetworkParameters
}

type ContainerInfo

type ContainerInfo interface {
	Name() string
	PrefixedName() string
	ActualName(bool) string
	Image() string
	ID() string
	Dependencies() *Dependencies
	BuildParams() BuildParameters
	Hooks() Hooks
}

type ContainerMap

type ContainerMap map[string]Container

ContainerMap maps the container name to its configuration

type Containers

type Containers []Container

func (Containers) Logs

func (containers Containers) Logs(follow bool, timestamps bool, tail string, colorize bool, since string)

Dump container logs.

func (Containers) Provision

func (containers Containers) Provision(nocache bool, parallel int)

Provision containers.

func (Containers) Reversed

func (containers Containers) Reversed() Containers

func (Containers) Status

func (containers Containers) Status(notrunc bool)

Status of containers.

type Dependencies

type Dependencies struct {
	All         []string
	Requires    []string
	Link        []string
	VolumesFrom []string
	Net         string
	IPC         string
}

Dependencies contains 4 fields: all: contains all dependencies requires: containers that need to be running link: containers linked to volumesFrom: containers that provide volumes net: container the net stack is shared with

type HealthcheckParameters

type HealthcheckParameters struct {
	RawTest     string `json:"test" yaml:"test"`
	RawInterval string `json:"interval" yaml:"interval"`
	RawTimeout  string `json:"timeout" yaml:"timeout"`
	Retries     int    `json:"retries" yaml:"retries"`
	Disable     bool   `json:"disable" yaml:"disable"`
}

func (HealthcheckParameters) Interval

func (h HealthcheckParameters) Interval() string

func (HealthcheckParameters) Test

func (h HealthcheckParameters) Test() string

func (HealthcheckParameters) Timeout

func (h HealthcheckParameters) Timeout() string

type Hooks added in v1.2.0

type Hooks interface {
	PreBuild() string
	PostBuild() string
	PreStart() string
	PostStart() string
	PreStop() string
	PostStop() string
}

type LogSource

type LogSource struct {
	Stdout io.Reader
	Stderr io.Reader
	Name   string
}

type LoggingParameters

type LoggingParameters struct {
	RawDriver  string      `json:"driver" yaml:"driver"`
	RawOptions interface{} `json:"options" yaml:"options"`
}

func (LoggingParameters) Driver

func (l LoggingParameters) Driver() string

func (LoggingParameters) Options

func (l LoggingParameters) Options() []string

type Network

type Network interface {
	Name() string
	Subnet() string
	ActualName() string
	Create()
	Exists() bool
}

type NetworkMap

type NetworkMap map[string]Network

type NetworkParameters

type NetworkParameters struct {
	RawAlias       interface{} `json:"alias" yaml:"alias"`
	RawAliases     interface{} `json:"aliases" yaml:"aliases"`
	RawIp          string      `json:"ip" yaml:"ip"`
	RawIpv4Address string      `json:"ipv4_address" yaml:"ipv4_address"`
	RawIp6         string      `json:"ip6" yaml:"ip6"`
	RawIpv6Address string      `json:"ipv6_address" yaml:"ipv6_address"`
}

func (NetworkParameters) Alias

func (n NetworkParameters) Alias(containerName string) []string

If aliases are not defined in the config, the container name is added as a default alias. When an empty array is configured, no default alias is used.

func (NetworkParameters) Ip

func (n NetworkParameters) Ip() string

func (NetworkParameters) Ip6

func (n NetworkParameters) Ip6() string

type OptBool added in v1.1.1

type OptBool struct {
	Defined bool
	Value   bool
}

func (OptBool) Falsy

func (o OptBool) Falsy() bool

func (OptBool) Truthy

func (o OptBool) Truthy() bool

func (*OptBool) UnmarshalJSON added in v1.1.1

func (o *OptBool) UnmarshalJSON(b []byte) (err error)

func (*OptBool) UnmarshalYAML added in v1.1.1

func (o *OptBool) UnmarshalYAML(unmarshal func(interface{}) error) error

type OptInt

type OptInt struct {
	Defined bool
	Value   int
}

func (*OptInt) UnmarshalJSON

func (o *OptInt) UnmarshalJSON(b []byte) (err error)

func (*OptInt) UnmarshalYAML

func (o *OptInt) UnmarshalYAML(unmarshal func(interface{}) error) error

type Settings

type Settings struct {
	UUID            string    `json:"uuid"`
	Version         string    `json:"version"`
	LatestVersion   string    `json:"latest_version"`
	NextUpdateCheck time.Time `json:"next_update_check"`
	CheckForUpdates bool      `json:"check_for_updates"`
	// contains filtered or unexported fields
}

func (*Settings) CorrectVersion

func (s *Settings) CorrectVersion() error

If version in settings does not match version of binary, we assume that the binary was updated and update the settings file with the new information.

func (*Settings) DelayNextUpdateCheck

func (s *Settings) DelayNextUpdateCheck() error

func (*Settings) ShouldCheckForUpdates

func (s *Settings) ShouldCheckForUpdates() bool

func (*Settings) Update

func (s *Settings) Update(latestVersion string) error

func (*Settings) Write

func (s *Settings) Write(filename string) error

type StatusError

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

type Target

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

func NewTarget

func NewTarget(dependencyMap map[string]*Dependencies, targetArg string, extendFlag bool) (target Target, err error)

NewTarget receives the specified target and determines which containers should be targeted. The target might be extended to dependencies if --extend is given. Additionally, the target is sorted alphabetically.

type UnitOfWork

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

func NewUnitOfWork

func NewUnitOfWork(dependencyMap map[string]*Dependencies, targeted []string) (uow *UnitOfWork, err error)

func (*UnitOfWork) Associated

func (uow *UnitOfWork) Associated() []string

func (*UnitOfWork) Containers

func (uow *UnitOfWork) Containers() Containers

func (*UnitOfWork) Create

func (uow *UnitOfWork) Create(cmds []string)

Create containers.

func (*UnitOfWork) Exec

func (uow *UnitOfWork) Exec(cmds []string, privileged bool, user string)

func (*UnitOfWork) Generate

func (uow *UnitOfWork) Generate(templateFile string, output string)

Generate files.

func (*UnitOfWork) Kill

func (uow *UnitOfWork) Kill()

Kill containers.

func (*UnitOfWork) Logs

func (uow *UnitOfWork) Logs(follow bool, timestamps bool, tail string, colorize bool, since string)

Log containers.

func (*UnitOfWork) Pause

func (uow *UnitOfWork) Pause()

Pause containers.

func (*UnitOfWork) Provision

func (uow *UnitOfWork) Provision(noCache bool, parallel int)

Provision containers.

func (*UnitOfWork) PullImage

func (uow *UnitOfWork) PullImage()

Pull containers.

func (*UnitOfWork) Push

func (uow *UnitOfWork) Push()

Push containers.

func (*UnitOfWork) RequiredNetworks

func (uow *UnitOfWork) RequiredNetworks() []string

func (*UnitOfWork) RequiredVolumes

func (uow *UnitOfWork) RequiredVolumes() []string

func (*UnitOfWork) Rm

func (uow *UnitOfWork) Rm(force bool, volumes bool)

Rm containers.

func (*UnitOfWork) Run

func (uow *UnitOfWork) Run(cmds []string, detach bool)

func (*UnitOfWork) Start

func (uow *UnitOfWork) Start()

Start containers.

func (*UnitOfWork) Stats

func (uow *UnitOfWork) Stats(noStream bool)

func (*UnitOfWork) Status

func (uow *UnitOfWork) Status(noTrunc bool)

func (*UnitOfWork) Stop

func (uow *UnitOfWork) Stop()

Stop containers.

func (*UnitOfWork) Targeted

func (uow *UnitOfWork) Targeted() Containers

func (*UnitOfWork) TargetedInfo

func (uow *UnitOfWork) TargetedInfo() []ContainerInfo

func (*UnitOfWork) Unpause

func (uow *UnitOfWork) Unpause()

Unpause containers.

func (*UnitOfWork) Up

func (uow *UnitOfWork) Up(cmds []string, detach bool, noCache bool, parallel int)

type UpdateRequestParams

type UpdateRequestParams struct {
	UUID    string `json:"uuid"`
	Arch    string `json:"arch"`
	OS      string `json:"os"`
	Version string `json:"version"`
	Pro     bool   `json:"pro"`
}

type UpdateResponseBody

type UpdateResponseBody struct {
	Outdated              bool   `json:"outdated"`
	LatestVersion         string `json:"latest_version"`
	LatestReleaseDate     string `json:"latest_release_date"`
	LatestInstallationUrl string `json:"latest_installation_url"`
	LatestChangelogUrl    string `json:"latest_changelog_url"`
}

type Volume

type Volume interface {
	Name() string
	ActualName() string
	Create()
	Exists() bool
}

type VolumeMap

type VolumeMap map[string]Volume

Jump to

Keyboard shortcuts

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