Documentation ¶
Index ¶
- Constants
- func AddCommand(parent *cobra.Command, cmd *cobra.Command, local bool) *cobra.Command
- func AddCommandExtension(ext CommandRegistration, local bool)
- func AddInitializer(init FuncInit, when ...string)
- func ExtendCommands(parent *cobra.Command, local bool)
- func Fail(code int, format string, other ...interface{})
- func Initialize(when ...string) error
- func LocatorsAreEqual(a, b Locator) bool
- type CliJobResponse
- func (s *CliJobResponse) Failure(e jobs.JobError)
- func (s *CliJobResponse) StreamResult() bool
- func (s *CliJobResponse) Success(t jobs.JobResponseSuccess)
- func (s *CliJobResponse) SuccessWithData(t jobs.JobResponseSuccess, data interface{})
- func (s *CliJobResponse) SuccessWithWrite(t jobs.JobResponseSuccess, flush, structured bool) io.Writer
- func (s *CliJobResponse) WriteClosed() <-chan bool
- func (s *CliJobResponse) WritePending(w io.Writer)
- func (s *CliJobResponse) WritePendingSuccess(name string, value interface{})
- type CommandRegistration
- type ContainerLocator
- type Executor
- type FuncBulk
- type FuncInit
- type FuncReact
- type FuncSerial
- type GenericLocator
- type HostLocator
- func (r *HostLocator) BaseURL() *url.URL
- func (r *HostLocator) HostIdentity() string
- func (r *HostLocator) Identity() string
- func (r *HostLocator) IsDefaultPort() bool
- func (r *HostLocator) IsRemote() bool
- func (h *HostLocator) NewURI() (*url.URL, error)
- func (r *HostLocator) ResolvedHostname() string
- func (r *HostLocator) ResourceType() ResourceType
- type Locator
- type Locators
- type ResourceLocator
- type ResourceType
Constants ¶
View Source
const ForDaemon = "daemon"
Initializers that should be loaded when the daemon is loaded
View Source
const ForLocal = "local"
Initializers that should be used whenever a local command is run
Variables ¶
This section is empty.
Functions ¶
func AddCommand ¶
func AddCommandExtension ¶
func AddCommandExtension(ext CommandRegistration, local bool)
Register an extension to this server during init() or startup
func AddInitializer ¶
Register an initializer to be invoked and an optional list of conditions. If no conditions are passed the initializer is run whenever a command invokes cmd.Initialize()
func ExtendCommands ¶
func Initialize ¶
func LocatorsAreEqual ¶
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 jobs.JobError // contains filtered or unexported fields }
func (*CliJobResponse) Failure ¶
func (s *CliJobResponse) Failure(e jobs.JobError)
func (*CliJobResponse) StreamResult ¶
func (s *CliJobResponse) StreamResult() bool
func (*CliJobResponse) Success ¶
func (s *CliJobResponse) Success(t jobs.JobResponseSuccess)
func (*CliJobResponse) SuccessWithData ¶
func (s *CliJobResponse) SuccessWithData(t jobs.JobResponseSuccess, data interface{})
func (*CliJobResponse) SuccessWithWrite ¶
func (s *CliJobResponse) SuccessWithWrite(t jobs.JobResponseSuccess, flush, structured bool) io.Writer
func (*CliJobResponse) WriteClosed ¶
func (s *CliJobResponse) WriteClosed() <-chan bool
func (*CliJobResponse) WritePending ¶
func (s *CliJobResponse) WritePending(w io.Writer)
func (*CliJobResponse) WritePendingSuccess ¶
func (s *CliJobResponse) WritePendingSuccess(name string, value interface{})
type CommandRegistration ¶
Register flags and commands underneath a parent Command
type ContainerLocator ¶
type ContainerLocator struct { HostLocator Id containers.Identifier }
func NewContainerLocator ¶
func NewContainerLocator(value string) (*ContainerLocator, error)
func (*ContainerLocator) Identifier ¶
func (r *ContainerLocator) Identifier() containers.Identifier
func (*ContainerLocator) Identity ¶
func (r *ContainerLocator) Identity() string
func (*ContainerLocator) ResourceType ¶
func (r *ContainerLocator) ResourceType() ResourceType
type Executor ¶
type Executor struct { On []Locator // 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: specify an initializer for local execution LocalInit FuncInit // 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) StreamAndExit ¶
func (e Executor) StreamAndExit()
type FuncInit ¶
type FuncInit func() error
func InitializeAll ¶
func LocalInitializers ¶
Helper function for invoking local initializers.
type FuncReact ¶
type FuncReact func(*CliJobResponse, io.Writer, interface{})
type FuncSerial ¶
type GenericLocator ¶
type GenericLocator struct { HostLocator Id containers.Identifier Type ResourceType }
func (*GenericLocator) Identifier ¶
func (r *GenericLocator) Identifier() containers.Identifier
func (*GenericLocator) Identity ¶
func (r *GenericLocator) Identity() string
func (*GenericLocator) ResourceType ¶
func (r *GenericLocator) ResourceType() ResourceType
type HostLocator ¶
func NewHostLocator ¶
func NewHostLocator(value string) (*HostLocator, error)
func (*HostLocator) BaseURL ¶
func (r *HostLocator) BaseURL() *url.URL
func (*HostLocator) HostIdentity ¶
func (r *HostLocator) HostIdentity() string
func (*HostLocator) Identity ¶
func (r *HostLocator) Identity() string
func (*HostLocator) IsDefaultPort ¶
func (r *HostLocator) IsDefaultPort() bool
func (*HostLocator) IsRemote ¶
func (r *HostLocator) IsRemote() bool
func (*HostLocator) ResolvedHostname ¶
func (r *HostLocator) ResolvedHostname() string
func (*HostLocator) ResourceType ¶
func (r *HostLocator) ResourceType() ResourceType
type Locator ¶
type Locator interface { ResourceType() ResourceType IsRemote() bool Identity() string HostIdentity() string }
func NewGenericLocator ¶
func NewGenericLocator(defaultType ResourceType, value string) (Locator, error)
type Locators ¶
type Locators []Locator
func NewContainerLocators ¶
func NewGenericLocators ¶
func NewGenericLocators(defaultType ResourceType, values ...string) (Locators, error)
func NewHostLocators ¶
type ResourceLocator ¶
type ResourceLocator interface {
Identifier() containers.Identifier
}
type ResourceType ¶
type ResourceType string
const ( LocalHostName = "local" ResourceTypeContainer ResourceType = "ctr" )
Click to show internal directories.
Click to hide internal directories.