cmd

package
v0.0.0-...-88921fd Latest Latest
Warning

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

Go to latest
Published: May 22, 2014 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCommand

func AddCommand(parent *cobra.Command, cmd *cobra.Command, local bool) *cobra.Command

func AddCommandExtension

func AddCommandExtension(ext CommandRegistration, local bool)

Register an extension to this server during init() or startup

func AsIdentifier

func AsIdentifier(locator Locator) containers.Identifier

func ExtendCommands

func ExtendCommands(parent *cobra.Command, local bool)

func ExtractContainerLocatorsFromDeployment

func ExtractContainerLocatorsFromDeployment(t transport.Transport, path string, args *[]string) error

Return a set of container locators from the specified deployment descriptor.

func Fail

func Fail(code int, format string, other ...interface{})

func GenerateId

func GenerateId() string

Types

type CliJobResponse

type CliJobResponse struct {
	// A response stream to output to.  Defaults to DevNull
	Output io.Writer
	// true if output should be captured rather than printed
	Gather bool

	// Data gathered during request parsing FIXME: move to marshal?
	Pending map[string]interface{}
	// Data gathered from the response
	Data interface{}
	// The error set on the response
	Error error
	// contains filtered or unexported fields
}

func (*CliJobResponse) Failure

func (s *CliJobResponse) Failure(e error)

func (*CliJobResponse) StreamResult

func (s *CliJobResponse) StreamResult() bool

func (*CliJobResponse) Success

func (s *CliJobResponse) Success(t jobs.ResponseSuccess)

func (*CliJobResponse) SuccessWithData

func (s *CliJobResponse) SuccessWithData(t jobs.ResponseSuccess, data interface{})

func (*CliJobResponse) SuccessWithWrite

func (s *CliJobResponse) SuccessWithWrite(t jobs.ResponseSuccess, flush, structured bool) io.Writer

func (*CliJobResponse) WritePending

func (s *CliJobResponse) WritePending(w io.Writer)

func (*CliJobResponse) WritePendingSuccess

func (s *CliJobResponse) WritePendingSuccess(name string, value interface{})

type CommandRegistration

type CommandRegistration func(parent *cobra.Command)

Register flags and commands underneath a parent Command

type EnvironmentDescription

type EnvironmentDescription struct {
	Description containers.EnvironmentDescription
	Path        string
}

func (*EnvironmentDescription) ExtractVariablesFrom

func (e *EnvironmentDescription) ExtractVariablesFrom(args *[]string, generateId bool) error

type Executor

type Executor struct {
	// An interface for converting requests into jobs.
	Transport transport.Transport
	// The set of destinations to act on.
	On Locators
	// Given a set of locators on the same server, create one
	// job that represents all ids.
	Group FuncBulk
	// Given a set of locators on the same server, create one
	// job per locator.
	Serial FuncSerial
	// The stream to output to, will be set to DevNull by default
	Output io.Writer
	// Optional: respond to successful calls
	OnSuccess FuncReact
	// Optional: respond to errors when they occur
	OnFailure FuncReact
}

An executor runs a number of local or remote jobs in parallel or sequentially. You must set either .Group or .Serial

func (Executor) Gather

func (e Executor) Gather() (data []interface{}, failures []error)

Invoke the appropriate job on each server and return the set of data

func (Executor) Stream

func (e Executor) Stream() (failures []error)

Stream responses from all servers to output

func (Executor) StreamAndExit

func (e Executor) StreamAndExit()

type FuncBulk

type FuncBulk func(...Locator) JobRequest

type FuncReact

type FuncReact func(*CliJobResponse, io.Writer, JobRequest)

type FuncSerial

type FuncSerial func(Locator) JobRequest

type JobRequest

type JobRequest interface{}

type Locator

type Locator interface {
	// The location of this resource
	TransportLocator() transport.Locator
	// Two resources are identical if they have the same
	// identity value.
	Identity() string
}

func NewResourceLocator

func NewResourceLocator(t transport.Transport, defaultType ResourceType, value string) (Locator, error)

type Locators

type Locators []Locator

func LocatorsForDeploymentInstances

func LocatorsForDeploymentInstances(t transport.Transport, instances deployment.InstanceRefs) (Locators, error)

func NewContainerLocators

func NewContainerLocators(t transport.Transport, values ...string) (Locators, error)

func NewHostLocators

func NewHostLocators(t transport.Transport, values ...string) (Locators, error)

func NewResourceLocators

func NewResourceLocators(t transport.Transport, defaultType ResourceType, values ...string) (Locators, error)

func (Locators) Group

func (locators Locators) Group() (remote []Locators)

Group resource locators by their transport location

type NetworkLinks struct {
	*containers.NetworkLinks
}

func (*NetworkLinks) Get

func (n *NetworkLinks) Get() interface{}

func (*NetworkLinks) Set

func (n *NetworkLinks) Set(s string) error

func (*NetworkLinks) String

func (n *NetworkLinks) String() string

type PortPairs

type PortPairs struct {
	*port.PortPairs
}

func (*PortPairs) Get

func (p *PortPairs) Get() interface{}

func (*PortPairs) Set

func (p *PortPairs) Set(s string) error

func (*PortPairs) String

func (p *PortPairs) String() string

type ResourceLocator

type ResourceLocator struct {
	// The type of resource being referenced
	Type ResourceType
	// The identifier of the resource at this location
	Id string
	// A label representing a server (varies by transport)
	At transport.Locator
}

The resource on a server reachable via a transport.

func (*ResourceLocator) Identity

func (r *ResourceLocator) Identity() string

func (*ResourceLocator) TransportLocator

func (r *ResourceLocator) TransportLocator() transport.Locator

type ResourceLocators

type ResourceLocators []ResourceLocator

type ResourceType

type ResourceType string

Disambiguate resources with the same id via their type

const ResourceTypeContainer ResourceType = "ctr"

A container resource

func SplitTypeHostSuffix

func SplitTypeHostSuffix(value string) (res ResourceType, host string, suffix string, err error)

Given a command line string representing a resource, break it into type, host identity, and suffix

type ResourceValidator

type ResourceValidator interface {
	Type() ResourceType
}

Directories

Path Synopsis
An executable that can run as an agent for remote execution, make calls to a remote agent, or invoke commands locally.
An executable that can run as an agent for remote execution, make calls to a remote agent, or invoke commands locally.
An executable for executing a process inside a running Docker container.
An executable for executing a process inside a running Docker container.

Jump to

Keyboard shortcuts

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