Documentation ¶
Index ¶
- Constants
- func Actions(args params.Entities, actionFn func(string) (state.Action, error)) params.ActionResults
- func ApplicationDisplayStatus(model *state.Model, app *state.Application, units []*state.Unit) (status.StatusInfo, error)
- func AuthAndActionFromTagFn(canAccess AuthFunc, getActionByTag func(names.ActionTag) (state.Action, error)) func(string) (state.Action, error)
- func BeginActions(args params.Entities, actionFn func(string) (state.Action, error)) params.ErrorResults
- func CharmArchiveEntry(charmPath, entryPath string) ([]byte, error)
- func ControllerAPIInfo(ctx context.Context, st controllerInfoState, ...) ([]string, string, error)
- func ConvertActions(ar state.ActionReceiver, fn GetActionsFn) ([]params.ActionResult, error)
- func DestroyController(ctx context.Context, st ModelManagerBackend, ...) error
- func DestroyMachines(st origStateInterface, store objectstore.ObjectStore, force bool, ...) error
- func DestroyModel(ctx context.Context, st ModelManagerBackend, ...) error
- func EncodeAccess(descriptionAccess permission.Access) (params.UserAccessPermission, error)
- func EntityStatusFromState(statusInfo status.StatusInfo) params.EntityStatus
- func FinishActions(args params.ActionExecutionResults, ...) params.ErrorResults
- func HasModelAdmin(ctx context.Context, authorizer facade.Authorizer, ...) (bool, error)
- func HasPermission(ctx context.Context, accessGetter UserAccessFunc, utag names.Tag, ...) (bool, error)
- func JujuClientVersionFromRequest(req *http.Request) (version.Number, error)
- func MakeActionResult(actionReceiverTag names.Tag, action state.Action) params.ActionResult
- func MaxWait(in *time.Duration) time.Duration
- func ModelApplicationInfo(applications []Application) ([]params.ModelApplicationInfo, error)
- func ModelFilesystemInfo(in []state.Filesystem) []params.ModelFilesystemInfo
- func ModelMachineInfo(ctx context.Context, st ModelManagerBackend, machineService MachineService) (machineInfo []params.ModelMachineInfo, _ error)
- func ModelUserInfo(ctx context.Context, service modelService, modelTag names.ModelTag, ...) ([]params.ModelUserInfo, error)
- func ModelVolumeInfo(in []state.Volume) []params.ModelVolumeInfo
- func NewToolsFinder(controllerConfigService ControllerConfigService, ...) *toolsFinder
- func NewToolsURLGetter(modelUUID string, a APIHostPortsForAgentsGetter) *toolsURLGetter
- func ParamsActionExecutionResultsToStateActionResults(arg params.ActionExecutionResult) (state.ActionResults, error)
- func ReadCharmFromStorage(ctx context.Context, objectStore ReadObjectStore, dataDir, storagePath string) (string, error)
- func StateJobs(jobs []model.MachineJob) ([]state.MachineJob, error)
- func TagToActionReceiverFn(findEntity func(names.Tag) (state.Entity, error)) func(tag string) (state.ActionReceiver, error)
- func ToolsURL(serverRoot string, v version.Binary) string
- func ValidateCharmOrigin(o *params.CharmOrigin) error
- func WatchActionNotifications(args params.Entities, canAccess AuthFunc, ...) params.StringsWatchResults
- func WatchOneActionReceiverNotifications(tagToActionReceiver func(tag string) (state.ActionReceiver, error), ...) func(names.Tag) (params.StringsWatchResult, error)
- func WatchPendingActionsForReceiver(tagToActionReceiver func(tag string) (state.ActionReceiver, error), ...) func(names.Tag) (params.StringsWatchResult, error)
- type APIAddressAccessor
- type APIAddresser
- func (a *APIAddresser) APIAddresses(ctx context.Context, controllerConfig controller.Config) (params.StringsResult, error)
- func (a *APIAddresser) APIHostPorts(ctx context.Context, controllerConfig controller.Config) (params.APIHostPortsResult, error)
- func (a *APIAddresser) WatchAPIHostPorts(ctx context.Context) (params.NotifyWatchResult, error)
- type APIHostPortsForAgentsGetter
- type AgentEntityWatcher
- type AgentTooler
- type Application
- type ApplicationStatusSetter
- type AuthFunc
- type Authorizer
- type BlockChecker
- type BlockCheckerInterface
- type BlockCommandService
- type CloudService
- type ControllerConfigAPI
- type ControllerConfigService
- type ControllerConfigState
- type ControllerNode
- type CredentialService
- type DeadEnsurer
- type EnsureDeadMachineService
- type ExternalControllerService
- type FindAgentsParams
- type GetActionsFn
- type GetAuthFunc
- type GetMachineUUID
- type InstanceIdGetter
- type LeadershipMachine
- type LeadershipPinning
- func (a *LeadershipPinning) GetMachineApplicationNames(ctx context.Context, id string) ([]string, error)
- func (a *LeadershipPinning) PinApplicationLeaders(ctx context.Context) (params.PinApplicationsResults, error)
- func (a *LeadershipPinning) PinApplicationLeadersByName(ctx context.Context, tag names.Tag, appNames []string) (params.PinApplicationsResults, error)
- func (a *LeadershipPinning) PinnedLeadership(ctx context.Context) (params.PinnedLeadershipResult, error)
- func (a *LeadershipPinning) UnpinApplicationLeaders(ctx context.Context) (params.PinApplicationsResults, error)
- func (a *LeadershipPinning) UnpinApplicationLeadersByName(ctx context.Context, tag names.Tag, appNames []string) (params.PinApplicationsResults, error)
- type LeadershipPinningBackend
- type LifeGetter
- type Machine
- type MachineRebootService
- type MachineService
- type MachineStatusGetter
- type MachineWatcher
- type Model
- type ModelAgentService
- type ModelConfigService
- type ModelConfigWatcher
- type ModelMachinesWatcher
- type ModelManagerBackend
- type ModelPresence
- type ModelPresenceContext
- type ModelStatusAPI
- type NewEnvironFunc
- type PasswordChanger
- type ReadObjectStore
- type RebootActionGetter
- type RebootFlagClearer
- type RebootRequester
- type RelationUnitsWatcher
- type Resources
- type StatusAndErr
- type StatusGetter
- type StatusSetter
- type ToolsFindEntity
- type ToolsFinder
- type ToolsGetter
- type ToolsSetter
- type ToolsStorageGetter
- type ToolsURLGetter
- type UnitAgentFinder
- type UnitStateAPI
- type UnitStateBackend
- type UnitStateService
- type UnitStateState
- type UnitStateUnit
- type UnitStatusGetter
- type UnitsWatcher
- type UserAccessFunc
- type ValueResource
- type WatchableMachineService
Constants ¶
const DefaultCharmIcon = `` /* 9060-byte string literal not displayed */
DefaultCharmIcon holds the default charm icon SVG content. Keep this in sync with the default icon returned by the charm store.
Variables ¶
This section is empty.
Functions ¶
func Actions ¶
func Actions(args params.Entities, actionFn func(string) (state.Action, error)) params.ActionResults
Actions returns the Actions by Tags passed in and ensures that the receiver asking for them is the same one that has the action. It's a helper function currently used by the uniter and by machineactions. It needs an actionFn that can fetch an action from state using it's id that's usually created by AuthAndActionFromTagFn
func ApplicationDisplayStatus ¶
func ApplicationDisplayStatus(model *state.Model, app *state.Application, units []*state.Unit) (status.StatusInfo, error)
ApplicationDisplayStatus returns the status to display for an application.
func AuthAndActionFromTagFn ¶
func AuthAndActionFromTagFn(canAccess AuthFunc, getActionByTag func(names.ActionTag) (state.Action, error)) func(string) (state.Action, error)
AuthAndActionFromTagFn takes in an authorizer function and a function that can fetch action by tags from state and returns a function that can fetch an action from state by id and check the authorization.
func BeginActions ¶
func BeginActions(args params.Entities, actionFn func(string) (state.Action, error)) params.ErrorResults
BeginActions calls begin on every action passed in through args. It's a helper function currently used by the uniter and by machineactions It needs an actionFn that can fetch an action from state using it's id, that's usually created by AuthAndActionFromTagFn
func CharmArchiveEntry ¶
CharmArchiveEntry retrieves the specified entry from the zip archive.
func ControllerAPIInfo ¶
func ControllerAPIInfo(ctx context.Context, st controllerInfoState, controllerConfigService ControllerConfigService) ([]string, string, error)
ControllerAPIInfo returns the local controller details for the given State.
func ConvertActions ¶
func ConvertActions(ar state.ActionReceiver, fn GetActionsFn) ([]params.ActionResult, error)
ConvertActions takes a generic getActionsFn to obtain a slice of state.Action and then converts them to the API slice of params.ActionResult.
func DestroyController ¶
func DestroyController( ctx context.Context, st ModelManagerBackend, blockCommandService BlockCommandService, blockCommandServiceGetter func(model.UUID) BlockCommandService, destroyHostedModels bool, destroyStorage *bool, force *bool, maxWait *time.Duration, modelTimeout *time.Duration, ) error
DestroyController sets the controller model to Dying and, if requested, schedules cleanups so that all of the hosted models are destroyed, or otherwise returns an error indicating that there are hosted models remaining.
func DestroyMachines ¶
func DestroyMachines(st origStateInterface, store objectstore.ObjectStore, force bool, maxWait time.Duration, ids ...string) error
func DestroyModel ¶
func DestroyModel( ctx context.Context, st ModelManagerBackend, blockCommandService BlockCommandService, destroyStorage *bool, force *bool, maxWait *time.Duration, timeout *time.Duration, ) error
DestroyModel sets the model to Dying, such that the model's resources will be destroyed and the model removed from the controller.
func EncodeAccess ¶
func EncodeAccess(descriptionAccess permission.Access) (params.UserAccessPermission, error)
EncodeAccess converts permission.Access to params.AccessPermission.
func EntityStatusFromState ¶
func EntityStatusFromState(statusInfo status.StatusInfo) params.EntityStatus
EntityStatusFromState converts a state.StatusInfo into a params.EntityStatus.
func FinishActions ¶
func FinishActions(args params.ActionExecutionResults, actionFn func(string) (state.Action, error)) params.ErrorResults
FinishActions saves the result of a completed Action. It's a helper function currently used by the uniter and by machineactions It needs an actionFn that can fetch an action from state using it's id that's usually created by AuthAndActionFromTagFn
func HasModelAdmin ¶
func HasModelAdmin( ctx context.Context, authorizer facade.Authorizer, controllerTag names.ControllerTag, modelTag names.ModelTag, ) (bool, error)
HasModelAdmin reports whether a user has admin access to the input model. A user has model access if they are a controller superuser, or if they have been explicitly granted admin access to the model.
func HasPermission ¶
func HasPermission( ctx context.Context, accessGetter UserAccessFunc, utag names.Tag, requestedPermission permission.Access, target names.Tag, ) (bool, error)
HasPermission returns true if the specified user has the specified permission on target.
func JujuClientVersionFromRequest ¶
JujuClientVersionFromRequest returns the Juju client version number from the HTTP request.
func MakeActionResult ¶
func MakeActionResult(actionReceiverTag names.Tag, action state.Action) params.ActionResult
MakeActionResult does the actual type conversion from state.Action to params.ActionResult.
func MaxWait ¶
MaxWait is how far in the future the backstop force cleanup will be scheduled. Default is 1min if no value is provided.
func ModelApplicationInfo ¶
func ModelApplicationInfo(applications []Application) ([]params.ModelApplicationInfo, error)
ModelApplicationInfo returns information about applications.
func ModelFilesystemInfo ¶
func ModelFilesystemInfo(in []state.Filesystem) []params.ModelFilesystemInfo
ModelFilesystemInfo returns information about filesystems in the model.
func ModelMachineInfo ¶
func ModelMachineInfo(ctx context.Context, st ModelManagerBackend, machineService MachineService) (machineInfo []params.ModelMachineInfo, _ error)
ModelMachineInfo returns information about machine hardware for alive top level machines (not containers).
func ModelUserInfo ¶
func ModelUserInfo(ctx context.Context, service modelService, modelTag names.ModelTag, apiUser user.Name, isAdmin bool) ([]params.ModelUserInfo, error)
ModelUserInfo gets model user info from the modelService and converts it into params.ModelUserInfo.
func ModelVolumeInfo ¶
func ModelVolumeInfo(in []state.Volume) []params.ModelVolumeInfo
ModelVolumeInfo returns information about volumes in the model.
func NewToolsFinder ¶
func NewToolsFinder( controllerConfigService ControllerConfigService, toolsStorageGetter ToolsStorageGetter, urlGetter ToolsURLGetter, newEnviron NewEnvironFunc, store objectstore.ObjectStore, ) *toolsFinder
NewToolsFinder returns a new ToolsFinder, returning tools with their URLs pointing at the API server.
func NewToolsURLGetter ¶
func NewToolsURLGetter(modelUUID string, a APIHostPortsForAgentsGetter) *toolsURLGetter
NewToolsURLGetter creates a new ToolsURLGetter that returns tools URLs pointing at an API server.
func ParamsActionExecutionResultsToStateActionResults ¶
func ParamsActionExecutionResultsToStateActionResults(arg params.ActionExecutionResult) (state.ActionResults, error)
ParamsActionExecutionResultsToStateActionResults does exactly what the name implies.
func ReadCharmFromStorage ¶
func ReadCharmFromStorage(ctx context.Context, objectStore ReadObjectStore, dataDir, storagePath string) (string, error)
ReadCharmFromStorage fetches the charm at the specified path from the store and copies it to a temp directory in dataDir.
func StateJobs ¶
func StateJobs(jobs []model.MachineJob) ([]state.MachineJob, error)
StateJobs translates a slice of multiwatcher jobs to their equivalents in state.
func TagToActionReceiverFn ¶
func TagToActionReceiverFn(findEntity func(names.Tag) (state.Entity, error)) func(tag string) (state.ActionReceiver, error)
TagToActionReceiverFn takes a tag string and tries to convert it to an ActionReceiver. It needs a findEntity function passed in that can search for the tags in state.
func ValidateCharmOrigin ¶
func ValidateCharmOrigin(o *params.CharmOrigin) error
ValidateCharmOrigin validates the Source of the charm origin for args received in a facade. This may evolve over time to include more pieces.
func WatchActionNotifications ¶
func WatchActionNotifications(args params.Entities, canAccess AuthFunc, watchOne func(names.Tag) (params.StringsWatchResult, error)) params.StringsWatchResults
WatchActionNotifications returns a StringsWatcher for observing incoming actions towards an actionreceiver. It's a helper function currently used by the uniter and by machineactions canAccess is passed in by the respective caller to provide authorization. watchOne is usually a function created by WatchOneActionReceiverNotifications
func WatchOneActionReceiverNotifications ¶
func WatchOneActionReceiverNotifications(tagToActionReceiver func(tag string) (state.ActionReceiver, error), registerFunc func(r worker.Worker) string) func(names.Tag) (params.StringsWatchResult, error)
WatchOneActionReceiverNotifications returns a function for creating a watcher on all action notifications (action adds + changes) for one receiver. It needs a tagToActionReceiver function and a registerFunc to register resources. It's a helper function currently used by the uniter and by machineactions
func WatchPendingActionsForReceiver ¶
func WatchPendingActionsForReceiver(tagToActionReceiver func(tag string) (state.ActionReceiver, error), registerFunc func(r worker.Worker) string) func(names.Tag) (params.StringsWatchResult, error)
WatchPendingActionsForReceiver returns a function for creating a watcher on new pending Actions for one receiver. It needs a tagToActionReceiver function and a registerFunc to register resources. It's a helper function currently used by the uniter and by machineactions
Types ¶
type APIAddressAccessor ¶
type APIAddressAccessor interface { APIHostPortsForAgents(controller.Config) ([]network.SpaceHostPorts, error) WatchAPIHostPortsForAgents() state.NotifyWatcher }
APIAddressAccessor describes methods that allow agents to maintain up-to-date information on how to connect to the Juju API server.
type APIAddresser ¶
type APIAddresser struct {
// contains filtered or unexported fields
}
APIAddresser implements the APIAddresses method. Note that the getter backing for this implies that it is suitable for use by agents, which are bound by the configured controller management space. It is not suitable for callers requiring *all* available API addresses.
func NewAPIAddresser ¶
func NewAPIAddresser(getter APIAddressAccessor, resources facade.Resources) *APIAddresser
NewAPIAddresser returns a new APIAddresser that uses the given getter to fetch its addresses.
func (*APIAddresser) APIAddresses ¶
func (a *APIAddresser) APIAddresses(ctx context.Context, controllerConfig controller.Config) (params.StringsResult, error)
APIAddresses returns the list of addresses used to connect to the API.
func (*APIAddresser) APIHostPorts ¶
func (a *APIAddresser) APIHostPorts(ctx context.Context, controllerConfig controller.Config) (params.APIHostPortsResult, error)
APIHostPorts returns the API server addresses.
func (*APIAddresser) WatchAPIHostPorts ¶
func (a *APIAddresser) WatchAPIHostPorts(ctx context.Context) (params.NotifyWatchResult, error)
WatchAPIHostPorts watches the API server addresses.
type APIHostPortsForAgentsGetter ¶
type APIHostPortsForAgentsGetter interface { // APIHostPortsForAgents returns the HostPorts for each API server that // are suitable for agent-to-controller API communication based on the // configured (if any) controller management space. APIHostPortsForAgents(controller.Config) ([]network.SpaceHostPorts, error) }
APIHostPortsForAgentsGetter is an interface providing the APIHostPortsForAgents method.
type AgentEntityWatcher ¶
type AgentEntityWatcher struct {
// contains filtered or unexported fields
}
AgentEntityWatcher implements a common Watch method for use by various facades.
func NewAgentEntityWatcher ¶
func NewAgentEntityWatcher(st state.EntityFinder, watcherRegistry facade.WatcherRegistry, getCanWatch GetAuthFunc) *AgentEntityWatcher
NewAgentEntityWatcher returns a new AgentEntityWatcher. The GetAuthFunc will be used on each invocation of Watch to determine current permissions.
func (*AgentEntityWatcher) Watch ¶
func (a *AgentEntityWatcher) Watch(ctx context.Context, args params.Entities) (params.NotifyWatchResults, error)
Watch starts an NotifyWatcher for each given entity.
type AgentTooler ¶
type AgentTooler interface { AgentTools() (*coretools.Tools, error) SetAgentVersion(version.Binary) error // Tag is included in this interface only so the generated mock of // AgentTooler implements state.Entity, returned by FindEntity Tag() names.Tag }
AgentTooler is implemented by entities that have associated agent tools.
type Application ¶
Application defines methods provided by a state.Application instance.
type ApplicationStatusSetter ¶
type ApplicationStatusSetter struct {
// contains filtered or unexported fields
}
ApplicationStatusSetter implements a SetApplicationStatus method to be used by facades that can change an application status. This is only slightly less evil than ApplicationStatusGetter. We have StatusSetter already; all this does is set the status for the wrong entity, and render the auth so confused as to be ~worthless.
func NewApplicationStatusSetter ¶
func NewApplicationStatusSetter(st *state.State, getCanModify GetAuthFunc, leadershipChecker leadership.Checker) *ApplicationStatusSetter
NewApplicationStatusSetter returns a ServiceStatusSetter.
func (*ApplicationStatusSetter) SetStatus ¶
func (s *ApplicationStatusSetter) SetStatus(ctx context.Context, args params.SetStatus) (params.ErrorResults, error)
SetStatus sets the status on the service given by the unit in args if the unit is the leader.
type AuthFunc ¶
type AuthFunc func(tag names.Tag) bool
AuthFunc returns whether the given entity is available to some operation.
type Authorizer ¶
type Authorizer interface { // AuthController returns whether the authenticated entity is // a machine acting as a controller. Can't be removed from this // interface without introducing a dependency on something else // to look up that property: it's not inherent in the result of // GetAuthTag, as the other methods all are. AuthController() bool // AuthMachineAgent returns true if the entity is a machine agent. AuthMachineAgent() bool // GetAuthTag returns the entity's tag. GetAuthTag() names.Tag }
Authorizer represents the authenticated entity using the API server.
type BlockChecker ¶
type BlockChecker struct {
// contains filtered or unexported fields
}
BlockChecker checks for current blocks if any.
func NewBlockChecker ¶
func NewBlockChecker(s BlockCommandService) *BlockChecker
NewBlockChecker returns a new BlockChecker.
func (*BlockChecker) ChangeAllowed ¶
func (c *BlockChecker) ChangeAllowed(ctx context.Context) error
ChangeAllowed checks if change block is in place. Change block prevents all operations that may change current model in any way from running successfully.
func (*BlockChecker) DestroyAllowed ¶
func (c *BlockChecker) DestroyAllowed(ctx context.Context) error
DestroyAllowed checks if destroy block is in place. Destroy block prevents destruction of current model.
func (*BlockChecker) RemoveAllowed ¶
func (c *BlockChecker) RemoveAllowed(ctx context.Context) error
RemoveAllowed checks if remove block is in place. Remove block prevents removal of machine, service, unit and relation from current model.
type BlockCheckerInterface ¶
type BlockCheckerInterface interface { // ChangeAllowed checks if change block is in place. ChangeAllowed(context.Context) error // RemoveAllowed checks if remove block is in place. RemoveAllowed(context.Context) error // DestroyAllowed checks if destroy block is in place. DestroyAllowed(context.Context) error }
BlockCheckerInterface defines methods of BlockChecker.
type BlockCommandService ¶
type BlockCommandService interface { // GetBlockSwitchedOn returns the optional block message if it is switched // on for the given type. GetBlockSwitchedOn(ctx context.Context, t blockcommand.BlockType) (string, error) // GetBlocks returns all the blocks that are currently in place. GetBlocks(ctx context.Context) ([]blockcommand.Block, error) }
BlockCommandService defines methods for interacting with block commands.
type CloudService ¶
type CloudService interface { // Cloud returns the named cloud. Cloud(ctx context.Context, name string) (*cloud.Cloud, error) // WatchCloud returns a watcher that observes changes to the specified cloud. WatchCloud(ctx context.Context, name string) (watcher.NotifyWatcher, error) }
CloudService provides access to clouds.
type ControllerConfigAPI ¶
type ControllerConfigAPI struct {
// contains filtered or unexported fields
}
ControllerConfigAPI implements two common methods for use by various facades - eg Provisioner and ControllerConfig.
func NewControllerConfigAPI ¶
func NewControllerConfigAPI( st ControllerConfigState, controllerConfigService ControllerConfigService, externalControllerService ExternalControllerService, ) *ControllerConfigAPI
NewControllerConfigAPI returns a new ControllerConfigAPI.
func (*ControllerConfigAPI) ControllerAPIInfoForModels ¶
func (s *ControllerConfigAPI) ControllerAPIInfoForModels(ctx context.Context, args params.Entities) (params.ControllerAPIInfoResults, error)
ControllerAPIInfoForModels returns the controller api connection details for the specified models.
func (*ControllerConfigAPI) ControllerConfig ¶
func (s *ControllerConfigAPI) ControllerConfig(ctx context.Context) (params.ControllerConfigResult, error)
ControllerConfig returns the controller's configuration.
type ControllerConfigService ¶
type ControllerConfigService interface {
ControllerConfig(context.Context) (controller.Config, error)
}
ControllerConfigService is an interface that provides the controller configuration for the model.
type ControllerConfigState ¶
type ControllerConfigState interface { ModelExists(string) (bool, error) APIHostPortsForAgents(controller.Config) ([]network.SpaceHostPorts, error) CompletedMigrationForModel(string) (state.ModelMigration, error) }
ControllerConfigState defines the methods needed by ControllerConfigAPI
type ControllerNode ¶
type CredentialService ¶
type CredentialService interface { // CloudCredential returns the cloud credential for the given tag. CloudCredential(ctx context.Context, key credential.Key) (cloud.Credential, error) // WatchCredential returns a watcher that observes changes to the specified // credential. WatchCredential(ctx context.Context, key credential.Key) (watcher.NotifyWatcher, error) }
CredentialService provides access to credentials.
type DeadEnsurer ¶
type DeadEnsurer struct {
// contains filtered or unexported fields
}
DeadEnsurer implements a common EnsureDead method for use by various facades.
func NewDeadEnsurer ¶
func NewDeadEnsurer(st state.EntityFinder, getCanModify GetAuthFunc, machineService EnsureDeadMachineService) *DeadEnsurer
NewDeadEnsurer returns a new DeadEnsurer. The GetAuthFunc will be used on each invocation of EnsureDead to determine current permissions.
func (*DeadEnsurer) EnsureDead ¶
func (d *DeadEnsurer) EnsureDead(ctx context.Context, args params.Entities) (params.ErrorResults, error)
EnsureDead calls EnsureDead on each given entity from state. It will fail if the entity is not present. If it's Alive, nothing will happen (see state/EnsureDead() for units or machines).
type EnsureDeadMachineService ¶
type EnsureDeadMachineService interface { // EnsureDeadMachine sets the provided machine's life status to Dead. // No error is returned if the provided machine doesn't exist, just nothing // gets updated. EnsureDeadMachine(ctx context.Context, machineName machine.Name) error }
EnsureDeadMachineService defines the methods that the facade assumes from the Machine service supporting EnsureDead methods
type ExternalControllerService ¶
type ExternalControllerService interface { // ControllerForModel returns the controller record that's associated // with the modelUUID. ControllerForModel(ctx context.Context, modelUUID string) (*crossmodel.ControllerInfo, error) // UpdateExternalController persists the input controller // record. UpdateExternalController(ctx context.Context, ec crossmodel.ControllerInfo) error }
ExternalControllerService defines the methods that the controller facade needs from the controller state.
type FindAgentsParams ¶
type FindAgentsParams struct { // ControllerCfg is the controller config. ControllerCfg controller.Config // ModelType is the type of the model. ModelType state.ModelType // Number will be used to match tools versions exactly if non-zero. Number version.Number // MajorVersion will be used to match the major version if non-zero. MajorVersion int // MinorVersion will be used to match the minor version if non-zero. MinorVersion int // Arch will be used to match tools by architecture if non-empty. Arch string // OSType will be used to match tools by os type if non-empty. OSType string // AgentStream will be used to set agent stream to search AgentStream string }
FindAgentsParams defines parameters for the FindAgents method.
type GetActionsFn ¶
GetActionsFn declares the function type that returns a slice of state.Action and error, used to curry specific list functions.
type GetAuthFunc ¶
GetAuthFunc returns an AuthFunc.
func AuthAlways ¶
func AuthAlways() GetAuthFunc
AuthAlways returns an authentication function that always returns true iff it is passed a valid tag.
func AuthAny ¶
func AuthAny(getFuncs ...GetAuthFunc) GetAuthFunc
AuthAny returns an AuthFunc generator that returns an AuthFunc that accepts any tag authorized by any of its arguments. If no arguments are passed this is equivalent to AuthNever.
func AuthFuncForMachineAgent ¶
func AuthFuncForMachineAgent(authorizer Authorizer) GetAuthFunc
AuthFuncForMachineAgent returns a GetAuthFunc which creates an AuthFunc allowing only machine agents and their controllers
func AuthFuncForTag ¶
func AuthFuncForTag(valid names.Tag) GetAuthFunc
AuthFuncForTag returns an authentication function that always returns true iff it is passed a specific tag.
func AuthFuncForTagKind ¶
func AuthFuncForTagKind(kind string) GetAuthFunc
AuthFuncForTagKind returns a GetAuthFunc which creates an AuthFunc allowing only the given tag kind and denies all others. Passing an empty kind is an error.
type GetMachineUUID ¶
GetMachineUUID represents a function type that takes a context.Context as input and returns a string representation of the machine UUID and an error. It allows to smuggle machine identification to the watcher, because retrieving the machine UUID implies a machine service calls which requires a context.
type InstanceIdGetter ¶
type InstanceIdGetter struct {
// contains filtered or unexported fields
}
InstanceIdGetter implements a common InstanceId method for use by various facades.
func NewInstanceIdGetter ¶
func NewInstanceIdGetter(machineService MachineService, getCanRead GetAuthFunc) *InstanceIdGetter
NewInstanceIdGetter returns a new InstanceIdGetter. The GetAuthFunc will be used on each invocation of InstanceId to determine current permissions.
func (*InstanceIdGetter) InstanceId ¶
func (ig *InstanceIdGetter) InstanceId(ctx context.Context, args params.Entities) (params.StringResults, error)
InstanceId returns the provider specific instance id for each given machine or an CodeNotProvisioned error, if not set.
type LeadershipMachine ¶
LeadershipMachine is an indirection for state.machine.
type LeadershipPinning ¶
type LeadershipPinning struct {
// contains filtered or unexported fields
}
LeadershipPinning defines a type for pinning and unpinning application leaders.
func NewLeadershipPinning ¶
func NewLeadershipPinning( st LeadershipPinningBackend, modelTag names.ModelTag, pinner leadership.Pinner, authorizer facade.Authorizer, ) (*LeadershipPinning, error)
NewLeadershipPinning creates and returns a new leadership API from the input tag, Pinner implementation and facade Authorizer.
func NewLeadershipPinningFromContext ¶
func NewLeadershipPinningFromContext(ctx facade.ModelContext) (*LeadershipPinning, error)
NewLeadershipPinningFromContext creates and returns a new leadership from a facade context. This signature is suitable for facade registration.
func (*LeadershipPinning) GetMachineApplicationNames ¶
func (a *LeadershipPinning) GetMachineApplicationNames(ctx context.Context, id string) ([]string, error)
GetMachineApplicationNames returns the applications associated with a machine.
func (*LeadershipPinning) PinApplicationLeaders ¶
func (a *LeadershipPinning) PinApplicationLeaders(ctx context.Context) (params.PinApplicationsResults, error)
PinApplicationLeaders pins leadership for applications based on the auth tag provided.
func (*LeadershipPinning) PinApplicationLeadersByName ¶
func (a *LeadershipPinning) PinApplicationLeadersByName(ctx context.Context, tag names.Tag, appNames []string) (params.PinApplicationsResults, error)
PinApplicationLeadersByName takes a slice of application names and attempts to pin them accordingly.
func (*LeadershipPinning) PinnedLeadership ¶
func (a *LeadershipPinning) PinnedLeadership(ctx context.Context) (params.PinnedLeadershipResult, error)
PinnedLeadership returns all pinned applications and the entities that require their pinned behaviour, for leadership in the current model.
func (*LeadershipPinning) UnpinApplicationLeaders ¶
func (a *LeadershipPinning) UnpinApplicationLeaders(ctx context.Context) (params.PinApplicationsResults, error)
UnpinApplicationLeaders unpins leadership for applications based on the auth tag provided.
func (*LeadershipPinning) UnpinApplicationLeadersByName ¶
func (a *LeadershipPinning) UnpinApplicationLeadersByName(ctx context.Context, tag names.Tag, appNames []string) (params.PinApplicationsResults, error)
UnpinApplicationLeadersByName takes a slice of application names and attempts to unpin them accordingly.
type LeadershipPinningBackend ¶
type LeadershipPinningBackend interface {
Machine(string) (LeadershipMachine, error)
}
LeadershipPinningBackend describes state method wrappers used by this API.
type LifeGetter ¶
type LifeGetter struct {
// contains filtered or unexported fields
}
LifeGetter implements a common Life method for use by various facades.
func NewLifeGetter ¶
func NewLifeGetter(st state.EntityFinder, getCanRead GetAuthFunc) *LifeGetter
NewLifeGetter returns a new LifeGetter. The GetAuthFunc will be used on each invocation of Life to determine current permissions.
func (*LifeGetter) Life ¶
func (lg *LifeGetter) Life(ctx context.Context, args params.Entities) (params.LifeResults, error)
Life returns the life status of every supplied entity, where available.
type Machine ¶
type Machine interface { Id() string Status() (status.StatusInfo, error) ContainerType() instance.ContainerType Life() state.Life ForceDestroy(time.Duration) error Destroy(objectstore.ObjectStore) error IsManager() bool }
type MachineRebootService ¶
type MachineRebootService 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) (machine.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 machine.Name) (string, error) }
MachineRebootService is an interface that defines methods for managing machine reboots.
type MachineService ¶
type MachineService interface { // EnsureDeadMachine sets the provided machine's life status to Dead. EnsureDeadMachine(ctx context.Context, machineName machine.Name) error // GetMachineUUID returns the UUID of a machine identified by its name. GetMachineUUID(ctx context.Context, name machine.Name) (string, error) // InstanceID returns the cloud specific instance id for this machine. InstanceID(ctx context.Context, mUUID string) (instance.Id, error) // InstanceIDAndName returns the cloud specific instance ID and display name for // this machine. InstanceIDAndName(ctx context.Context, machineUUID string) (instance.Id, string, error) // HardwareCharacteristics returns the hardware characteristics of the // specified machine. HardwareCharacteristics(ctx context.Context, machineUUID string) (*instance.HardwareCharacteristics, error) }
MachineService defines the methods that the facade assumes from the Machine service.
type MachineStatusGetter ¶
type MachineStatusGetter interface { Status() (status.StatusInfo, error) Id() string Life() state.Life }
MachineStatusGetter defines the machine functionality required to status.
type MachineWatcher ¶
type MachineWatcher struct {
// contains filtered or unexported fields
}
MachineWatcher is a struct that represents a watcher for various events produced by a specific machine. It uses the WatchableMachineService interface to watch for changes and the facade.WatcherRegistry interface to register and unregister watchers. The GetMachineUUID type is a function that returns the UUID of the machine.
func NewMachineRebootWatcher ¶
func NewMachineRebootWatcher(service WatchableMachineService, watcherRegistry facade.WatcherRegistry, uuid GetMachineUUID) *MachineWatcher
NewMachineRebootWatcher creates a new MachineWatcher instance with the given dependencies. It takes a WatchableMachineService, a facade.WatcherRegistry, and a GetMachineUUID function as input. The returned MachineWatcher instance tracks changes in the machine domain and registers/unregisters watchers for a specific machine UUID.
func (*MachineWatcher) WatchForRebootEvent ¶
func (mrw *MachineWatcher) WatchForRebootEvent(ctx context.Context) (params.NotifyWatchResult, error)
WatchForRebootEvent starts a watcher to track if there is a new reboot request for a specific machine ID or its parent (in case we are a container).
type Model ¶
type Model interface { Type() state.ModelType Life() state.Life ModelTag() names.ModelTag Owner() names.UserTag Status() (status.StatusInfo, error) CloudName() string CloudCredentialTag() (names.CloudCredentialTag, bool) CloudRegion() string Destroy(state.DestroyModelParams) error MigrationMode() state.MigrationMode Name() string UUID() string // TODO(aflynn): ControllerUUID is only here because the EnvironConfigGetter // needs a Model with this model. Once this is gone ControllerUUID can be // removed from this interface. ControllerUUID() string SetCloudCredential(tag names.CloudCredentialTag) (bool, error) }
Model defines methods provided by a state.Model instance. All the interface methods are defined directly on state.Model and are reproduced here for use in tests.
type ModelAgentService ¶
type ModelAgentService interface { // GetModelTargetAgentVersion returns the target agent version for the // entire model. The following errors can be returned: // - [github.com/juju/juju/domain/model/errors.NotFound] - When the model does // not exist. GetModelTargetAgentVersion(context.Context) (version.Number, error) // GetMachineTargetAgentVersion reports the target agent version that should // be running on the provided machine identified by name. The following // errors are possible: // - [github.com/juju/juju/domain/machine/errors.MachineNotFound] // - [github.com/juju/juju/domain/model/errors.NotFound] GetMachineTargetAgentVersion(context.Context, machine.Name) (version.Number, error) // GetUnitTargetAgentVersion reports the target agent version that should be // being run on the provided unit identified by name. The following errors // are possible: // - [github.com/juju/juju/domain/application/errors.UnitNotFound] - When // the unit in question does not exist. // - [github.com/juju/juju/domain/model/errors.NotFound] - When the model // the unit belongs to no longer exists. GetUnitTargetAgentVersion(context.Context, string) (version.Number, error) }
ModelAgentService provides access to the Juju agent version for the model.
type ModelConfigService ¶
type ModelConfigService interface { // ModelConfig returns the current config for the model. ModelConfig(ctx context.Context) (*config.Config, error) // Watch returns a watcher that returns keys for any changes to model // config. Watch() (watcher.StringsWatcher, error) }
ModelConfigService is an interface that provides access to the model configuration.
type ModelConfigWatcher ¶
type ModelConfigWatcher struct {
// contains filtered or unexported fields
}
ModelConfigWatcher implements two common methods for use by various facades - WatchForModelConfigChanges and ModelConfig.
func NewModelConfigWatcher ¶
func NewModelConfigWatcher(modelConfigService ModelConfigService, watcherRegistry facade.WatcherRegistry) *ModelConfigWatcher
NewModelConfigWatcher returns a new ModelConfigWatcher. Active watchers will be stored in the provided facade.WatcherRegistry.
func (*ModelConfigWatcher) ModelConfig ¶
func (m *ModelConfigWatcher) ModelConfig(ctx context.Context) (params.ModelConfigResult, error)
ModelConfig returns the current model's configuration.
func (*ModelConfigWatcher) WatchForModelConfigChanges ¶
func (m *ModelConfigWatcher) WatchForModelConfigChanges(ctx context.Context) (params.NotifyWatchResult, error)
WatchForModelConfigChanges returns a NotifyWatcher that observes changes to the model configuration. Note that although the NotifyWatchResult contains an Error field, it's not used because we are only returning a single watcher, so we use the regular error return.
type ModelMachinesWatcher ¶
type ModelMachinesWatcher struct {
// contains filtered or unexported fields
}
ModelMachinesWatcher implements a common WatchModelMachines method for use by various facades.
func NewModelMachinesWatcher ¶
func NewModelMachinesWatcher(st state.ModelMachinesWatcher, resources facade.Resources, authorizer facade.Authorizer) *ModelMachinesWatcher
NewModelMachinesWatcher returns a new ModelMachinesWatcher. The GetAuthFunc will be used on each invocation of WatchUnits to determine current permissions.
func (*ModelMachinesWatcher) WatchModelMachineStartTimes ¶
func (e *ModelMachinesWatcher) WatchModelMachineStartTimes(ctx context.Context) (params.StringsWatchResult, error)
WatchModelMachineStartTimes watches the non-container machines in the model for changes to the Life or AgentStartTime fields and reports them as a batch.
func (*ModelMachinesWatcher) WatchModelMachines ¶
func (e *ModelMachinesWatcher) WatchModelMachines(ctx context.Context) (params.StringsWatchResult, error)
WatchModelMachines returns a StringsWatcher that notifies of changes to the life cycles of the top level machines in the current model.
type ModelManagerBackend ¶
type ModelManagerBackend interface { APIHostPortsForAgentsGetter ToolsStorageGetter ModelUUID() string NewModel(state.ModelArgs) (Model, ModelManagerBackend, error) Model() (Model, error) AllModelUUIDs() ([]string, error) GetModel(string) (Model, func() bool, error) GetBackend(string) (ModelManagerBackend, func() bool, error) ControllerModelTag() names.ModelTag IsController() bool ControllerNodes() ([]ControllerNode, error) Unit(name string) (*state.Unit, error) Name() string ModelTag() names.ModelTag AllMachines() (machines []Machine, err error) AllApplications() (applications []Application, err error) AllFilesystems() ([]state.Filesystem, error) AllVolumes() ([]state.Volume, error) ControllerTag() names.ControllerTag Export(leaders map[string]string, store objectstore.ObjectStore) (description.Model, error) ExportPartial(state.ExportConfig, objectstore.ObjectStore) (description.Model, error) ConstraintsBySpaceName(string) ([]*state.Constraints, error) LatestMigration() (state.ModelMigration, error) DumpAll() (map[string]interface{}, error) Close() error HAPrimaryMachine() (names.MachineTag, error) }
ModelManagerBackend defines methods provided by a state instance used by the model manager apiserver implementation. All the interface methods are defined directly on state.State and are reproduced here for use in tests.
func NewModelManagerBackend ¶
func NewModelManagerBackend(m *state.Model, pool *state.StatePool) ModelManagerBackend
NewModelManagerBackend returns a modelManagerStateShim wrapping the passed state, which implements ModelManagerBackend.
func NewUserAwareModelManagerBackend ¶
func NewUserAwareModelManagerBackend(m *state.Model, pool *state.StatePool, u names.UserTag) ModelManagerBackend
NewUserAwareModelManagerBackend returns a user-aware modelManagerStateShim wrapping the passed state, which implements ModelManagerBackend. The returned backend may emit redirect errors when attempting a model lookup for a migrated model that this user had been granted access to.
type ModelPresence ¶
type ModelPresence interface { // For a given non controller agent, return the Status for that agent. AgentStatus(agent string) (presence.Status, error) }
ModelPresence represents the API server connections for a model.
type ModelPresenceContext ¶
type ModelPresenceContext struct { // Presence represents the API server connections for a model. Presence ModelPresence }
ModelPresenceContext represents the known agent presence state for the entire model.
func (*ModelPresenceContext) MachineStatus ¶
func (c *ModelPresenceContext) MachineStatus(ctx context.Context, machine MachineStatusGetter) (status.StatusInfo, error)
MachineStatus returns the machine agent status for a given machine, with special handling for agent presence.
func (*ModelPresenceContext) UnitStatus ¶
func (c *ModelPresenceContext) UnitStatus(ctx context.Context, unit UnitStatusGetter) (agent StatusAndErr, workload StatusAndErr)
UnitStatus returns the unit agent and workload status for a given unit, with special handling for agent presence.
type ModelStatusAPI ¶
type ModelStatusAPI struct {
// contains filtered or unexported fields
}
ModelStatusAPI implements the ModelStatus() API.
func NewModelStatusAPI ¶
func NewModelStatusAPI(backend ModelManagerBackend, machineService MachineService, authorizer facade.Authorizer, apiUser names.UserTag) *ModelStatusAPI
NewModelStatusAPI creates an implementation providing the ModelStatus() API.
func (*ModelStatusAPI) ModelStatus ¶
func (c *ModelStatusAPI) ModelStatus(ctx context.Context, req params.Entities) (params.ModelStatusResults, error)
ModelStatus returns a summary of the model.
type NewEnvironFunc ¶
type NewEnvironFunc func(context.Context) (environs.BootstrapEnviron, error)
NewEnvironFunc is a function that returns a BootstrapEnviron instance.
func EnvironFuncForModel ¶
func EnvironFuncForModel(model stateenvirons.Model, cloudService CloudService, credentialService stateenvirons.CredentialService, configGetter environs.EnvironConfigGetter, ) NewEnvironFunc
EnvironFuncForModel is a helper function that returns a NewEnvironFunc suitable for the specified model.
type PasswordChanger ¶
type PasswordChanger struct {
// contains filtered or unexported fields
}
PasswordChanger implements a common SetPasswords method for use by various facades.
func NewPasswordChanger ¶
func NewPasswordChanger(st state.EntityFinder, getCanChange GetAuthFunc) *PasswordChanger
NewPasswordChanger returns a new PasswordChanger. The GetAuthFunc will be used on each invocation of SetPasswords to determine current permissions.
func (*PasswordChanger) SetPasswords ¶
func (pc *PasswordChanger) SetPasswords(ctx context.Context, args params.EntityPasswords) (params.ErrorResults, error)
SetPasswords sets the given password for each supplied entity, if possible.
type ReadObjectStore ¶
type ReadObjectStore interface { // Get returns an io.ReadCloser for data at path, namespaced to the // model. Get(context.Context, string) (io.ReadCloser, int64, error) }
ReadObjectStore represents an object store that can only be read from.
type RebootActionGetter ¶
type RebootActionGetter struct {
// contains filtered or unexported fields
}
RebootActionGetter implements the GetRebootAction API method
func NewRebootActionGetter ¶
func NewRebootActionGetter(machineService MachineRebootService, auth GetAuthFunc) *RebootActionGetter
func (*RebootActionGetter) GetRebootAction ¶
func (r *RebootActionGetter) GetRebootAction(ctx context.Context, args params.Entities) (params.RebootActionResults, error)
GetRebootAction returns the action a machine agent should take. If a reboot flag is set on the machine, then that machine is expected to reboot (params.ShouldReboot). a reboot flag set on the machine parent or grandparent, will cause the machine to shutdown (params.ShouldShutdown). If no reboot flag is set, the machine should do nothing (params.ShouldDoNothing).
type RebootFlagClearer ¶
type RebootFlagClearer struct {
// contains filtered or unexported fields
}
RebootFlagClearer implements the ClearReboot API call
func NewRebootFlagClearer ¶
func NewRebootFlagClearer(machineService MachineRebootService, auth GetAuthFunc) *RebootFlagClearer
func (*RebootFlagClearer) ClearReboot ¶
func (r *RebootFlagClearer) ClearReboot(ctx context.Context, args params.Entities) (params.ErrorResults, error)
ClearReboot will clear the reboot flag on provided machines, if it exists.
type RebootRequester ¶
type RebootRequester struct {
// contains filtered or unexported fields
}
RebootRequester implements the RequestReboot API method
func NewRebootRequester ¶
func NewRebootRequester(machineService MachineRebootService, auth GetAuthFunc) *RebootRequester
func (*RebootRequester) RequestReboot ¶
func (r *RebootRequester) RequestReboot(ctx context.Context, args params.Entities) (params.ErrorResults, error)
RequestReboot sets the reboot flag on the provided machines
type RelationUnitsWatcher ¶
type RelationUnitsWatcher interface { watcher.Watcher[params.RelationUnitsChange] // Stop is needed to implement facade.Resource. // Deprecated: use Kill and Wait instead. Stop() error // Err implements watcher.Errer. // Deprecated: use Kill and Wait instead. Err() error }
RelationUnitsWatcher represents a state.RelationUnitsWatcher at the apiserver level (different type for changes).
func RelationUnitsWatcherFromState ¶
func RelationUnitsWatcherFromState(source state.RelationUnitsWatcher) (RelationUnitsWatcher, error)
RelationUnitsWatcherFromState wraps a state-level RelationUnitsWatcher in an equivalent apiserver-level one, taking responsibility for the source watcher's lifetime.
type Resources ¶
type Resources struct {
// contains filtered or unexported fields
}
Resources holds all the resources for a connection. It allows the registration of resources that will be cleaned up when a connection terminates.
func NewResources ¶
func NewResources() *Resources
func (*Resources) Get ¶
Get returns the resource for the given id, or nil if there is no such resource.
func (*Resources) Register ¶
Register registers the given resource. It returns a unique identifier for the resource which can then be used in subsequent API requests to refer to the resource.
func (*Resources) RegisterNamed ¶
RegisterNamed registers the given resource. Callers must supply a unique name for the given resource. It is an error to try to register another resource with the same name as an already registered name. (This could be softened that you can overwrite an existing one and it will be Stopped and replaced, but we don't have a need for that yet.) It is also an error to supply a name that is an integer string, since that collides with the auto-naming from Register.
type StatusAndErr ¶
type StatusAndErr struct { Status status.StatusInfo Err error }
StatusAndErr pairs a StatusInfo with an error associated with retrieving it.
type StatusGetter ¶
type StatusGetter struct {
// contains filtered or unexported fields
}
StatusGetter implements a common Status method for use by various facades.
func NewStatusGetter ¶
func NewStatusGetter(st state.EntityFinder, getCanAccess GetAuthFunc) *StatusGetter
NewStatusGetter returns a new StatusGetter. The GetAuthFunc will be used on each invocation of Status to determine current permissions.
func (*StatusGetter) Status ¶
func (s *StatusGetter) Status(ctx context.Context, args params.Entities) (params.StatusResults, error)
Status returns the status of each given entity.
type StatusSetter ¶
type StatusSetter struct {
// contains filtered or unexported fields
}
StatusSetter implements a common SetStatus method for use by various facades.
func NewStatusSetter ¶
func NewStatusSetter(st state.EntityFinder, getCanModify GetAuthFunc) *StatusSetter
NewStatusSetter returns a new StatusSetter. The GetAuthFunc will be used on each invocation of SetStatus to determine current permissions.
func (*StatusSetter) SetStatus ¶
func (s *StatusSetter) SetStatus(ctx context.Context, args params.SetStatus) (params.ErrorResults, error)
SetStatus sets the status of each given entity.
type ToolsFindEntity ¶
type ToolsFinder ¶
type ToolsFinder interface {
FindAgents(context.Context, FindAgentsParams) (coretools.List, error)
}
ToolsFinder defines methods for finding tools.
type ToolsGetter ¶
type ToolsGetter struct {
// contains filtered or unexported fields
}
ToolsGetter implements a common Tools method for use by various facades.
func NewToolsGetter ¶
func NewToolsGetter( entityFinder ToolsFindEntity, modelAgentService ModelAgentService, toolsStorageGetter ToolsStorageGetter, urlGetter ToolsURLGetter, toolsFinder ToolsFinder, getCanRead GetAuthFunc, ) *ToolsGetter
NewToolsGetter returns a new ToolsGetter. The GetAuthFunc will be used on each invocation of Tools to determine current permissions.
func (*ToolsGetter) Tools ¶
func (t *ToolsGetter) Tools(ctx context.Context, args params.Entities) (params.ToolsResults, error)
Tools finds the tools necessary for the given agents.
type ToolsSetter ¶
type ToolsSetter struct {
// contains filtered or unexported fields
}
ToolsSetter implements a common Tools method for use by various facades.
func NewToolsSetter ¶
func NewToolsSetter(st ToolsFindEntity, getCanWrite GetAuthFunc) *ToolsSetter
NewToolsSetter returns a new ToolsGetter. The GetAuthFunc will be used on each invocation of Tools to determine current permissions.
func (*ToolsSetter) SetTools ¶
func (t *ToolsSetter) SetTools(ctx context.Context, args params.EntitiesVersion) (params.ErrorResults, error)
SetTools updates the recorded tools version for the agents.
type ToolsStorageGetter ¶
type ToolsStorageGetter interface { // ToolsStorage returns a binarystorage.StorageCloser. ToolsStorage(objectstore.ObjectStore) (binarystorage.StorageCloser, error) }
ToolsStorageGetter is an interface providing the ToolsStorage method.
type ToolsURLGetter ¶
type ToolsURLGetter interface { // ToolsURLs returns URLs for the tools with // the specified binary version. ToolsURLs(context.Context, controller.Config, version.Binary) ([]string, error) }
ToolsURLGetter is an interface providing the ToolsURL method.
type UnitAgentFinder ¶
type UnitAgentFinder struct {
state.EntityFinder
}
UnitAgentFinder is a state.EntityFinder that finds unit agents.
func (*UnitAgentFinder) FindEntity ¶
func (ua *UnitAgentFinder) FindEntity(tag names.Tag) (state.Entity, error)
FindEntity implements state.EntityFinder and returns unit agents.
type UnitStateAPI ¶
type UnitStateAPI struct { AccessMachine GetAuthFunc // contains filtered or unexported fields }
func NewExternalUnitStateAPI ¶
func NewExternalUnitStateAPI( controllerConfigService ControllerConfigService, unitStateService UnitStateService, st *state.State, resources facade.Resources, authorizer facade.Authorizer, accessUnit GetAuthFunc, logger corelogger.Logger, ) *UnitStateAPI
NewExternalUnitStateAPI can be used for API registration.
func NewUnitStateAPI ¶
func NewUnitStateAPI( controllerConfigService ControllerConfigService, unitStateService UnitStateService, backend UnitStateBackend, resources facade.Resources, authorizer facade.Authorizer, accessUnit GetAuthFunc, logger corelogger.Logger, ) *UnitStateAPI
NewUnitStateAPI returns a new UnitStateAPI. Currently both GetAuthFuncs can used to determine current permissions.
func (*UnitStateAPI) SetState ¶
func (u *UnitStateAPI) SetState(ctx context.Context, args params.SetUnitStateArgs) (params.ErrorResults, error)
SetState sets the state persisted by the charm running in this unit and the state internal to the uniter for this unit.
func (*UnitStateAPI) State ¶
func (u *UnitStateAPI) State(ctx context.Context, args params.Entities) (params.UnitStateResults, error)
State returns the state persisted by the charm running in this unit and the state internal to the uniter for this unit.
type UnitStateBackend ¶
type UnitStateBackend interface { ApplyOperation(state.ModelOperation) error Unit(string) (UnitStateUnit, error) }
UnitStateBackend describes unit-receiver state methods required for UnitStateAPI.
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 internal state of the unit. The return data will be // empty if no hook has been run for this unit. GetState(ctx context.Context, uuid string) (unitstate.RetrievedUnitState, error) }
UnitStateService describes the ability to retrieve and persist remote state for informing hook reconciliation.
type UnitStateState ¶
UnitStateState implements the UnitStateBackend indirection over state.State.
func (UnitStateState) ApplyOperation ¶
func (s UnitStateState) ApplyOperation(op state.ModelOperation) error
func (UnitStateState) Unit ¶
func (s UnitStateState) Unit(name string) (UnitStateUnit, error)
type UnitStateUnit ¶
type UnitStateUnit interface { SetStateOperation(*state.UnitState, state.UnitStateSizeLimits) state.ModelOperation State() (*state.UnitState, error) }
UnitStateUnit describes unit-receiver state methods required for UnitStateAPI.
type UnitStatusGetter ¶
type UnitStatusGetter interface { AgentStatus() (status.StatusInfo, error) Status() (status.StatusInfo, error) ShouldBeAssigned() bool Name() string Life() state.Life IsSidecar() (bool, error) }
UnitStatusGetter defines the unit functionality required to determine unit agent and workload status.
type UnitsWatcher ¶
type UnitsWatcher struct {
// contains filtered or unexported fields
}
UnitsWatcher implements a common WatchUnits method for use by various facades.
func NewUnitsWatcher ¶
func NewUnitsWatcher(st state.EntityFinder, resources facade.Resources, getCanWatch GetAuthFunc) *UnitsWatcher
NewUnitsWatcher returns a new UnitsWatcher. The GetAuthFunc will be used on each invocation of WatchUnits to determine current permissions.
func (*UnitsWatcher) WatchUnits ¶
func (u *UnitsWatcher) WatchUnits(ctx context.Context, args params.Entities) (params.StringsWatchResults, error)
WatchUnits starts a StringsWatcher to watch all units belonging to to any entity (machine or service) passed in args.
type UserAccessFunc ¶
type UserAccessFunc func(ctx context.Context, userName coreuser.Name, target permission.ID) (permission.Access, error)
UserAccessFunc represents a func that can answer the question about what level of access a user has for a given target.
type ValueResource ¶
type ValueResource struct { Value any // contains filtered or unexported fields }
FIXME(nvinuesa): This `ValueResource` should be removed and they should not be registered. ValueResource is a Resource with a no-op Stop method, containing any value. It does nothing but waits for heat death of the universe, whilst holding a value.
func NewValueResource ¶
func NewValueResource(value any) *ValueResource
func (*ValueResource) Kill ¶
func (v *ValueResource) Kill()
func (*ValueResource) Wait ¶
func (v *ValueResource) Wait() error
type WatchableMachineService ¶
type WatchableMachineService interface { // WatchMachineReboot returns a NotifyWatcher that is subscribed to // the changes in the machine_requires_reboot table in the model. // It raises an event whenever the machine uuid or its parent is added to the reboot table. WatchMachineReboot(ctx context.Context, uuid string) (watcher.NotifyWatcher, error) }
WatchableMachineService is an interface that defines the methods related to watching changes in the machine domain
It contains a subset of method from github.com/juju/juju/domain/machine/service.Service, dedicated to watch various machine events.
Source Files ¶
- action.go
- addresses.go
- block.go
- charms.go
- controllerconfig.go
- defaulticon.go
- ensuredead.go
- environ_config.go
- getstatus.go
- http.go
- instanceidgetter.go
- interfaces.go
- leadership.go
- life.go
- machine.go
- machinereboot.go
- machinestatus.go
- machinewatcher.go
- modeldestroy.go
- modelmachineswatcher.go
- modelmanagerinterface.go
- modelstatus.go
- modeluser.go
- modelwatcher.go
- password.go
- permissions.go
- presence.go
- relationunitswatcher.go
- resource.go
- setstatus.go
- status.go
- tools.go
- unitstate.go
- unitstatus.go
- unitswatcher.go
- watch.go
Directories ¶
Path | Synopsis |
---|---|
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
Package credentialcommon is a generated GoMock package.
|
Package credentialcommon is a generated GoMock package. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
Package storagecommon provides common storage-related services for API server facades.
|
Package storagecommon provides common storage-related services for API server facades. |