uniter

package
v0.0.0-...-f88c608 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: AGPL-3.0 Imports: 57 Imported by: 3

Documentation

Overview

Package uniter implements the API interface used by the uniter worker.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(registry facade.FacadeRegistry)

Register is called to expose a package of facades onto a given registry.

Types

type ApplicationService

type ApplicationService interface {
	// GetApplicationLife looks up the life of the specified application.
	GetApplicationLife(ctx context.Context, unitName string) (life.Value, error)

	// GetUnitLife looks up the life of the specified unit.
	GetUnitLife(ctx context.Context, unitName coreunit.Name) (life.Value, error)

	// GetUnitUUID returns the UUID for the named unit.
	GetUnitUUID(ctx context.Context, unitName coreunit.Name) (coreunit.UUID, error)

	// EnsureUnitDead is called by the unit agent just before it terminates.
	EnsureUnitDead(ctx context.Context, unitName coreunit.Name, leadershipRevoker leadership.Revoker) error

	// DeleteUnit deletes the specified unit.
	DeleteUnit(ctx context.Context, unitName coreunit.Name) error

	// DestroyUnit prepares a unit for removal from the model.
	DestroyUnit(ctx context.Context, unitName coreunit.Name) error

	// WatchApplication returns a NotifyWatcher for changes to the application.
	WatchApplication(ctx context.Context, name string) (watcher.NotifyWatcher, error)

	// GetApplicationIDByUnitName returns the application ID for the named unit.
	//
	// Returns [applicationerrors.UnitNotFound] if the unit is not found.
	GetApplicationIDByUnitName(ctx context.Context, unitName coreunit.Name) (coreapplication.ID, error)

	// GetApplicationIDByName returns an application ID by application name.
	//
	// Returns [applicationerrors.ApplicationNotFound] if the application is not found.
	GetApplicationIDByName(ctx context.Context, name string) (coreapplication.ID, error)

	// GetApplicationDisplayStatus returns the display status of the specified application.
	// The display status is equal to the application status if it is set, otherwise it is
	// derived from the unit display statuses.
	// If no application is found, an error satisfying [applicationerrors.ApplicationNotFound]
	// is returned.
	GetApplicationDisplayStatus(ctx context.Context, appID coreapplication.ID) (*corestatus.StatusInfo, error)

	// GetUnitWorkloadStatus returns the workload status of the specified unit, returning an
	// error satisfying [applicationerrors.UnitNotFound] if the unit doesn't exist.
	GetUnitWorkloadStatus(context.Context, coreunit.Name) (*corestatus.StatusInfo, error)

	// SetUnitWorkloadStatus sets the workload status of the specified unit, returning an
	// error satisfying [applicationerrors.UnitNotFound] if the unit doesn't exist.
	SetUnitWorkloadStatus(context.Context, coreunit.Name, *corestatus.StatusInfo) error

	// GetCharmModifiedVersion looks up the charm modified version of the given
	// application.
	GetCharmModifiedVersion(ctx context.Context, id coreapplication.ID) (int, error)

	// GetUnitWorkloadStatusesForApplication returns the workload statuses of all
	// units in the specified application, indexed by unit name, returning an error
	// satisfying [applicationerrors.ApplicationNotFound] if the application doesn't
	// exist.
	GetUnitWorkloadStatusesForApplication(ctx context.Context, appID coreapplication.ID) (map[coreunit.Name]corestatus.StatusInfo, error)

	// GetAvailableCharmArchiveSHA256 returns the SHA256 hash of the charm archive
	// for the given charm name, source and revision. If the charm is not available,
	// [applicationerrors.CharmNotResolved] is returned.
	GetAvailableCharmArchiveSHA256(ctx context.Context, locator charm.CharmLocator) (string, error)

	// GetCharmLXDProfile returns the LXD profile along with the revision of the
	// charm using the charm name, source and revision.
	GetCharmLXDProfile(ctx context.Context, locator charm.CharmLocator) (internalcharm.LXDProfile, charm.Revision, error)
}

ApplicationService provides access to the application service.

type CloudService

type CloudService interface {
	Cloud(ctx context.Context, name string) (*cloud.Cloud, error)
	WatchCloud(ctx context.Context, name string) (watcher.NotifyWatcher, error)
}

CloudService provides access to clouds.

type ControllerConfigService

type ControllerConfigService interface {
	ControllerConfig(context.Context) (controller.Config, error)
}

ControllerConfigService provides the controller configuration for the model.

type CredentialService

type CredentialService interface {
	CloudCredential(ctx context.Context, key credential.Key) (cloud.Credential, error)
	WatchCredential(ctx context.Context, key credential.Key) (watcher.NotifyWatcher, error)
}

CredentialService provides access to credentials.

type LXDProfileAPI

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

func NewExternalLXDProfileAPI

func NewExternalLXDProfileAPI(
	st *state.State,
	resources facade.Resources,
	authorizer facade.Authorizer,
	accessUnit common.GetAuthFunc,
	logger logger.Logger,
) *LXDProfileAPI

