Documentation
¶
Index ¶
- Variables
- type Action
- type Application
- func (s *Application) CharmModifiedVersion(ctx context.Context) (int, error)
- func (s *Application) CharmURL(ctx context.Context) (string, bool, error)
- func (s *Application) Life() life.Value
- func (s *Application) Name() string
- func (s *Application) Refresh(ctx context.Context) error
- func (s *Application) SetStatus(ctx context.Context, unitName string, appStatus status.Status, info string, ...) error
- func (s *Application) Status(ctx context.Context, unitName string) (params.ApplicationStatusResult, error)
- func (s *Application) String() string
- func (s *Application) Tag() names.ApplicationTag
- func (s *Application) Watch(ctx context.Context) (watcher.NotifyWatcher, error)
- type Charm
- type Client
- func (client *Client) Action(ctx context.Context, tag names.ActionTag) (*Action, error)
- func (client *Client) ActionBegin(ctx context.Context, tag names.ActionTag) error
- func (client *Client) ActionFinish(ctx context.Context, tag names.ActionTag, status string, ...) error
- func (client *Client) ActionStatus(ctx context.Context, tag names.ActionTag) (string, error)
- func (client *Client) Application(ctx context.Context, tag names.ApplicationTag) (*Application, error)
- func (client *Client) BestAPIVersion() int
- func (client *Client) Charm(curl string) (*Charm, error)
- func (client *Client) CloudAPIVersion(ctx context.Context) (string, error)
- func (client *Client) CloudSpec(ctx context.Context) (*params.CloudSpec, error)
- func (client *Client) GoalState(ctx context.Context) (application.GoalState, error)
- func (client *Client) Model(ctx context.Context) (*types.Model, error)
- func (client *Client) OpenedMachinePortRangesByEndpoint(ctx context.Context, machineTag names.MachineTag) (map[names.UnitTag]network.GroupedPortRanges, error)
- func (client *Client) OpenedPortRangesByEndpoint(ctx context.Context) (map[names.UnitTag]network.GroupedPortRanges, error)
- func (client *Client) ProviderType(ctx context.Context) (string, error)
- func (client *Client) Relation(ctx context.Context, relationTag names.RelationTag) (*Relation, error)
- func (client *Client) RelationById(ctx context.Context, id int) (*Relation, error)
- func (client *Client) SetUnitWorkloadVersion(ctx context.Context, tag names.UnitTag, version string) error
- func (client *Client) Unit(ctx context.Context, tag names.UnitTag) (*Unit, error)
- func (client *Client) UnitWorkloadVersion(ctx context.Context, tag names.UnitTag) (string, error)
- func (client *Client) WatchRelationUnits(ctx context.Context, relationTag names.RelationTag, unitTag names.UnitTag) (watcher.RelationUnitsWatcher, error)
- type CommitHookParamsBuilder
- func (b *CommitHookParamsBuilder) AddSecretCreates(creates []SecretCreateArg) error
- func (b *CommitHookParamsBuilder) AddSecretDeletes(deletes []SecretDeleteArg)
- func (b *CommitHookParamsBuilder) AddSecretGrants(grants []SecretGrantRevokeArgs)
- func (b *CommitHookParamsBuilder) AddSecretRevokes(revokes []SecretGrantRevokeArgs)
- func (b *CommitHookParamsBuilder) AddSecretUpdates(updates []SecretUpsertArg)
- func (b *CommitHookParamsBuilder) AddStorage(constraints map[string][]params.StorageDirectives)
- func (b *CommitHookParamsBuilder) AddTrackLatest(trackLatest []string)
- func (b *CommitHookParamsBuilder) Build() (params.CommitHookChangesArgs, int)
- func (b *CommitHookParamsBuilder) ClosePortRange(endpoint string, portRange network.PortRange)
- func (b *CommitHookParamsBuilder) OpenPortRange(endpoint string, portRange network.PortRange)
- func (b *CommitHookParamsBuilder) UpdateCharmState(state map[string]string)
- func (b *CommitHookParamsBuilder) UpdateNetworkInfo()
- func (b *CommitHookParamsBuilder) UpdateRelationUnitSettings(relName string, unitSettings, appSettings params.Settings)
- type Endpoint
- type FacadeCaller
- type Option
- type Relation
- func (r *Relation) Endpoint(ctx context.Context) (*Endpoint, error)
- func (r *Relation) Id() int
- func (r *Relation) Life() life.Value
- func (r *Relation) OtherApplication() string
- func (r *Relation) OtherModelUUID() string
- func (r *Relation) Refresh(ctx context.Context) error
- func (r *Relation) SetStatus(ctx context.Context, status relation.Status) error
- func (r *Relation) String() string
- func (r *Relation) Suspended() bool
- func (r *Relation) Tag() names.RelationTag
- func (r *Relation) Unit(ctx context.Context, uTag names.UnitTag) (*RelationUnit, error)
- func (r *Relation) UpdateSuspended(suspended bool)
- type RelationStatus
- type RelationUnit
- func (ru *RelationUnit) ApplicationSettings(ctx context.Context) (*Settings, error)
- func (ru *RelationUnit) Endpoint() Endpoint
- func (ru *RelationUnit) EnterScope(ctx context.Context) error
- func (ru *RelationUnit) LeaveScope(ctx context.Context) error
- func (ru *RelationUnit) ReadSettings(ctx context.Context, name string) (params.Settings, error)
- func (ru *RelationUnit) Relation() *Relation
- func (ru *RelationUnit) Settings(ctx context.Context) (*Settings, error)
- type ResourcesFacadeClient
- type SecretCreateArg
- type SecretDeleteArg
- type SecretGrantRevokeArgs
- type SecretUpdateArg
- type SecretUpsertArg
- type Settings
- type StorageAccessor
- func (sa *StorageAccessor) DestroyUnitStorageAttachments(ctx context.Context, unitTag names.UnitTag) error
- func (sa *StorageAccessor) RemoveStorageAttachment(ctx context.Context, storageTag names.StorageTag, unitTag names.UnitTag) error
- func (sa *StorageAccessor) StorageAttachment(ctx context.Context, storageTag names.StorageTag, unitTag names.UnitTag) (params.StorageAttachment, error)
- func (sa *StorageAccessor) StorageAttachmentLife(ctx context.Context, ids []params.StorageAttachmentId) ([]params.LifeResult, error)
- func (sa *StorageAccessor) UnitStorageAttachments(ctx context.Context, unitTag names.UnitTag) ([]params.StorageAttachmentId, error)
- func (sa *StorageAccessor) WatchStorageAttachment(ctx context.Context, storageTag names.StorageTag, unitTag names.UnitTag) (watcher.NotifyWatcher, error)
- func (sa *StorageAccessor) WatchUnitStorageAttachments(ctx context.Context, unitTag names.UnitTag) (watcher.StringsWatcher, error)
- type Unit
- func (u *Unit) Application(ctx context.Context) (*Application, error)
- func (u *Unit) ApplicationName() string
- func (u *Unit) ApplicationTag() names.ApplicationTag
- func (u *Unit) AssignedMachine(ctx context.Context) (names.MachineTag, error)
- func (u *Unit) AvailabilityZone(ctx context.Context) (string, error)
- func (u *Unit) CanApplyLXDProfile(ctx context.Context) (bool, error)
- func (u *Unit) CharmURL(ctx context.Context) (string, error)
- func (u *Unit) ClearResolved(ctx context.Context) error
- func (u *Unit) CommitHookChanges(ctx context.Context, req params.CommitHookChangesArgs) error
- func (u *Unit) ConfigSettings(ctx context.Context) (charm.Settings, error)
- func (u *Unit) Destroy(ctx context.Context) error
- func (u *Unit) DestroyAllSubordinates(ctx context.Context) error
- func (u *Unit) EnsureDead(ctx context.Context) error
- func (u *Unit) HasSubordinates(ctx context.Context) (bool, error)
- func (u *Unit) LXDProfileName(ctx context.Context) (string, error)
- func (u *Unit) Life() life.Value
- func (u *Unit) LogActionMessage(ctx context.Context, tag names.ActionTag, message string) error
- func (u *Unit) Name() string
- func (u *Unit) NetworkInfo(ctx context.Context, bindings []string, relationId *int) (map[string]params.NetworkInfoResult, error)
- func (u *Unit) PrincipalName(ctx context.Context) (string, bool, error)
- func (u *Unit) PrivateAddress(ctx context.Context) (string, error)
- func (u *Unit) ProviderID() string
- func (u *Unit) PublicAddress(ctx context.Context) (string, error)
- func (u *Unit) Refresh(ctx context.Context) error
- func (u *Unit) RelationsStatus(ctx context.Context) ([]RelationStatus, error)
- func (u *Unit) RequestReboot(ctx context.Context) error
- func (u *Unit) Resolved() params.ResolvedMode
- func (u *Unit) SetAgentStatus(ctx context.Context, agentStatus status.Status, info string, ...) error
- func (u *Unit) SetCharmURL(ctx context.Context, curl string) error
- func (u *Unit) SetState(ctx context.Context, unitState params.SetUnitStateArg) error
- func (u *Unit) SetUnitStatus(ctx context.Context, unitStatus status.Status, info string, ...) error
- func (u *Unit) State(ctx context.Context) (params.UnitStateResult, error)
- func (u *Unit) String() string
- func (u *Unit) Tag() names.UnitTag
- func (u *Unit) UnitStatus(ctx context.Context) (params.StatusResult, error)
- func (s *Unit) Watch(ctx context.Context) (watcher.NotifyWatcher, error)
- func (u *Unit) WatchActionNotifications(ctx context.Context) (watcher.StringsWatcher, error)
- func (u *Unit) WatchAddressesHash(ctx context.Context) (watcher.StringsWatcher, error)
- func (u *Unit) WatchConfigSettingsHash(ctx context.Context) (watcher.StringsWatcher, error)
- func (u *Unit) WatchInstanceData(ctx context.Context) (watcher.NotifyWatcher, error)
- func (u *Unit) WatchRelations(ctx context.Context) (watcher.StringsWatcher, error)
- func (u *Unit) WatchStorage(ctx context.Context) (watcher.StringsWatcher, error)
- func (u *Unit) WatchTrustConfigSettingsHash(ctx context.Context) (watcher.StringsWatcher, error)
- type UnitHTTPClient
Constants ¶
This section is empty.
Variables ¶
var ErrNoCharmURLSet = errors.New("unit has no charm url set")
var WithTracer = base.WithTracer
WithTracer returns an Option that configures the Client to use the supplied tracer.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
// contains filtered or unexported fields
}
Action represents a single instance of an Action call, by name and params.
func NewAction ¶
func NewAction(id, name string, params map[string]interface{}, parallel bool, executionGroup string) *Action
NewAction makes a new Action with specified id, name and params.
func (*Action) ExecutionGroup ¶
ExecutionGroup is the group of actions which cannot execute in parallel with each other.
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
Application represents the state of an application.
func (*Application) CharmModifiedVersion ¶
func (s *Application) CharmModifiedVersion(ctx context.Context) (int, error)
CharmModifiedVersion increments every time the charm, or any part of it, is changed in some way.
func (*Application) CharmURL ¶
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() life.Value
Life returns the application's current life state.
func (*Application) Refresh ¶
func (s *Application) Refresh(ctx context.Context) error
Refresh refreshes the contents of the application from the underlying state.
func (*Application) SetStatus ¶
func (s *Application) SetStatus(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context) (watcher.NotifyWatcher, error)
Watch returns a watcher for observing changes to an 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.
func (*Charm) LXDProfileRequired ¶
LXDProfileRequired returns true if this charm requires an lxd profile to be applied.
type Client ¶
type Client struct { *common.ModelConfigWatcher *common.APIAddresser *common.UnitStateAPI *StorageAccessor // contains filtered or unexported fields }
Client provides access to the Uniter API facade.
func NewFromConnection ¶
func NewFromConnection(c api.Connection) (*Client, error)
NewFromConnection returns a version of the Connection that provides functionality required by the uniter worker if possible else a non-nil error.
func (*Client) ActionBegin ¶
ActionBegin marks an action as running.
func (*Client) ActionFinish ¶
func (client *Client) ActionFinish(ctx context.Context, tag names.ActionTag, status string, results map[string]interface{}, message string) error
ActionFinish captures the structured output of an action.
func (*Client) ActionStatus ¶
ActionStatus provides the status of a single action.
func (*Client) Application ¶
func (client *Client) Application(ctx context.Context, tag names.ApplicationTag) (*Application, error)
Application returns an application state by tag.
func (*Client) BestAPIVersion ¶
BestAPIVersion returns the API version that we were able to determine is supported by both the client and the API Server.
func (*Client) CloudAPIVersion ¶
CloudAPIVersion returns the API version of the cloud, if known.
func (*Client) 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 (*Client) GoalState ¶
GoalState returns a GoalState struct with the charm's peers and related units information.
func (*Client) OpenedMachinePortRangesByEndpoint ¶
func (client *Client) OpenedMachinePortRangesByEndpoint(ctx context.Context, machineTag names.MachineTag) (map[names.UnitTag]network.GroupedPortRanges, error)
OpenedMachinePortRangesByEndpoint returns all port ranges currently open on the given machine, grouped by unit tag and application endpoint.
func (*Client) OpenedPortRangesByEndpoint ¶
func (client *Client) OpenedPortRangesByEndpoint(ctx context.Context) (map[names.UnitTag]network.GroupedPortRanges, error)
OpenedPortRangesByEndpoint returns all port ranges currently opened grouped by unit tag and application endpoint.
func (*Client) 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 (*Client) Relation ¶
func (client *Client) Relation(ctx context.Context, relationTag names.RelationTag) (*Relation, error)
Relation returns the existing relation with the given tag.
func (*Client) RelationById ¶
RelationById returns the existing relation with the given id.
func (*Client) SetUnitWorkloadVersion ¶
func (client *Client) SetUnitWorkloadVersion(ctx context.Context, tag names.UnitTag, version string) error
SetUnitWorkloadVersion sets the specified unit's workload version to the provided value.
func (*Client) UnitWorkloadVersion ¶
UnitWorkloadVersion returns the version of the workload reported by the specified unit.
func (*Client) WatchRelationUnits ¶
func (client *Client) WatchRelationUnits( ctx context.Context, 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 CommitHookParamsBuilder ¶
type CommitHookParamsBuilder struct {
// contains filtered or unexported fields
}
CommitHookParamsBuilder is a helper type for populating the set of parameters used to perform a CommitHookChanges API call.
func NewCommitHookParamsBuilder ¶
func NewCommitHookParamsBuilder(unitTag names.UnitTag) *CommitHookParamsBuilder
NewCommitHookParamsBuilder returns a new builder for assembling the parameters for a CommitHookChanges API call.
func (*CommitHookParamsBuilder) AddSecretCreates ¶
func (b *CommitHookParamsBuilder) AddSecretCreates(creates []SecretCreateArg) error
AddSecretCreates records requests to create secrets.
func (*CommitHookParamsBuilder) AddSecretDeletes ¶
func (b *CommitHookParamsBuilder) AddSecretDeletes(deletes []SecretDeleteArg)
AddSecretDeletes records requests to delete secrets.
func (*CommitHookParamsBuilder) AddSecretGrants ¶
func (b *CommitHookParamsBuilder) AddSecretGrants(grants []SecretGrantRevokeArgs)
AddSecretGrants records requests to grant secret access.
func (*CommitHookParamsBuilder) AddSecretRevokes ¶
func (b *CommitHookParamsBuilder) AddSecretRevokes(revokes []SecretGrantRevokeArgs)
AddSecretRevokes records requests to revoke secret access.
func (*CommitHookParamsBuilder) AddSecretUpdates ¶
func (b *CommitHookParamsBuilder) AddSecretUpdates(updates []SecretUpsertArg)
AddSecretUpdates records requests to update secrets.
func (*CommitHookParamsBuilder) AddStorage ¶
func (b *CommitHookParamsBuilder) AddStorage(constraints map[string][]params.StorageDirectives)
AddStorage records a request for adding storage.
func (*CommitHookParamsBuilder) AddTrackLatest ¶
func (b *CommitHookParamsBuilder) AddTrackLatest(trackLatest []string)
AddTrackLatest records the URIs for which the latest revision should be tracked.
func (*CommitHookParamsBuilder) Build ¶
func (b *CommitHookParamsBuilder) Build() (params.CommitHookChangesArgs, int)
Build assembles the recorded change requests into a CommitHookChangesArgs instance that can be passed as an argument to the CommitHookChanges API call.
func (*CommitHookParamsBuilder) ClosePortRange ¶
func (b *CommitHookParamsBuilder) ClosePortRange(endpoint string, portRange network.PortRange)
ClosePortRange records a request to close a particular port range.
func (*CommitHookParamsBuilder) OpenPortRange ¶
func (b *CommitHookParamsBuilder) OpenPortRange(endpoint string, portRange network.PortRange)
OpenPortRange records a request to open a particular port range.
func (*CommitHookParamsBuilder) UpdateCharmState ¶
func (b *CommitHookParamsBuilder) UpdateCharmState(state map[string]string)
UpdateCharmState records a request to update the server-persisted charm state.
func (*CommitHookParamsBuilder) UpdateNetworkInfo ¶
func (b *CommitHookParamsBuilder) UpdateNetworkInfo()
UpdateNetworkInfo records a request to update the network information settings for each joined relation.
func (*CommitHookParamsBuilder) UpdateRelationUnitSettings ¶
func (b *CommitHookParamsBuilder) UpdateRelationUnitSettings(relName string, unitSettings, appSettings params.Settings)
UpdateRelationUnitSettings records a request to update the unit/application settings for a relation.
type Endpoint ¶
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 FacadeCaller ¶
type FacadeCaller interface { // FacadeCall makes an API request. FacadeCall(ctx context.Context, request string, args, response interface{}) error }
FacadeCaller exposes the raw API caller functionality needed here.
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) OtherModelUUID ¶
OtherModelUUID returns the UUID of the model hosting the application on the other end of the relation.
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(ctx context.Context, uTag names.UnitTag) (*RelationUnit, error)
Unit returns a RelationUnit for the supplied unitTag.
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) ApplicationSettings ¶
func (ru *RelationUnit) ApplicationSettings(ctx context.Context) (*Settings, error)
ApplicationSettings returns a Settings which allows access to this unit's application settings within the relation. This can only be used from the leader unit. Calling it from a non-Leader generates a NotLeader error.
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(ctx context.Context) 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(ctx context.Context) 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 ¶
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.
type ResourcesFacadeClient ¶
type ResourcesFacadeClient struct { FacadeCaller apihttp.HTTPDoer }
ResourcesFacadeClient is an API client for the resources portion of the uniter facade.
func NewResourcesFacadeClient ¶
func NewResourcesFacadeClient(caller base.APICaller, unitTag names.UnitTag) (*ResourcesFacadeClient, error)
NewResourcesFacadeClient creates a new API client for the resources portion of the uniter facade.
func (*ResourcesFacadeClient) GetResource ¶
func (c *ResourcesFacadeClient) GetResource(ctx context.Context, resourceName string) (resource.Resource, io.ReadCloser, error)
GetResource opens the resource (metadata/blob), if it exists, via the HTTP API and returns it. If it does not exist or hasn't been uploaded yet then errors.NotFound is returned.
type SecretCreateArg ¶
type SecretCreateArg struct { SecretUpsertArg Owner secrets.Owner }
SecretCreateArg holds parameters for creating a secret.
type SecretDeleteArg ¶
SecretDeleteArg holds parameters for deleting a secret.
type SecretGrantRevokeArgs ¶
type SecretGrantRevokeArgs struct { URI *secrets.URI ApplicationName *string UnitName *string RelationKey *string Role secrets.SecretRole }
SecretGrantRevokeArgs holds parameters for updating a secret's access.
func (SecretGrantRevokeArgs) Equal ¶
func (arg SecretGrantRevokeArgs) Equal(other SecretGrantRevokeArgs) bool
Equal returns true if the two SecretGrantRevokeArgs are equal.
func (SecretGrantRevokeArgs) ToParams ¶
func (arg SecretGrantRevokeArgs) ToParams() params.GrantRevokeSecretArg
ToParams converts a SecretGrantRevokeArgs to a params.GrantRevokeSecretArg.
type SecretUpdateArg ¶
type SecretUpdateArg struct { SecretUpsertArg CurrentRevision int }
SecretUpdateArg holds parameters for updating a secret.
type SecretUpsertArg ¶
type SecretUpsertArg struct { URI *secrets.URI RotatePolicy *secrets.RotatePolicy ExpireTime *time.Time Description *string Label *string Value secrets.SecretValue ValueRef *secrets.ValueRef Checksum string }
SecretUpsertArg holds parameters for creating or updating a secret.
type Settings ¶
type Settings struct {
// contains filtered or unexported fields
}
Settings manages changes to unit settings in a relation.
func NewSettings ¶
NewSettings returns a settings from rpc params.
func (*Settings) FinalResult ¶
FinalResult returns a params.Settings with the final updates applied. This includes entries that were deleted.
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(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, unitTag names.UnitTag) ([]params.StorageAttachmentId, error)
UnitStorageAttachments returns the IDs of a unit's storage attachments.
func (*StorageAccessor) WatchStorageAttachment ¶
func (sa *StorageAccessor) WatchStorageAttachment(ctx context.Context, 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(ctx context.Context, 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) Application ¶
func (u *Unit) Application(ctx context.Context) (*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) CanApplyLXDProfile ¶
CanApplyLXDProfile returns true if an lxd profile can be applied to this unit, e.g. this is an lxd machine or container and not maunal
func (*Unit) ClearResolved ¶
ClearResolved removes any resolved setting on the unit.
func (*Unit) CommitHookChanges ¶
CommitHookChanges batches together all required API calls for applying a set of changes after a hook successfully completes and executes them in a single transaction.
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) LXDProfileName ¶
LXDProfileName returns the name of the lxd profile applied to the unit's machine for the current charm version.
func (*Unit) LogActionMessage ¶
LogActionMessage logs a progress message for the specified action.
func (*Unit) NetworkInfo ¶
func (u *Unit) NetworkInfo(ctx context.Context, 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) ProviderID ¶
ProviderID returns the provider Id of the unit.
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(ctx context.Context) ([]RelationStatus, error)
RelationsStatus returns the tags of the relations the unit has joined and entered scope, or the relation is suspended.
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(ctx context.Context, 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) SetState ¶
SetState sets the state persisted by the charm running in this unit and the state internal to the uniter for this unit.
func (*Unit) SetUnitStatus ¶
func (u *Unit) SetUnitStatus(ctx context.Context, unitStatus status.Status, info string, data map[string]interface{}) error
SetUnitStatus sets the status of the unit.
func (*Unit) State ¶
State returns the state persisted by the charm running in this unit and the state internal to the uniter for this unit.
func (*Unit) UnitStatus ¶
UnitStatus gets the status details of the unit.
func (*Unit) WatchActionNotifications ¶
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 ¶
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 ¶
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) WatchInstanceData ¶
WatchInstanceData returns a watcher for observing changes to the instanceData of the unit's machine. Primarily used for watching LXDProfile changes.
func (*Unit) WatchRelations ¶
WatchRelations returns a StringsWatcher that notifies of changes to the lifecycles of relations involving u.
func (*Unit) WatchStorage ¶
WatchStorage returns a watcher for observing changes to the unit's storage attachments.
func (*Unit) WatchTrustConfigSettingsHash ¶
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).
type UnitHTTPClient ¶
type UnitHTTPClient interface { apihttp.HTTPDoer // Unit Returns the name of the unit for this client. Unit() string }
UnitHTTPClient exposes the raw API HTTP caller functionality needed here.
func NewUnitHTTPClient ¶
func NewUnitHTTPClient(client apihttp.HTTPDoer, unitName string) UnitHTTPClient
NewUnitHTTPClient wraps an HTTP client (a la httprequest.Client) with unit information. This allows rewriting of the URL to match the relevant unit.