Documentation ¶
Index ¶
- Constants
- func GetMachineIP(unitMachine string) string
- func IsNotFoundError(err error) bool
- type ClientAPI
- func (this *ClientAPI) Destroy(name string) error
- func (this *ClientAPI) JournalF(name string) (chan string, error)
- func (this *ClientAPI) Load(name string) error
- func (this *ClientAPI) MachineAll() ([]MachineStatus, error)
- func (this *ClientAPI) Start(name string) error
- func (this *ClientAPI) Status(name string) (*Status, error)
- func (this *ClientAPI) StatusAll() ([]UnitStatus, error)
- func (this *ClientAPI) StatusUnit(name string) (UnitStatus, error)
- func (this *ClientAPI) Stop(name string) error
- func (this *ClientAPI) Submit(name, filePath string) error
- func (this *ClientAPI) Unit(name string) (*schema.Unit, error)
- type ClientCLI
- func (this *ClientCLI) Destroy(name string) error
- func (this *ClientCLI) JournalF(name string) (chan string, error)
- func (this *ClientCLI) Load(name string) error
- func (this *ClientCLI) MachineAll() ([]MachineStatus, error)
- func (this *ClientCLI) Start(name string) error
- func (this *ClientCLI) Status(name string) (*Status, error)
- func (this *ClientCLI) StatusAll() ([]UnitStatus, error)
- func (this *ClientCLI) StatusUnit(name string) (UnitStatus, error)
- func (this *ClientCLI) Stop(name string) error
- func (this *ClientCLI) Submit(name, filePath string) error
- func (this *ClientCLI) Unit(name string) (*schema.Unit, error)
- type FleetClient
- type FleetClientError
- type MachineStatus
- type Status
- type UnitStatus
Constants ¶
const ( STATE_LAUNCHED = "launched" STATE_LOADED = "loaded" STATE_INACTIVE = "inactive" LOAD_UNKNOWN = "-" LOAD_LOADED = "loaded" // See https://github.com/coreos/fleet/blob/master/job/job.go ACTIVE_UNKNOWN = "-" ACTIVE_ACTIVE = "active" ACTIVE_ACTIVATING = "activating" ACTIVE_FAILED = "failed" SUB_UNKNOWN = "-" SUB_DEAD = "dead" SUB_LAUNCHED = "launched" SUB_START = "start" SUB_START_PRE = "start-pre" SUB_RUNNING = "running" SUB_EXITED = "exited" SUB_FAILED = "failed" )
const ( FLEETCTL = "fleetctl" ENDPOINT_OPTION = "--endpoint" ENDPOINT_VALUE = "http://172.17.42.1:4001" )
const (
ERROR_TYPE_NOT_FOUND = 10000 + iota
)
const (
FLEET_SOCK = "/var/run/fleet.sock"
)
Variables ¶
This section is empty.
Functions ¶
func GetMachineIP ¶
GetMachineIP parses the unitMachine in format "uuid/ip" and returns only the IP part. Can be used with the {UnitStatus.Machine} field. Returns an empty string, if no ip was found.
func IsNotFoundError ¶
Types ¶
type ClientAPI ¶
type ClientAPI struct {
// contains filtered or unexported fields
}
func (*ClientAPI) MachineAll ¶
func (this *ClientAPI) MachineAll() ([]MachineStatus, error)
func (*ClientAPI) StatusAll ¶
func (this *ClientAPI) StatusAll() ([]UnitStatus, error)
func (*ClientAPI) StatusUnit ¶
func (this *ClientAPI) StatusUnit(name string) (UnitStatus, error)
type ClientCLI ¶
type ClientCLI struct {
// contains filtered or unexported fields
}
func (*ClientCLI) MachineAll ¶
func (this *ClientCLI) MachineAll() ([]MachineStatus, error)
func (*ClientCLI) StatusAll ¶
func (this *ClientCLI) StatusAll() ([]UnitStatus, error)
StatusAll executes "fleetctl status" and parses the output table. Thus, certain fields can be mangled or shortened, e.g. the machine column.
func (*ClientCLI) StatusUnit ¶
func (this *ClientCLI) StatusUnit(name string) (UnitStatus, error)
StatusUnit returns the UnitStatus for the given unitfile. If the unit is not found or could not be retrieved, an error will be returned.
Internally it executes `fleetctl status` and looks for the matching unit file. Its {UnitStatus} will be returned.
type FleetClient ¶
type FleetClient interface { // A Unit is a submitted job known by fleet, but not started yet. Submitting // a job creates a unit. Unit() returns such an object. Further a Unit has // different properties than a ScheduledUnit. Unit(name string) (*schema.Unit, error) Submit(name, filePath string) error Start(name string) error Stop(name string) error Load(name string) error Destroy(name string) error Status(name string) (*Status, error) // Deprecated, use StatusUnit() StatusUnit(name string) (UnitStatus, error) StatusAll() ([]UnitStatus, error) JournalF(name string) (chan string, error) MachineAll() ([]MachineStatus, error) }
func NewClient ¶
func NewClient() FleetClient
func NewClientAPI ¶
func NewClientAPI() FleetClient
func NewClientAPIWithSocket ¶
func NewClientAPIWithSocket(socket string) FleetClient
func NewClientCLI ¶
func NewClientCLI() FleetClient
func NewClientCLIWithPeer ¶
func NewClientCLIWithPeer(etcdPeer string) FleetClient
type FleetClientError ¶
func NewFleetClientError ¶
func NewFleetClientError(code int, text string) FleetClientError
func (FleetClientError) Error ¶
func (this FleetClientError) Error() string
type MachineStatus ¶
type UnitStatus ¶
type UnitStatus struct { // Unit Name with file extension Unit string State string // "-", "loaded" Load string // "-", "active", "failed" Active string // The state of the unit, e.g. "-", "running" or "failed". See the SUB_* constants. Sub string // The machine that is used to execute the unit. // Is "-", when no machine is assigned. // Otherwise is in the format of "uuid/ip", where uuid is shortened version of the host uuid // and IP is the IP assigned to that machine. Machine string }
func (UnitStatus) MachineIP ¶
func (status UnitStatus) MachineIP() string
MachineIP returns the IP of the used machine, if available, an empty string otherwise. Alias for `return GetMachineIp(status.Machine)`.