agent

package
v0.0.0-...-6cf1bc9 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2016 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDenied = errors.New("entity operation impossible")

ErrDenied is returned by Life and SetPassword to indicate that the requested operation is impossible (and hence that the entity is either dead or gone, and in either case that no further meaningful interaction is possible).

Functions

This section is empty.

Types

type ConnFacade

type ConnFacade interface {

	// Life returns Alive, Dying, Dead, ErrDenied, or some other error.
	Life(names.Tag) (Life, error)

	// SetPassword returns nil, ErrDenied, or some other error.
	SetPassword(names.Tag, string) error
}

ConnFacade exposes the parts of the Agent facade needed by the bits that currently live in apicaller. This criterion is every bit as terrible as it sounds -- surely there should be a new facade at the apiserver level somewhere? -- but:

  1. this feels like a convenient/transitional method grouping, not a fundamental *role*; and
  2. at least it's a narrowed interface, and eschews the object-style sins of *State/*Entity.

Progress not perfection.

func NewConnFacade

func NewConnFacade(caller base.APICaller) (ConnFacade, error)

NewConnFacade returns a ConnFacade backed by the supplied APICaller.

type Entity

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

func (*Entity) ClearReboot

func (m *Entity) ClearReboot() error

ClearReboot clears the reboot flag of the machine.

func (*Entity) ContainerType

func (m *Entity) ContainerType() instance.ContainerType

ContainerType returns the type of container hosting this entity. If the entity is not a machine, it returns an empty string.

func (*Entity) Jobs

func (m *Entity) Jobs() []multiwatcher.MachineJob

Jobs returns the set of configured jobs if the API is running on behalf of a machine agent. When running for other agents, it will return the empty list.

func (*Entity) Life

func (m *Entity) Life() params.Life

Life returns the current life cycle state of the entity.

func (*Entity) SetPassword

func (m *Entity) SetPassword(password string) error

SetPassword sets the password associated with the agent's entity.

func (*Entity) Tag

func (m *Entity) Tag() string

Tag returns the entity's tag.

type Life

type Life string

Life is a local representation of entity life. Should probably be in a core/life or core/entity package; and quite probably, so should the ConnFacade interface.

const (
	Alive Life = "alive"
	Dying Life = "dying"
	Dead  Life = "dead"
)

type State

type State struct {
	*common.ModelWatcher
	*cloudspec.CloudSpecAPI
	*common.ControllerConfigAPI
	// contains filtered or unexported fields
}

State provides access to an agent's view of the state.

func NewState

func NewState(caller base.APICaller) *State

NewState returns a version of the state that provides functionality required by agent code.

func (*State) Entity

func (st *State) Entity(tag names.Tag) (*Entity, error)

func (*State) IsMaster

func (st *State) IsMaster() (bool, error)

IsMaster reports whether the connected machine agent lives at the same network address as the primary mongo server for the replica set. This call will return an error if the connected agent is not a machine agent with model-manager privileges.

func (*State) StateServingInfo

func (st *State) StateServingInfo() (params.StateServingInfo, error)

func (*State) WatchCredential

func (c *State) WatchCredential(tag names.CloudCredentialTag) (watcher.NotifyWatcher, error)

WatchCredential returns a watcher which reports when the specified credential has changed.

Jump to

Keyboard shortcuts

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