NewExternalLXDProfileAPI can be used for API registration.

func NewLXDProfileAPI

func NewLXDProfileAPI(
	backend LXDProfileBackend,
	resources facade.Resources,
	authorizer facade.Authorizer,
	accessUnit common.GetAuthFunc,
	logger logger.Logger,
) *LXDProfileAPI

NewLXDProfileAPI returns a new LXDProfileAPI. Currently both GetAuthFuncs can used to determine current permissions.

func (*LXDProfileAPI) RemoveUpgradeCharmProfileData

func (u *LXDProfileAPI) RemoveUpgradeCharmProfileData(args params.Entities) (params.ErrorResults, error)

RemoveUpgradeCharmProfileData is intended to clean up the LXDProfile status to ensure that we start from a clean slate.

func (*LXDProfileAPI) WatchLXDProfileUpgradeNotifications

func (u *LXDProfileAPI) WatchLXDProfileUpgradeNotifications(args params.LXDProfileUpgrade) (params.StringsWatchResults, error)

WatchLXDProfileUpgradeNotifications returns a StringsWatcher for observing changes to the lxd profile changes.

NOTE: can be removed in juju version 3.

func (*LXDProfileAPI) WatchUnitLXDProfileUpgradeNotifications

func (u *LXDProfileAPI) WatchUnitLXDProfileUpgradeNotifications(args params.Entities) (params.StringsWatchResults, error)

WatchUnitLXDProfileUpgradeNotifications returns a StringsWatcher for observing changes to the lxd profile changes for one unit.

type LXDProfileAPIv2

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

func NewExternalLXDProfileAPIv2

func NewExternalLXDProfileAPIv2(
	st *state.State,
	machineService MachineService,
	watcherRegistry facade.WatcherRegistry,
	authorizer facade.Authorizer,
	accessUnit common.GetAuthFunc,
	logger corelogger.Logger,
	modelInfoService ModelInfoService,
	applicationService ApplicationService,
) *LXDProfileAPIv2

NewExternalLXDProfileAPIv2 can be used for API registration.

func NewLXDProfileAPIv2

func NewLXDProfileAPIv2(
	backend LXDProfileBackendV2,
	machineService MachineService,
	watcherRegistry facade.WatcherRegistry,
	authorizer facade.Authorizer,
	accessUnit common.GetAuthFunc,
	logger corelogger.Logger,
	modelInfoService ModelInfoService,
	applicationService ApplicationService,
) *LXDProfileAPIv2

NewLXDProfileAPIv2 returns a new LXDProfileAPIv2. Currently both GetAuthFuncs can used to determine current permissions.

func (*LXDProfileAPIv2) CanApplyLXDProfile

func (u *LXDProfileAPIv2) CanApplyLXDProfile(ctx context.Context, args params.Entities) (params.BoolResults, error)

CanApplyLXDProfile returns true if

  • this is an IAAS model,
  • the unit is not on a manual machine,
  • the provider type is "lxd" or it's an lxd container.

func (*LXDProfileAPIv2) LXDProfileName

func (u *LXDProfileAPIv2) LXDProfileName(ctx context.Context, args params.Entities) (params.StringResults, error)

LXDProfileName returns the name of the lxd profile applied to the unit's machine for the current charm version.

func (*LXDProfileAPIv2) LXDProfileRequired

func (u *LXDProfileAPIv2) LXDProfileRequired(ctx context.Context, args params.CharmURLs) (params.BoolResults, error)

LXDProfileRequired returns true if charm has an lxd profile in it.

func (*LXDProfileAPIv2) WatchInstanceData

func (u *LXDProfileAPIv2) WatchInstanceData(ctx context.Context, args params.Entities) (params.NotifyWatchResults, error)

WatchInstanceData returns a NotifyWatcher for observing changes to the lxd profile for one unit.

type LXDProfileBackend

type LXDProfileBackend interface {
	Machine(string) (LXDProfileMachine, error)
	Unit(string) (LXDProfileUnit, error)
}

type LXDProfileBackendV2

type LXDProfileBackendV2 interface {
	Machine(string) (LXDProfileMachineV2, error)
	Unit(string) (LXDProfileUnitV2, error)
}

type LXDProfileCharmV2

type LXDProfileCharmV2 interface {
	LXDProfile() lxdprofile.Profile
}

LXDProfileCharmV2 describes charm-receiver state methods for executing a lxd profile upgrade.

type LXDProfileMachine

type LXDProfileMachine interface {
	WatchLXDProfileUpgradeNotifications(string) (state.StringsWatcher, error)
}

LXDProfileMachine describes machine-receiver state methods for executing a lxd profile upgrade.

type LXDProfileMachineV2

type LXDProfileMachineV2 interface {
	ContainerType() instance.ContainerType
	IsManual() (bool, error)
}

LXDProfileMachineV2 describes machine-receiver state methods for executing a lxd profile upgrade.

type LXDProfileState

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

