Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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 ¶
func IsAllowedControllerTag ¶
IsAllowedControllerTag returns true if the tag kind can be for a controller. TODO(controlleragent) - this method is needed while IAAS controllers are still machines.
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:
- this feels like a convenient/transitional method grouping, not a fundamental *role*; and
- 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 ¶
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() []model.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) SetPassword ¶
SetPassword sets the password associated with the agent's entity.
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.
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 ¶
NewState returns a version of the state that provides functionality required by agent code.
func (*State) IsMaster ¶
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() (controller.StateServingInfo, error)