fleet

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2015 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

fleet is a package for communicating with Fleet's HTTP API to list units and their states, launch new units, and destroy units. It uses the API that is documented here:

https://github.com/coreos/fleet/blob/master/Documentation/api-v1.md

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(path string) client

NewClient construct an HTTP client using the given path as the socket to dial out to for making requests and returns a new Fleet client with the HTTP client wired up. Currently this method *only* supports communicating with Fleet over a socket.

Types

type Client

type Client interface {
	Units() ([]Unit, error)
	StartUnit(name string, options []UnitOption) (*http.Response, error)
	DestroyUnit(name string) (*http.Response, error)
	UnitState(name string) (UnitState, error)
}

Client is the main interface for the Fleet client that is implemented in this package.

type StatesResponse

type StatesResponse struct {
	States []UnitState `json:"states"`
}

StatesResponse is the wrapper for a Fleet API response containing an array of unit states and is used to deserialize JSON.

type Unit

type Unit struct {
	CurrentState string       `json:"currentState,omitempty"`
	DesiredState string       `json:"desiredState"`
	MachineID    string       `json:"machineID,omitempty"`
	Name         string       `json:"name,omitempty"`
	Options      []UnitOption `json:"options"`
}

Unit is the representation of a Fleet unit and is used to deserialze the JSON returned from the Fleet API. This is also the struct that is returned when this package returns units via Units().

type UnitOption

type UnitOption struct {
	Section string `json:"section"`
	Name    string `json:"name"`
	Value   string `json:"value"`
}

UnitOption is the representation for each of a Fleet unit's individual options. It is used to deserialze the JSON returned from the Fleet API as well as provide the information for starting a new unit.

type UnitState

type UnitState struct {
	Name        string `json:"name"`
	Hash        string `json:"hash"`
	MachineID   string `json:"machineID"`
	LoadState   string `json:"systemdLoadState"`
	ActiveState string `json:"systemdActiveState"`
	SubState    string `json:"systemdSubState"`
}

UnitState is the representation for detailed information about the current state of a Fleet unit. It is used to deserialize the JSON returned from the Fleet API when requesting the state of a given unit. This is also the struct that is returned when this package returns the state via UnitState().

type UnitsResponse

type UnitsResponse struct {
	Units []Unit `json:"units"`
}

UnitsResponse is the wrapper for a Fleet API response containing an array of units and is used to deserialize JSON.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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