LXDProfileState implements the LXDProfileBackend indirection over state.State.

func (LXDProfileState) Machine

func (s LXDProfileState) Machine(id string) (LXDProfileMachine, error)

func (LXDProfileState) Unit

type LXDProfileStateV2

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

LXDProfileStateV2 implements the LXDProfileBackendV2 indirection over state.State.

func (LXDProfileStateV2) Machine

func (LXDProfileStateV2) Unit

type LXDProfileUnit

type LXDProfileUnit interface {
	AssignedMachineId() (string, error)
	Name() string
	Tag() names.Tag
	WatchLXDProfileUpgradeNotifications() (state.StringsWatcher, error)
}

LXDProfileUnit describes unit-receiver state methods for executing a lxd profile upgrade.

type LXDProfileUnitV2

type LXDProfileUnitV2 interface {
	ApplicationName() string
	AssignedMachineId() (string, error)
	CharmURL() *string
	Name() string
	Tag() names.Tag
}

LXDProfileUnitV2 describes unit-receiver state methods for executing a lxd profile upgrade.

type Machine

type Machine interface {
	// Id returns the machine's model-unique identifier.
	Id() string

	// MachineTag returns the machine's tag, specifically typed.
	MachineTag() names.MachineTag

	// PrivateAddress returns the machine's preferred private address.
	PrivateAddress() (network.SpaceAddress, error)

	// AllDeviceAddresses returns the IP addresses for the machine's
	// link-layer devices.
	AllDeviceAddresses(subs network.SubnetInfos) ([]NetInfoAddress, error)
}

Machine describes methods required for interrogating the addresses of a machine in state.

type MachineService

type MachineService interface {
	// RequireMachineReboot sets the machine referenced by its UUID as requiring a reboot.
	RequireMachineReboot(ctx context.Context, uuid string) error

	// ClearMachineReboot removes the reboot flag of the machine referenced by its UUID if a reboot has previously been required.
	ClearMachineReboot(ctx context.Context, uuid string) error

	// IsMachineRebootRequired checks if the machine referenced by its UUID requires a reboot.
	IsMachineRebootRequired(ctx context.Context, uuid string) (bool, error)

	// ShouldRebootOrShutdown determines whether a machine should reboot or shutdown
	ShouldRebootOrShutdown(ctx context.Context, uuid string) (coremachine.RebootAction, error)

	// GetMachineUUID returns the UUID of a machine identified by its name.
	// It returns an errors.MachineNotFound if the machine does not exist.
	GetMachineUUID(ctx context.Context, machineName coremachine.Name) (string, error)

	// AppliedLXDProfileNames returns the names of the LXD profiles on the machine.
	AppliedLXDProfileNames(ctx context.Context, mUUID string) ([]string, error)

	// WatchMachineCloudInstances returns a StringsWatcher that is subscribed to
	// the changes in the machine_cloud_instance table in the model.
	WatchLXDProfiles(ctx context.Context, machineUUID string) (watcher.NotifyWatcher, error)

	// AvailabilityZone returns the hardware characteristics of the
	// specified machine.
	AvailabilityZone(ctx context.Context, machineUUID string) (string, error)
}

MachineService defines the methods that the facade assumes from the Machine service.

type ModelConfigService

type ModelConfigService interface {
	// ModelConfig returns the current config for the model.
	ModelConfig(context.Context) (*config.Config, error)
	// Watch returns a watcher that returns keys for any changes to model
	// config.
	Watch() (watcher.StringsWatcher, error)
}

ModelConfigService is used by the provisioner facade to get model config.

type ModelInfoService

type ModelInfoService interface {
	// GetModelInfo returns the readonly model information for the model in
	// question.
	GetModelInfo(context.Context) (model.ModelInfo, error)
}

ModelInfoService describes the service for interacting and reading the underlying model information.

type NetInfoAddress

type NetInfoAddress interface {
	network.Address

	// SpaceAddr returns the SpaceAddress representation for
	// the address, which was determined from its subnet.
	SpaceAddr() network.SpaceAddress

	// DeviceName is the name of the link-layer device
	// with which this address is associated.
	DeviceName() string

	// HWAddr returns the hardware address (MAC or Infiniband GUID)
	// for the device with which this address is associated.
	HWAddr() (string, error)

	// ParentDeviceName returns the name of the network device that
	// is the parent of this one.
	// An empty string is returned if no parent can be determined.
	ParentDeviceName() string
}

type NetworkInfo

type NetworkInfo interface {
	ProcessAPIRequest(params.NetworkInfoParams) (params.NetworkInfoResults, error)
	NetworksForRelation(
		binding string, rel *state.Relation,
	) (boundSpace string, ingress network.SpaceAddresses, egress []string, err error)
}

func NewNetworkInfo

func NewNetworkInfo(
	ctx context.Context,
	st *state.State,
	clock clock.Clock,
	networkService NetworkService,
	modelConfigService ModelConfigService,
	tag names.UnitTag,
	logger corelogger.Logger,
) (NetworkInfo, error)

