Documentation ¶
Index ¶
- Variables
- func ErrIfNotVersionFn(minVersion int, bestAPIVersion int) func(string) error
- type Action
- type Application
- func (s *Application) CharmModifiedVersion() (int, error)
- func (s *Application) CharmURL() (*charm.URL, bool, error)
- func (s *Application) Life() params.Life
- func (s *Application) Name() string
- func (s *Application) Refresh() error
- func (s *Application) SetStatus(unitName string, appStatus status.Status, info string, ...) error
- func (s *Application) Status(unitName string) (params.ApplicationStatusResult, error)
- func (s *Application) String() string
- func (s *Application) Tag() names.ApplicationTag
- func (s *Application) Watch() (watcher.NotifyWatcher, error)
- func (s *Application) WatchLeadershipSettings() (watcher.NotifyWatcher, error)
- type Charm
- type CheckAPIVersionFn
- type Endpoint
- type FacadeCallFn
- type LXDProfileAPI
- type LeadershipSettingsAccessor
- type NewNotifyWatcherFn
- type Relation
- func (r *Relation) Endpoint() (*Endpoint, error)
- func (r *Relation) Id() int
- func (r *Relation) Life() params.Life
- func (r *Relation) OtherApplication() string
- func (r *Relation) Refresh() error
- func (r *Relation) SetStatus(status relation.Status) error
- func (r *Relation) String() string
- func (r *Relation) Suspended() bool
- func (r *Relation) Tag() names.RelationTag
- func (r *Relation) Unit(u *Unit) (*RelationUnit, error)
- func (r *Relation) UpdateSuspended(suspended bool)
- type RelationStatus
- type RelationUnit
- func (ru *RelationUnit) Endpoint() Endpoint
- func (ru *RelationUnit) EnterScope() error
- func (ru *RelationUnit) LeaveScope() error
- func (ru *RelationUnit) ReadSettings(uname string) (params.Settings, error)
- func (ru *RelationUnit) Relation() *Relation
- func (ru *RelationUnit) Settings() (*Settings, error)
- func (ru *RelationUnit) Watch() (watcher.RelationUnitsWatcher, error)
- type Settings
- type State
- func (st *State) Action(tag names.ActionTag) (*Action, error)
- func (st *State) ActionBegin(tag names.ActionTag) error
- func (st *State) ActionFinish(tag names.ActionTag, status string, results map[string]interface{}, ...) error
- func (st *State) AllMachinePorts(machineTag names.MachineTag) (map[corenetwork.PortRange]params.RelationUnit, error)
- func (st *State) Application(tag names.ApplicationTag) (*Application, error)
- func (st *State) BestAPIVersion() int
- func (st *State) Charm(curl *charm.URL) (*Charm, error)
- func (st *State) CloudSpec() (*params.CloudSpec, error)
- func (st *State) Facade() base.FacadeCaller
- func (st *State) GoalState() (application.GoalState, error)
- func (st *State) Model() (*model.Model, error)
- func (st *State) ProviderType() (string, error)
- func (st *State) Relation(relationTag names.RelationTag) (*Relation, error)
- func (st *State) RelationById(id int) (*Relation, error)
- func (st *State) SLALevel() (string, error)
- func (st *State) SetPodSpec(appName string, spec string) error
- func (st *State) Unit(tag names.UnitTag) (*Unit, error)
- func (st *State) WatchRelationUnits(relationTag names.RelationTag, unitTag names.UnitTag) (watcher.RelationUnitsWatcher, error)
- type StorageAccessor
- func (sa *StorageAccessor) DestroyUnitStorageAttachments(unitTag names.UnitTag) error
- func (sa *StorageAccessor) RemoveStorageAttachment(storageTag names.StorageTag, unitTag names.UnitTag) error
- func (sa *StorageAccessor) StorageAttachment(storageTag names.StorageTag, unitTag names.UnitTag) (params.StorageAttachment, error)
- func (sa *StorageAccessor) StorageAttachmentLife(ids []params.StorageAttachmentId) ([]params.LifeResult, error)
- func (sa *StorageAccessor) UnitStorageAttachments(unitTag names.UnitTag) ([]params.StorageAttachmentId, error)
- func (sa *StorageAccessor) WatchStorageAttachment(storageTag names.StorageTag, unitTag names.UnitTag) (watcher.NotifyWatcher, error)
- func (sa *StorageAccessor) WatchUnitStorageAttachments(unitTag names.UnitTag) (watcher.StringsWatcher, error)
- type Unit
- func (u *Unit) AddMetricBatches(batches []params.MetricBatch) (map[string]error, error)
- func (u *Unit) AddMetrics(metrics []params.Metric) error
- func (u *Unit) AddStorage(constraints map[string][]params.StorageConstraints) error
- func (u *Unit) Application() (*Application, error)
- func (u *Unit) ApplicationName() string
- func (u *Unit) ApplicationTag() names.ApplicationTag
- func (u *Unit) AssignedMachine() (names.MachineTag, error)
- func (u *Unit) AvailabilityZone() (string, error)
- func (u *Unit) CharmURL() (*charm.URL, error)
- func (u *Unit) ClearResolved() error
- func (u *Unit) ClosePorts(protocol string, fromPort, toPort int) error
- func (u *Unit) ConfigSettings() (charm.Settings, error)
- func (u *Unit) Destroy() error
- func (u *Unit) DestroyAllSubordinates() error
- func (u *Unit) EnsureDead() error
- func (u *Unit) HasSubordinates() (bool, error)
- func (u *Unit) Life() params.Life
- func (u *Unit) MeterStatus() (statusCode, statusInfo string, rErr error)
- func (u *Unit) Name() string
- func (u *Unit) NetworkInfo(bindings []string, relationId *int) (map[string]params.NetworkInfoResult, error)
- func (u *Unit) OpenPorts(protocol string, fromPort, toPort int) error
- func (u *Unit) PrincipalName() (string, bool, error)
- func (u *Unit) PrivateAddress() (string, error)
- func (u *Unit) PublicAddress() (string, error)
- func (u *Unit) Refresh() error
- func (u *Unit) RelationsStatus() ([]RelationStatus, error)
- func (u *Unit) RemoveUpgradeCharmProfileData() error
- func (u *Unit) RequestReboot() error
- func (u *Unit) Resolved() params.ResolvedMode
- func (u *Unit) SetAgentStatus(agentStatus status.Status, info string, data map[string]interface{}) error
- func (u *Unit) SetCharmURL(curl *charm.URL) error
- func (u *Unit) SetUnitStatus(unitStatus status.Status, info string, data map[string]interface{}) error
- func (u *Unit) SetUpgradeSeriesStatus(status model.UpgradeSeriesStatus, reason string) error
- func (u *Unit) String() string
- func (u *Unit) Tag() names.UnitTag
- func (u *Unit) UnitStatus() (params.StatusResult, error)
- func (u *Unit) UpgradeSeriesStatus() (model.UpgradeSeriesStatus, error)
- func (u *Unit) Watch() (watcher.NotifyWatcher, error)
- func (u *Unit) WatchActionNotifications() (watcher.StringsWatcher, error)
- func (u *Unit) WatchAddressesHash() (watcher.StringsWatcher, error)
- func (u *Unit) WatchConfigSettingsHash() (watcher.StringsWatcher, error)
- func (u *Unit) WatchLXDProfileUpgradeNotifications() (watcher.StringsWatcher, error)
- func (u *Unit) WatchMeterStatus() (watcher.NotifyWatcher, error)
- func (u *Unit) WatchRelations() (watcher.StringsWatcher, error)
- func (u *Unit) WatchStorage() (watcher.StringsWatcher, error)
- func (u *Unit) WatchTrustConfigSettingsHash() (watcher.StringsWatcher, error)
- func (u *Unit) WatchUpgradeSeriesNotifications() (watcher.NotifyWatcher, error)
Constants ¶
This section is empty.
Variables ¶
var ErrNoCharmURLSet = errors.New("unit has no charm url set")
var NewState = newStateV9
NewState creates a new client-side Uniter facade. Defined like this to allow patching during tests.
Functions ¶
Types ¶
type Action ¶
type Action struct {
// contains filtered or unexported fields
}
Action represents a single instance of an Action call, by name and params.
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
Application represents the state of an application.
func (*Application) CharmModifiedVersion ¶
func (s *Application) CharmModifiedVersion() (int, error)
CharmModifiedVersion increments every time the charm, or any part of it, is changed in some way.
func (*Application) CharmURL ¶
func (s *Application) CharmURL() (*charm.URL, bool, error)
CharmURL returns the application's charm URL, and whether units should upgrade to the charm with that URL even if they are in an error state (force flag).
NOTE: This differs from state.Application.CharmURL() by returning an error instead as well, because it needs to make an API call.
func (*Application) Life ¶
func (s *Application) Life() params.Life
Life returns the application's current life state.
func (*Application) Refresh ¶
func (s *Application) Refresh() error
Refresh refreshes the contents of the application from the underlying state.
func (*Application) SetStatus ¶
func (s *Application) SetStatus(unitName string, appStatus status.Status, info string, data map[string]interface{}) error
SetStatus sets the status of the application if the passed unitName, corresponding to the calling unit, is of the leader.
func (*Application) Status ¶
func (s *Application) Status(unitName string) (params.ApplicationStatusResult, error)
Status returns the status of the application if the passed unitName, corresponding to the calling unit, is of the leader.
func (*Application) String ¶
func (s *Application) String() string
String returns the application as a string.
func (*Application) Tag ¶
func (s *Application) Tag() names.ApplicationTag
Tag returns the application's tag.
func (*Application) Watch ¶
func (s *Application) Watch() (watcher.NotifyWatcher, error)
Watch returns a watcher for observing changes to an application.
func (*Application) WatchLeadershipSettings ¶
func (s *Application) WatchLeadershipSettings() (watcher.NotifyWatcher, error)
WatchLeadershipSettings returns a watcher which can be used to wait for leadership settings changes to be made for the application.
type Charm ¶
type Charm struct {
// contains filtered or unexported fields
}
Charm represents the state of a charm in the model.
func (*Charm) ArchiveSha256 ¶
ArchiveSha256 returns the SHA256 digest of the charm archive (bundle) bytes.
NOTE: This differs from state.Charm.BundleSha256() by returning an error as well, because it needs to make an API call. It's also renamed to avoid confusion with juju deployment bundles.
TODO(dimitern): 2013-09-06 bug 1221834 Cache the result after getting it once for the same charm URL, because it's immutable.
type CheckAPIVersionFn ¶
type Endpoint ¶
type Endpoint struct {
charm.Relation
}
Endpoint represents one endpoint of a relation. It is just a wrapper around charm.Relation. No API calls to the server-side are needed to support the interface needed by the uniter worker.
type FacadeCallFn ¶
type LXDProfileAPI ¶
type LXDProfileAPI struct {
// contains filtered or unexported fields
}
LXDProfileAPI provides common agent-side API functions
func NewLXDProfileAPI ¶
func NewLXDProfileAPI(facade base.FacadeCaller, tag names.Tag) *LXDProfileAPI
NewLXDProfileAPI creates a LXDProfileAPI on the specified facade, and uses this name when calling through the caller.
func (*LXDProfileAPI) RemoveUpgradeCharmProfileData ¶
func (u *LXDProfileAPI) RemoveUpgradeCharmProfileData() error
RemoveUpgradeCharmProfileData removes the lxd profile status instance data for a machine
func (*LXDProfileAPI) WatchLXDProfileUpgradeNotifications ¶
func (u *LXDProfileAPI) WatchLXDProfileUpgradeNotifications(applicationName string) (watcher.StringsWatcher, error)
WatchLXDProfileUpgradeNotifications returns a StringsWatcher for observing the state of a LXD profile upgrade
type LeadershipSettingsAccessor ¶
type LeadershipSettingsAccessor struct {
// contains filtered or unexported fields
}
LeadershipSettingsAccessor provides a type that can make RPC calls to a service which can read, write, and watch leadership settings.
func NewLeadershipSettingsAccessor ¶
func NewLeadershipSettingsAccessor( caller FacadeCallFn, newWatcher NewNotifyWatcherFn, checkAPIVersion CheckAPIVersionFn, ) *LeadershipSettingsAccessor
NewLeadershipSettingsAccessor returns a new LeadershipSettingsAccessor.
func (*LeadershipSettingsAccessor) Merge ¶
func (lsa *LeadershipSettingsAccessor) Merge(appId, unitId string, settings map[string]string) error
Merge merges the provided settings into the leadership settings for the given application and unit. Only leaders of a given application may perform this operation.
func (*LeadershipSettingsAccessor) Read ¶
func (lsa *LeadershipSettingsAccessor) Read(appId string) (map[string]string, error)
Read retrieves the leadership settings for the given application ID. Anyone may perform this operation.
func (*LeadershipSettingsAccessor) WatchLeadershipSettings ¶
func (lsa *LeadershipSettingsAccessor) WatchLeadershipSettings(appId string) (watcher.NotifyWatcher, error)
WatchLeadershipSettings returns a watcher which can be used to wait for leadership settings changes to be made for a given application ID.
type NewNotifyWatcherFn ¶
type NewNotifyWatcherFn func(params.NotifyWatchResult) watcher.NotifyWatcher
type Relation ¶
type Relation struct {
// contains filtered or unexported fields
}
Relation represents a relation between one or two application endpoints.
func (*Relation) Endpoint ¶
Endpoint returns the endpoint of the relation for the application the uniter's managed unit belongs to.
func (*Relation) Id ¶
Id returns the integer internal relation key. This is exposed because the unit agent needs to expose a value derived from this (as JUJU_RELATION_ID) to allow relation hooks to differentiate between relations with different applications.
func (*Relation) OtherApplication ¶
OtherApplication returns the name of the application on the other end of the relation (from this unit's perspective).
func (*Relation) Refresh ¶
Refresh refreshes the contents of the relation from the underlying state. It returns an error that satisfies errors.IsNotFound if the relation has been removed.
func (*Relation) Unit ¶
func (r *Relation) Unit(u *Unit) (*RelationUnit, error)
Unit returns a RelationUnit for the supplied unit.
func (*Relation) UpdateSuspended ¶
UpdateSuspended updates the in memory value of the relation's suspended attribute.
type RelationStatus ¶
type RelationStatus struct { // Tag is the relation tag. Tag names.RelationTag // Suspended is true if the relation is suspended. Suspended bool // InScope is true if the relation unit is in scope. InScope bool }
RelationStatus holds information about a relation's scope and status.
type RelationUnit ¶
type RelationUnit struct {
// contains filtered or unexported fields
}
RelationUnit holds information about a single unit in a relation, and allows clients to conveniently access unit-specific functionality.
func (*RelationUnit) Endpoint ¶
func (ru *RelationUnit) Endpoint() Endpoint
Endpoint returns the relation endpoint that defines the unit's participation in the relation.
func (*RelationUnit) EnterScope ¶
func (ru *RelationUnit) EnterScope() error
EnterScope ensures that the unit has entered its scope in the relation. When the unit has already entered its relation scope, EnterScope will report success but make no changes to state.
Otherwise, assuming both the relation and the unit are alive, it will enter scope.
If the unit is a principal and the relation has container scope, EnterScope will also create the required subordinate unit, if it does not already exist; this is because there's no point having a principal in scope if there is no corresponding subordinate to join it.
Once a unit has entered a scope, it stays in scope without further intervention; the relation will not be able to become Dead until all units have departed its scopes.
NOTE: Unlike state.RelatioUnit.EnterScope(), this method does not take settings, because uniter only uses this to supply the unit's private address, but this is not done at the server-side by the API.
func (*RelationUnit) LeaveScope ¶
func (ru *RelationUnit) LeaveScope() error
LeaveScope signals that the unit has left its scope in the relation. After the unit has left its relation scope, it is no longer a member of the relation; if the relation is dying when its last member unit leaves, it is removed immediately. It is not an error to leave a scope that the unit is not, or never was, a member of.
func (*RelationUnit) ReadSettings ¶
func (ru *RelationUnit) ReadSettings(uname string) (params.Settings, error)
ReadSettings returns a map holding the settings of the unit with the supplied name within this relation. An error will be returned if the relation no longer exists, or if the unit's application is not part of the relation, or the settings are invalid; but mere non-existence of the unit is not grounds for an error, because the unit settings are guaranteed to persist for the lifetime of the relation, regardless of the lifetime of the unit.
func (*RelationUnit) Relation ¶
func (ru *RelationUnit) Relation() *Relation
Relation returns the relation associated with the unit.
func (*RelationUnit) Settings ¶
func (ru *RelationUnit) Settings() (*Settings, error)
Settings returns a Settings which allows access to the unit's settings within the relation.
func (*RelationUnit) Watch ¶
func (ru *RelationUnit) Watch() (watcher.RelationUnitsWatcher, error)
Watch returns a watcher that notifies of changes to counterpart units in the relation.
type Settings ¶
type Settings struct {
// contains filtered or unexported fields
}
Settings manages changes to unit settings in a relation.
func (*Settings) Map ¶
Map returns all keys and values of the node.
TODO(dimitern): This differes from state.Settings.Map() - it does not return map[string]interface{}, but since all values are expected to be strings anyway, we need to fix the uniter code accordingly when migrating to the API.
func (*Settings) Set ¶
Set sets key to value.
TODO(dimitern): value must be a string. Change the code that uses this accordingly.
func (*Settings) Write ¶
Write writes changes made to s back onto its node. Keys set to empty values will be deleted, others will be updated to the new value.
TODO(dimitern): 2013-09-06 bug 1221798 Once the machine addressability changes lands, we may need to revise the logic here to take into account that the "private-address" setting for a unit can be changed outside of the uniter's control. So we may need to send diffs of what has changed to make sure we update the address (and other settings) correctly, without overwritting.
type State ¶
type State struct { *common.ModelWatcher *common.APIAddresser *common.UpgradeSeriesAPI *LXDProfileAPI *StorageAccessor LeadershipSettings *LeadershipSettingsAccessor // contains filtered or unexported fields }
State provides access to the Uniter API facade.
func (*State) ActionBegin ¶
ActionBegin marks an action as running.
func (*State) ActionFinish ¶
func (st *State) ActionFinish(tag names.ActionTag, status string, results map[string]interface{}, message string) error
ActionFinish captures the structured output of an action.
func (*State) AllMachinePorts ¶
func (st *State) AllMachinePorts(machineTag names.MachineTag) (map[corenetwork.PortRange]params.RelationUnit, error)
AllMachinePorts returns all port ranges currently open on the given machine, mapped to the tags of the unit that opened them and the relation that applies.
func (*State) Application ¶
func (st *State) Application(tag names.ApplicationTag) (*Application, error)
Application returns an application state by tag.
func (*State) BestAPIVersion ¶
BestAPIVersion returns the API version that we were able to determine is supported by both the client and the API Server.
func (*State) CloudSpec ¶
CloudSpec returns the cloud spec for the model that calling unit or application resides in. If the application has not been authorised to access its cloud spec, then an authorisation error will be returned.
func (*State) Facade ¶
func (st *State) Facade() base.FacadeCaller
Facade returns the current facade.
func (*State) GoalState ¶
func (st *State) GoalState() (application.GoalState, error)
GoalState returns a GoalState struct with the charm's peers and related units information.
func (*State) ProviderType ¶
ProviderType returns a provider type used by the current juju model.
TODO(dimitern): We might be able to drop this, once we have machine addresses implemented fully. See also LP bug 1221798.
func (*State) RelationById ¶
RelationById returns the existing relation with the given id.
func (*State) SetPodSpec ¶
SetPodSpec sets the pod spec of the specified application.
func (*State) WatchRelationUnits ¶
func (st *State) WatchRelationUnits( relationTag names.RelationTag, unitTag names.UnitTag, ) (watcher.RelationUnitsWatcher, error)
WatchRelationUnits returns a watcher that notifies of changes to the counterpart units in the relation for the given unit.
type StorageAccessor ¶
type StorageAccessor struct {
// contains filtered or unexported fields
}
func NewStorageAccessor ¶
func NewStorageAccessor(facade base.FacadeCaller) *StorageAccessor
NewStorageAccessor creates a StorageAccessor on the specified facade, and uses this name when calling through the caller.
func (*StorageAccessor) DestroyUnitStorageAttachments ¶
func (sa *StorageAccessor) DestroyUnitStorageAttachments(unitTag names.UnitTag) error
DestroyUnitStorageAttachments ensures that the specified unit's storage attachments will be removed at some point in the future.
func (*StorageAccessor) RemoveStorageAttachment ¶
func (sa *StorageAccessor) RemoveStorageAttachment(storageTag names.StorageTag, unitTag names.UnitTag) error
RemoveStorageAttachment removes the storage attachment with the specified unit and storage tags from state. This method is only expected to succeed if the storage attachment is Dead.
func (*StorageAccessor) StorageAttachment ¶
func (sa *StorageAccessor) StorageAttachment(storageTag names.StorageTag, unitTag names.UnitTag) (params.StorageAttachment, error)
StorageAttachment returns the storage attachment with the specified unit and storage tags.
func (*StorageAccessor) StorageAttachmentLife ¶
func (sa *StorageAccessor) StorageAttachmentLife(ids []params.StorageAttachmentId) ([]params.LifeResult, error)
StorageAttachmentLife returns the lifecycle state of the storage attachments with the specified IDs.
func (*StorageAccessor) UnitStorageAttachments ¶
func (sa *StorageAccessor) UnitStorageAttachments(unitTag names.UnitTag) ([]params.StorageAttachmentId, error)
UnitStorageAttachments returns the IDs of a unit's storage attachments.
func (*StorageAccessor) WatchStorageAttachment ¶
func (sa *StorageAccessor) WatchStorageAttachment(storageTag names.StorageTag, unitTag names.UnitTag) (watcher.NotifyWatcher, error)
WatchStorageAttachments starts a watcher for changes to the info of the storage attachment with the specified unit and storage tags.
func (*StorageAccessor) WatchUnitStorageAttachments ¶
func (sa *StorageAccessor) WatchUnitStorageAttachments(unitTag names.UnitTag) (watcher.StringsWatcher, error)
WatchUnitStorageAttachments starts a watcher for changes to storage attachments related to the unit. The watcher will return the IDs of the corresponding storage instances.
type Unit ¶
type Unit struct {
// contains filtered or unexported fields
}
Unit represents a juju unit as seen by a uniter worker.
func (*Unit) AddMetricBatches ¶
AddMetricsBatches makes an api call to the uniter requesting it to store metrics batches in state.
func (*Unit) AddMetrics ¶
AddMetrics adds the metrics for the unit.
func (*Unit) AddStorage ¶
func (u *Unit) AddStorage(constraints map[string][]params.StorageConstraints) error
AddStorage adds desired storage instances to a unit.
func (*Unit) Application ¶
func (u *Unit) Application() (*Application, error)
Application returns the unit's application.
func (*Unit) ApplicationName ¶
ApplicationName returns the application name.
func (*Unit) ApplicationTag ¶
func (u *Unit) ApplicationTag() names.ApplicationTag
ApplicationTag returns the application tag.
func (*Unit) AssignedMachine ¶
AssignedMachine returns the unit's assigned machine tag or an error satisfying params.IsCodeNotAssigned when the unit has no assigned machine..
func (*Unit) AvailabilityZone ¶
AvailabilityZone returns the availability zone of the unit.
func (*Unit) CharmURL ¶
CharmURL returns the charm URL this unit is currently using.
NOTE: This differs from state.Unit.CharmURL() by returning an error instead of a bool, because it needs to make an API call.
func (*Unit) ClearResolved ¶
ClearResolved removes any resolved setting on the unit.
func (*Unit) ClosePorts ¶
ClosePorts sets the policy of the port range with protocol to be closed.
func (*Unit) ConfigSettings ¶
ConfigSettings returns the complete set of application charm config settings available to the unit. Unset values will be replaced with the default value for the associated option, and may thus be nil when no default is specified.
func (*Unit) Destroy ¶
Destroy, when called on a Alive unit, advances its lifecycle as far as possible; it otherwise has no effect. In most situations, the unit's life is just set to Dying; but if a principal unit that is not assigned to a provisioned machine is Destroyed, it will be removed from state directly.
func (*Unit) DestroyAllSubordinates ¶
DestroyAllSubordinates destroys all subordinates of the unit.
func (*Unit) EnsureDead ¶
EnsureDead sets the unit lifecycle to Dead if it is Alive or Dying. It does nothing otherwise.
func (*Unit) HasSubordinates ¶
HasSubordinates returns the tags of any subordinate units.
func (*Unit) MeterStatus ¶
MeterStatus returns the meter status of the unit.
func (*Unit) NetworkInfo ¶
func (u *Unit) NetworkInfo(bindings []string, relationId *int) (map[string]params.NetworkInfoResult, error)
NetworkInfo returns network interfaces/addresses for specified bindings.
func (*Unit) PrincipalName ¶
PrincipalName returns the principal unit name and true for subordinates. For principal units the function returns "" and false.
NOTE: This differs from state.Unit.PrincipalName() by returning an error as well, because it needs to make an API call.
func (*Unit) PrivateAddress ¶
PrivateAddress returns the private address of the unit and whether it is valid.
NOTE: This differs from state.Unit.PrivateAddress() by returning an error instead of a bool, because it needs to make an API call.
TODO(dimitern): We might be able to drop this, once we have machine addresses implemented fully. See also LP bug 1221798.
func (*Unit) PublicAddress ¶
PublicAddress returns the public address of the unit and whether it is valid.
NOTE: This differs from state.Unit.PublicAddres() by returning an error instead of a bool, because it needs to make an API call.
TODO(dimitern): We might be able to drop this, once we have machine addresses implemented fully. See also LP bug 1221798.
func (*Unit) RelationsStatus ¶
func (u *Unit) RelationsStatus() ([]RelationStatus, error)
RelationsInScope returns the tags of the relations the unit has joined and entered scope, or the relation is suspended.
func (*Unit) RemoveUpgradeCharmProfileData ¶
RemoveUpgradeCharmProfileData removes the upgrade charm profile data
func (*Unit) RequestReboot ¶
RequestReboot sets the reboot flag for its machine agent
func (*Unit) Resolved ¶
func (u *Unit) Resolved() params.ResolvedMode
Resolved returns the unit's resolved mode value.
func (*Unit) SetAgentStatus ¶
func (u *Unit) SetAgentStatus(agentStatus status.Status, info string, data map[string]interface{}) error
SetAgentStatus sets the status of the unit agent.
func (*Unit) SetCharmURL ¶
SetCharmURL marks the unit as currently using the supplied charm URL. An error will be returned if the unit is dead, or the charm URL not known.
func (*Unit) SetUnitStatus ¶
func (u *Unit) SetUnitStatus(unitStatus status.Status, info string, data map[string]interface{}) error
SetUnitStatus sets the status of the unit.
func (*Unit) SetUpgradeSeriesStatus ¶
func (u *Unit) SetUpgradeSeriesStatus(status model.UpgradeSeriesStatus, reason string) error
SetUpgradeSeriesStatus sets the upgrade series status of the unit in the remote state
func (*Unit) UnitStatus ¶
func (u *Unit) UnitStatus() (params.StatusResult, error)
UnitStatus gets the status details of the unit.
func (*Unit) UpgradeSeriesStatus ¶
func (u *Unit) UpgradeSeriesStatus() (model.UpgradeSeriesStatus, error)
UpgradeSeriesStatus returns the upgrade series status of a unit from remote state
func (*Unit) Watch ¶
func (u *Unit) Watch() (watcher.NotifyWatcher, error)
Watch returns a watcher for observing changes to the unit.
func (*Unit) WatchActionNotifications ¶
func (u *Unit) WatchActionNotifications() (watcher.StringsWatcher, error)
WatchActionNotifications returns a StringsWatcher for observing the ids of Actions added to the Unit. The initial event will contain the ids of any Actions pending at the time the Watcher is made.
func (*Unit) WatchAddressesHash ¶
func (u *Unit) WatchAddressesHash() (watcher.StringsWatcher, error)
WatchAddressesHash returns a watcher for observing changes to the hash of the unit's addresses. For IAAS models, the unit must be assigned to a machine before this method is called, and the returned watcher will be valid only while the unit's assigned machine is not changed. For CAAS models, the watcher observes changes to the address of the pod associated with the unit.
func (*Unit) WatchConfigSettingsHash ¶
func (u *Unit) WatchConfigSettingsHash() (watcher.StringsWatcher, error)
WatchConfigSettingsHash returns a watcher for observing changes to the unit's charm configuration settings (with a hash of the settings content so we can determine whether it has changed since it was last seen by the uniter). The unit must have a charm URL set before this method is called, and the returned watcher will be valid only while the unit's charm URL is not changed.
func (*Unit) WatchLXDProfileUpgradeNotifications ¶
func (u *Unit) WatchLXDProfileUpgradeNotifications() (watcher.StringsWatcher, error)
WatchLXDProfileUpgradeNotifications returns a StringsWatcher for observing the state of a lxd profile upgrade
func (*Unit) WatchMeterStatus ¶
func (u *Unit) WatchMeterStatus() (watcher.NotifyWatcher, error)
WatchMeterStatus returns a watcher for observing changes to the unit's meter status.
func (*Unit) WatchRelations ¶
func (u *Unit) WatchRelations() (watcher.StringsWatcher, error)
WatchRelations returns a StringsWatcher that notifies of changes to the lifecycles of relations involving u.
func (*Unit) WatchStorage ¶
func (u *Unit) WatchStorage() (watcher.StringsWatcher, error)
WatchStorage returns a watcher for observing changes to the unit's storage attachments.
func (*Unit) WatchTrustConfigSettingsHash ¶
func (u *Unit) WatchTrustConfigSettingsHash() (watcher.StringsWatcher, error)
WatchTrustConfigSettingsHash returns a watcher for observing changes to the unit's application configuration settings (with a hash of the settings content so we can determine whether it has changed since it was last seen by the uniter).
func (*Unit) WatchUpgradeSeriesNotifications ¶
func (u *Unit) WatchUpgradeSeriesNotifications() (watcher.NotifyWatcher, error)
WatchUpgradeSeriesNotifications returns a NotifyWatcher for observing the state of a series upgrade.