juju: github.com/juju/juju/api/agent Index | Files

package agent

import "github.com/juju/juju/api/agent"

Index

Package Files

facade.go state.go

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).

func IsAllowedControllerTag Uses

func IsAllowedControllerTag(kind string) bool

IsAllowedControllerTag returns true if the tag kind can be for a controller. TODO(controlleragent) - this method is needed while IAAS controllers are still machines.

func IsController Uses

func IsController(caller base.APICaller, tag names.Tag) (bool, error)

IsController returns true of the tag is for a controller (machine or agent). TODO(controlleragent) - this method is needed while IAAS controllers are still machines.

type ConnFacade Uses

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 Uses

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

NewConnFacade returns a ConnFacade backed by the supplied APICaller.

type Entity Uses

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

func (*Entity) ClearReboot Uses

func (m *Entity) ClearReboot() error

ClearReboot clears the reboot flag of the machine.

func (*Entity) ContainerType Uses

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 Uses

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 Uses

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

Life returns the current life cycle state of the entity.

func (*Entity) SetPassword Uses

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

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

func (*Entity) Tag Uses

func (m *Entity) Tag() string

Tag returns the entity's tag.

type Life Uses

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 Uses

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 Uses

func NewState(caller base.APICaller) (*State, error)

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

func (*State) Entity Uses

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

func (*State) IsMaster Uses

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 Uses

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

Package agent imports 9 packages (graph) and is imported by 274 packages. Updated 2019-08-23. Refresh now. Tools for package owners.