NewNetworkInfo initialises and returns a new NetworkInfo based on the input state and unit tag.

func NewNetworkInfoForStrategy

func NewNetworkInfoForStrategy(
	ctx context.Context,
	st *state.State,
	networkService NetworkService,
	modelConfigService ModelConfigService,
	tag names.UnitTag,
	retryStrategy retry.CallArgs,
	lookupHost func(string) ([]string, error),
	logger corelogger.Logger,
) (NetworkInfo, error)

NewNetworkInfoForStrategy initialises and returns a new NetworkInfo based on the input state and unit tag, allowing further specification of behaviour via the input retry factory and host resolver.

type NetworkInfoBase

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

NetworkInfoBase is responsible for processing requests for network data for unit endpoint bindings and/or relations.

type NetworkInfoCAAS

type NetworkInfoCAAS struct {
	*NetworkInfoBase
	// contains filtered or unexported fields
}

NetworkInfoCAAS is used to provide network info for CAAS units.

func (*NetworkInfoCAAS) NetworksForRelation

func (n *NetworkInfoCAAS) NetworksForRelation(
	endpoint string, rel *state.Relation,
) (string, network.SpaceAddresses, []string, error)

NetworksForRelation returns the ingress and egress addresses for a relation and unit. The ingress addresses depend on if the relation is cross-model and whether the relation endpoint is bound to a space.

func (*NetworkInfoCAAS) ProcessAPIRequest

ProcessAPIRequest handles a request to the uniter API NetworkInfo method.

type NetworkInfoIAAS

type NetworkInfoIAAS struct {
	*NetworkInfoBase
	// contains filtered or unexported fields
}

NetworkInfoIAAS is used to provide network info for IAAS units.

func (*NetworkInfoIAAS) NetworksForRelation

func (n *NetworkInfoIAAS) NetworksForRelation(
	endpoint string, rel *state.Relation,
) (string, network.SpaceAddresses, []string, error)

NetworksForRelation returns the ingress and egress addresses for a relation and unit. The ingress addresses depend on if the relation is cross-model and whether the relation endpoint is bound to a space.

func (*NetworkInfoIAAS) ProcessAPIRequest

ProcessAPIRequest handles a request to the uniter API NetworkInfo method.

type NetworkService

type NetworkService interface {
	// SpaceByName returns a space from state that matches the input name.
	// An error is returned that satisfied errors.NotFound if the space was not found
	// or an error static any problems fetching the given space.
	SpaceByName(ctx context.Context, name string) (*network.SpaceInfo, error)
	// GetAllSubnets returns all the subnets for the model.
	GetAllSubnets(ctx context.Context) (network.SubnetInfos, error)
}

NetworkService is the interface that is used to interact with the network spaces/subnets.

type PortService

type PortService interface {
	// UpdateUnitPorts opens and closes ports for the endpoints of a given unit.
	UpdateUnitPorts(ctx context.Context, unitUUID coreunit.UUID, openPorts, closePorts network.GroupedPortRanges) error

	// GetMachineOpenedPorts returns the opened ports for all the units on the
	// machine. Opened ports are grouped first by unit name and then by endpoint.
	GetMachineOpenedPorts(ctx context.Context, machineUUID string) (map[coreunit.Name]network.GroupedPortRanges, error)

	// GetUnitOpenedPorts returns the opened ports for a given unit uuid, grouped
	// by endpoint.
	GetUnitOpenedPorts(ctx context.Context, unitUUID coreunit.UUID) (network.GroupedPortRanges, error)
}

PortService describes the ability to open and close port ranges for units.

type SecretService

SecretService provides core secrets operations.

type StatusAPI

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

StatusAPI is the uniter part that deals with setting/getting status from different entities, this particular separation from base is because we have a shim to support unit/agent split.

func NewStatusAPI

func NewStatusAPI(st *state.State, applicationService ApplicationService, getCanModify common.GetAuthFunc, leadershipChecker leadership.Checker, clock clock.Clock) *StatusAPI

NewStatusAPI creates a new server-side Status setter API facade.

func (*StatusAPI) ApplicationStatus

func (s *StatusAPI) ApplicationStatus(ctx context.Context, args params.Entities) (params.ApplicationStatusResults, error)

ApplicationStatus returns the status of the Applications and its workloads if the given unit is the leader.

func (*StatusAPI) SetAgentStatus

func (s *StatusAPI) SetAgentStatus(ctx context.Context, args params.SetStatus) (params.ErrorResults, error)

SetAgentStatus will set status for agents of Units passed in args, if one of the args is not an Unit it will fail.

func (*StatusAPI) SetApplicationStatus

func (s *StatusAPI) SetApplicationStatus(ctx context.Context, args params.SetStatus) (params.ErrorResults, error)

SetApplicationStatus sets the status for all the Applications in args if the given Unit is the leader.

func (*StatusAPI) SetStatus

func (s *StatusAPI) SetStatus(ctx context.Context, args params.SetStatus) (params.ErrorResults, error)

SetStatus will set status for a entities passed in args. If the entity is a Unit it will instead set status to its agent, to emulate backwards compatibility.

func (*StatusAPI) SetUnitStatus

func (s *StatusAPI) SetUnitStatus(ctx context.Context, args params.SetStatus) (params.ErrorResults, error)

SetUnitStatus sets status for all elements passed in args, the difference with SetStatus is that if an entity is a Unit it will set its status instead of its agent.

func (*StatusAPI) UnitStatus

func (s *StatusAPI) UnitStatus(ctx context.Context, args params.Entities) (params.StatusResults, error)

UnitStatus returns the workload status information for the unit.

type StorageAPI

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

StorageAPI provides access to the Storage API facade.

func (*StorageAPI) DestroyUnitStorageAttachments

func (s *StorageAPI) DestroyUnitStorageAttachments(args params.Entities) (params.ErrorResults, error)

DestroyUnitStorageAttachments marks each storage attachment of the specified units as Dying.

func (*StorageAPI) RemoveStorageAttachments

func (s *StorageAPI) RemoveStorageAttachments(args params.StorageAttachmentIds) (params.ErrorResults, error)

RemoveStorageAttachments removes the specified storage attachments from state.

func (*StorageAPI) StorageAttachmentLife

func (s *StorageAPI) StorageAttachmentLife(args params.StorageAttachmentIds) (params.LifeResults, error)

StorageAttachmentLife returns the lifecycle state of the storage attachments with the specified tags.

func (*StorageAPI) StorageAttachments

StorageAttachments returns the storage attachments with the specified tags.

func (*StorageAPI) UnitStorageAttachments

func (s *StorageAPI) UnitStorageAttachments(args params.Entities) (params.StorageAttachmentIdsResults, error)

UnitStorageAttachments returns the IDs of storage attachments for a collection of units.

func (*StorageAPI) WatchStorageAttachments

func (s *StorageAPI) WatchStorageAttachments(ctx context.Context, args params.StorageAttachmentIds) (params.NotifyWatchResults, error)

WatchStorageAttachments creates watchers for a collection of storage attachments, each of which can be used to watch changes to storage attachment info.

func (*StorageAPI) WatchUnitStorageAttachments

func (s *StorageAPI) WatchUnitStorageAttachments(args params.Entities) (params.StringsWatchResults, error)

WatchUnitStorageAttachments creates watchers for a collection of units, each of which can be used to watch for lifecycle changes to the corresponding unit's storage attachments.

type Unit

type Unit interface {
	AssignedMachineId() (string, error)
	ShouldBeAssigned() bool
	StorageConstraints() (map[string]state.StorageConstraints, error)
}

type UnitStateService

type UnitStateService interface {
	// GetUnitUUIDForName returns the UUID corresponding to the input unit name.
	GetUnitUUIDForName(ctx context.Context, name string) (string, error)
	// SetState persists the input unit state.
	SetState(context.Context, unitstate.UnitState) error
	// GetState returns the full unit state. The state may be empty.
	GetState(ctx context.Context, uuid string) (unitstate.RetrievedUnitState, error)
}

UnitStateService describes the ability to retrieve and persist unit agent state for informing hook reconciliation.

type UniterAPI

type UniterAPI struct {
	*StatusAPI
	*StorageAPI

	*common.APIAddresser
	*commonmodel.ModelConfigWatcher
	*common.RebootRequester
	*common.UnitStateAPI
	// contains filtered or unexported fields
}

UniterAPI implements the latest version (v21) of the Uniter API.

func (*UniterAPI) APIAddresses

func (u *UniterAPI) APIAddresses(ctx context.Context) (result params.StringsResult, err error)

APIAddresses returns the list of addresses used to connect to the API.

func (*UniterAPI) APIHostPorts

func (u *UniterAPI) APIHostPorts(ctx context.Context) (result params.APIHostPortsResult, err error)

APIHostPorts returns the API server addresses.

func (*UniterAPI) ActionStatus

func (u *UniterAPI) ActionStatus(ctx context.Context, args params.Entities) (params.StringResults, error)

ActionStatus returns the status of Actions by Tags passed in.

func (*UniterAPI) Actions

func (u *UniterAPI) Actions(ctx context.Context, args params.Entities) (params.ActionResults, error)

Actions returns the Actions by Tags passed and ensures that the Unit asking for them is the same Unit that has the Actions.

func (*UniterAPI) AssignedMachine

func (u *UniterAPI) AssignedMachine(ctx context.Context, args params.Entities) (params.StringResults, error)

AssignedMachine returns the machine tag for each given unit tag, or an error satisfying params.IsCodeNotAssigned when a unit has no assigned machine.

func (*UniterAPI) AvailabilityZone

func (u *UniterAPI) AvailabilityZone(ctx context.Context, args params.Entities) (params.StringResults, error)

AvailabilityZone returns the availability zone for each given unit, if applicable.

func (*UniterAPI) BeginActions

func (u *UniterAPI) BeginActions(ctx context.Context, args params.Entities) (params.ErrorResults, error)

BeginActions marks the actions represented by the passed in Tags as running.

func (*UniterAPI) CanApplyLXDProfile

func (u *UniterAPI) CanApplyLXDProfile(ctx context.Context, args params.Entities) (params.BoolResults, error)

CanApplyLXDProfile is a shim to call the LXDProfileAPIv2 version of this method.

func (*UniterAPI) CharmArchiveSha256

func (u *UniterAPI) CharmArchiveSha256(ctx context.Context, args params.CharmURLs) (params.StringResults, error)

CharmArchiveSha256 returns the SHA256 digest of the charm archive (bundle) data for each charm url in the given parameters.

func (*UniterAPI) CharmModifiedVersion

func (u *UniterAPI) CharmModifiedVersion(ctx context.Context, args params.Entities) (params.IntResults, error)

CharmModifiedVersion returns the most CharmModifiedVersion for all given units or applications.

func (*UniterAPI) CharmURL

CharmURL returns the charm URL for all given units or applications.

func (*UniterAPI) ClearResolved

func (u *UniterAPI) ClearResolved(ctx context.Context, args params.Entities) (params.ErrorResults, error)

ClearResolved removes any resolved setting from each given unit.

func (*UniterAPI) CloudAPIVersion

func (u *UniterAPI) CloudAPIVersion(ctx context.Context) (params.StringResult, error)

CloudAPIVersion returns the cloud API version, if available.

func (*UniterAPI) CloudSpec

func (u *UniterAPI) CloudSpec(ctx context.Context) (params.CloudSpecResult, error)

CloudSpec returns the cloud spec used by the model in which the authenticated unit or application resides. A check is made beforehand to ensure that the request is made by an entity that has been granted the appropriate trust.

func (*UniterAPI) CommitHookChanges

func (u *UniterAPI) CommitHookChanges(ctx context.Context, args params.CommitHookChangesArgs) (params.ErrorResults, error)

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 (*UniterAPI) ConfigSettings

func (u *UniterAPI) ConfigSettings(ctx context.Context, args params.Entities) (params.ConfigSettingsResults, error)

ConfigSettings returns the complete set of application charm config settings available to each given unit.

func (*UniterAPI) CurrentModel

func (u *UniterAPI) CurrentModel(ctx context.Context) (params.ModelResult, error)

CurrentModel returns the name and UUID for the current juju model.

func (*UniterAPI) Destroy

func (u *UniterAPI) Destroy(ctx context.Context, args params.Entities) (params.ErrorResults, error)

Destroy advances all given Alive units' lifecycles as far as possible. See state/Unit.Destroy().

func (*UniterAPI) DestroyAllSubordinates

func (u *UniterAPI) DestroyAllSubordinates(ctx context.Context, args params.Entities) (params.ErrorResults, error)

DestroyAllSubordinates destroys all subordinates of each given unit.

func (*UniterAPI) EnsureDead

func (u *UniterAPI) EnsureDead(ctx context.Context, args params.Entities) (params.ErrorResults, error)

EnsureDead calls EnsureDead on each given unit from state. If it's Alive, nothing will happen.

func (*UniterAPI) EnterScope

func (u *UniterAPI) EnterScope(ctx context.Context, args params.RelationUnits) (params.ErrorResults, error)

EnterScope ensures each unit has entered its scope in the relation, for all of the given relation/unit pairs. See also state.RelationUnit.EnterScope().

func (*UniterAPI) FinishActions

FinishActions saves the result of a completed Action

func (*UniterAPI) GetPrincipal

func (u *UniterAPI) GetPrincipal(ctx context.Context, args params.Entities) (params.StringBoolResults, error)

GetPrincipal returns the result of calling PrincipalName() and converting it to a tag, on each given unit.

func (*UniterAPI) GoalStates

func (u *UniterAPI) GoalStates(ctx context.Context, args params.Entities) (params.GoalStateResults, error)

GoalStates returns information of charm units and relations.

func (*UniterAPI) HasSubordinates

func (u *UniterAPI) HasSubordinates(ctx context.Context, args params.Entities) (params.BoolResults, error)

HasSubordinates returns the whether each given unit has any subordinates.

func (*UniterAPI) LXDProfileName

func (u *UniterAPI) LXDProfileName(ctx context.Context, args params.Entities) (params.StringResults, error)

LXDProfileName is a shim to call the LXDProfileAPIv2 version of this method.

func (*UniterAPI) LXDProfileRequired

func (u *UniterAPI) LXDProfileRequired(ctx context.Context, args params.CharmURLs) (params.BoolResults, error)

LXDProfileRequired is a shim to call the LXDProfileAPIv2 version of this method.

func (*UniterAPI) LeaveScope

func (u *UniterAPI) LeaveScope(ctx context.Context, args params.RelationUnits) (params.ErrorResults, error)

LeaveScope signals each unit has left its scope in the relation, for all of the given relation/unit pairs. See also state.RelationUnit.LeaveScope().

func (*UniterAPI) Life

Life returns the life status of the specified applications or units.

func (*UniterAPI) LogActionsMessages

func (u *UniterAPI) LogActionsMessages(ctx context.Context, args params.ActionMessageParams) (params.ErrorResults, error)

LogActionsMessages records the log messages against the specified actions.

func (*UniterAPI) Merge

func (u *UniterAPI) Merge(ctx context.Context, _, _ struct{})

Merge is not implemented in version 21 of the uniter.

func (*UniterAPI) NetworkInfo

NetworkInfo returns network interfaces/addresses for specified bindings.

func (*UniterAPI) OpenedMachinePortRangesByEndpoint

func (u *UniterAPI) OpenedMachinePortRangesByEndpoint(ctx context.Context, args params.Entities) (params.OpenPortRangesByEndpointResults, error)

OpenedMachinePortRangesByEndpoint returns the port ranges opened by each unit on the provided machines grouped by application endpoint.

func (*UniterAPI) OpenedPortRangesByEndpoint

func (u *UniterAPI) OpenedPortRangesByEndpoint(ctx context.Context) (params.OpenPortRangesByEndpointResults, error)

OpenedPortRangesByEndpoint returns the port ranges opened by the unit.

func (*UniterAPI) PrivateAddress

func (u *UniterAPI) PrivateAddress(ctx context.Context, args params.Entities) (params.StringResults, error)

PrivateAddress returns the private address for each given unit, if set.

func (*UniterAPI) ProviderType

func (u *UniterAPI) ProviderType(ctx context.Context) (params.StringResult, error)

ProviderType returns the provider type used by the current juju model.

TODO(dimitern): Refactor the uniter to call this instead of calling ModelConfig() just to get the provider type. Once we have machine addresses, this might be completely unnecessary though.

func (*UniterAPI) PublicAddress

func (u *UniterAPI) PublicAddress(ctx context.Context, args params.Entities) (params.StringResults, error)

PublicAddress returns the public address for each given unit, if set.

func (*UniterAPI) Read

func (u *UniterAPI) Read(ctx context.Context, _, _ struct{})

Read is not implemented in version 21 of the uniter.

func (*UniterAPI) ReadLocalApplicationSettings

func (u *UniterAPI) ReadLocalApplicationSettings(ctx context.Context, arg params.RelationUnit) (params.SettingsResult, error)

ReadLocalApplicationSettings returns the local application settings for a particular relation when invoked by the leader unit.

func (*UniterAPI) ReadRemoteSettings

func (u *UniterAPI) ReadRemoteSettings(ctx context.Context, args params.RelationUnitPairs) (params.SettingsResults, error)

ReadRemoteSettings returns the remote settings of each given set of relation/local unit/remote unit.

func (*UniterAPI) ReadSettings

func (u *UniterAPI) ReadSettings(ctx context.Context, args params.RelationUnits) (params.SettingsResults, error)

ReadSettings returns the local settings of each given set of relation/unit.

NOTE(achilleasa): Using this call to read application data is deprecated and will not work for k8s charms (see LP1876097). Instead, clients should use ReadLocalApplicationSettings.

func (*UniterAPI) Refresh

Refresh retrieves the latest values for attributes on this unit.

func (*UniterAPI) Relation

Relation returns information about all given relation/unit pairs, including their id, key and the local endpoint.

func (*UniterAPI) RelationById

func (u *UniterAPI) RelationById(ctx context.Context, args params.RelationIds) (params.RelationResultsV2, error)

RelationById returns information about all given relations, specified by their ids, including their key and the local endpoint.

func (*UniterAPI) RelationsStatus

func (u *UniterAPI) RelationsStatus(ctx context.Context, args params.Entities) (params.RelationUnitStatusResults, error)

RelationsStatus returns for each unit the corresponding relation and status information.

func (*UniterAPI) Resolved

Resolved returns the current resolved setting for each given unit.

func (*UniterAPI) SetCharmURL

SetCharmURL sets the charm URL for each given unit. An error will be returned if a unit is dead, or the charm URL is not known.

func (*UniterAPI) SetRelationStatus

func (u *UniterAPI) SetRelationStatus(ctx context.Context, args params.RelationStatusArgs) (params.ErrorResults, error)

SetRelationStatus updates the status of the specified relations.

func (*UniterAPI) SetWorkloadVersion

func (u *UniterAPI) SetWorkloadVersion(ctx context.Context, args params.EntityWorkloadVersions) (params.ErrorResults, error)

SetWorkloadVersion sets the workload version for each given unit. An error will be returned if a unit is dead.

func (*UniterAPI) UpdateNetworkInfo

func (u *UniterAPI) UpdateNetworkInfo(ctx context.Context, args params.Entities) (params.ErrorResults, error)

UpdateNetworkInfo refreshes the network settings for a unit's bound endpoints.

func (*UniterAPI) WatchActionNotifications

func (u *UniterAPI) WatchActionNotifications(ctx context.Context, args params.Entities) (params.StringsWatchResults, error)

WatchActionNotifications returns a StringsWatcher for observing incoming action calls to a unit. See also state/watcher.go Unit.WatchActionNotifications(). This method is called from api/uniter/uniter.go WatchActionNotifications().

func (*UniterAPI) WatchApplication

func (u *UniterAPI) WatchApplication(ctx context.Context, entity params.Entity) (params.NotifyWatchResult, error)

WatchApplication starts an NotifyWatcher for an application. WatchApplication is not implemented in the UniterAPIv20 facade.

func (*UniterAPI) WatchConfigSettingsHash

func (u *UniterAPI) WatchConfigSettingsHash(ctx context.Context, args params.Entities) (params.StringsWatchResults, error)

WatchConfigSettingsHash returns a StringsWatcher that yields a hash of the config values every time the config changes. The uniter can save this hash and use it to decide whether the config-changed hook needs to be run (or whether this was just an agent restart with no substantive config change).

func (*UniterAPI) WatchInstanceData

func (u *UniterAPI) WatchInstanceData(ctx context.Context, args params.Entities) (params.NotifyWatchResults, error)

WatchInstanceData is a shim to call the LXDProfileAPIv2 version of this method.

func (*UniterAPI) WatchLeadershipSettings

func (u *UniterAPI) WatchLeadershipSettings(ctx context.Context, _, _ struct{})

WatchLeadershipSettings is not implemented in version 21 of the uniter.

func (*UniterAPI) WatchRelationUnits

func (u *UniterAPI) WatchRelationUnits(ctx context.Context, args params.RelationUnits) (params.RelationUnitsWatchResults, error)

WatchRelationUnits returns a RelationUnitsWatcher for observing changes to every unit in the supplied relation that is visible to the supplied unit. See also state/watcher.go:RelationUnit.Watch().

func (*UniterAPI) WatchTrustConfigSettingsHash

func (u *UniterAPI) WatchTrustConfigSettingsHash(ctx context.Context, args params.Entities) (params.StringsWatchResults, error)

WatchTrustConfigSettingsHash returns a StringsWatcher that yields a hash of the application config values whenever they change. The uniter can use the hash to determine whether the actual values have changed since it last saw the config.

func (*UniterAPI) WatchUnit

func (u *UniterAPI) WatchUnit(ctx context.Context, entity params.Entity) (params.NotifyWatchResult, error)

WatchUnit starts an NotifyWatcher for a unit. WatchUnit is not implemented in the UniterAPIv20 facade.

func (*UniterAPI) WatchUnitAddressesHash

func (u *UniterAPI) WatchUnitAddressesHash(ctx context.Context, args params.Entities) (params.StringsWatchResults, error)

WatchUnitAddressesHash returns a StringsWatcher that yields the hashes of the addresses for the unit whenever the addresses change. The uniter can use the hash to determine whether the actual address values have changed since it last saw the config.

func (*UniterAPI) WatchUnitRelations

func (u *UniterAPI) WatchUnitRelations(ctx context.Context, args params.Entities) (params.StringsWatchResults, error)

WatchUnitRelations returns a StringsWatcher, for each given unit, that notifies of changes to the lifecycles of relations relevant to that unit. For principal units, this will be all of the relations for the application. For subordinate units, only relations with the principal unit's application will be monitored.

func (*UniterAPI) WorkloadVersion

func (u *UniterAPI) WorkloadVersion(ctx context.Context, args params.Entities) (params.StringResults, error)

WorkloadVersion returns the workload version for all given units or applications.

type UniterAPIv19

type UniterAPIv19 struct {
	*UniterAPIv20
}

func (*UniterAPIv19) Relation

Relation returns information about all given relation/unit pairs, including their id, key and the local endpoint. v19 returns v1 RelationResults.

func (*UniterAPIv19) RelationById

func (u *UniterAPIv19) RelationById(ctx context.Context, args params.RelationIds) (params.RelationResults, error)

RelationById returns information about all given relations, specified by their ids, including their key and the local endpoint. v19 returns v1 RelationResults.

type UniterAPIv20

type UniterAPIv20 struct {
	*UniterAPI
}

func (*UniterAPIv20) Merge

Merge merges in the provided leadership settings. Only leaders for the given service may perform this operation.

func (*UniterAPIv20) Read

Read reads leadership settings for the provided service ID. Any unit of the service may perform this operation.

func (*UniterAPIv20) Watch

Watch starts an NotifyWatcher for a unit or application. This is being deprecated in favour of separate WatchUnit and WatchApplication methods.

func (*UniterAPIv20) WatchLeadershipSettings

func (u *UniterAPIv20) WatchLeadershipSettings(ctx context.Context, bulkArgs params.Entities) (params.NotifyWatchResults, error)

WatchLeadershipSettings will block the caller until leadership settings for the given service ID change.

Jump to

Keyboard shortcuts

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