juju: github.com/wallyworld/juju/apiserver/common Index | Files | Directories

package common

import "github.com/wallyworld/juju/apiserver/common"

Index

Package Files

action.go addresses.go block.go charms.go cloud.go controllerconfig.go defaulticon.go ensuredead.go environ_config.go getstatus.go instanceidgetter.go instancetypes.go interfaces.go leadership.go life.go machine.go machinestatus.go modeldestroy.go modelmachineswatcher.go modelmanagerinterface.go modelstatus.go modeluser.go modelwatcher.go password.go permissions.go presence.go reboot.go relationunitswatcher.go remove.go resource.go setstatus.go tools.go unit.go unitstate.go unitstatus.go unitswatcher.go upgradeseries.go watch.go

Constants

const DefaultCharmIcon = "" /* 9062 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.

const EveryoneTagName = "everyone@external"

EveryoneTagName represents a special group that encompasses all external users.

func Actions Uses

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 AuthAndActionFromTagFn Uses

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 Uses

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 Uses

func CharmArchiveEntry(charmPath, entryPath string, wantIcon bool) ([]byte, error)

CharmArchiveEntry retrieves the specified entry from the zip archive.

func CloudFromParams Uses

func CloudFromParams(cloudName string, p params.Cloud) jujucloud.Cloud

func CloudToParams Uses

func CloudToParams(cloud jujucloud.Cloud) params.Cloud

func ConvertActions Uses

func ConvertActions(ar state.ActionReceiver, fn GetActionsFn, compat bool) ([]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 Uses

func DestroyController(
    st ModelManagerBackend,
    destroyHostedModels bool,
    destroyStorage *bool,
) 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 Uses

func DestroyMachines(st origStateInterface, force bool, maxWait time.Duration, ids ...string) error

func DestroyModel Uses

func DestroyModel(
    st ModelManagerBackend,
    destroyStorage *bool,
    force *bool,
    maxWait *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 EntityStatusFromState Uses

func EntityStatusFromState(statusInfo status.StatusInfo) params.EntityStatus

EntityStatusFromState converts a state.StatusInfo into a params.EntityStatus.

func FinishActions Uses

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 GetPermission Uses

func GetPermission(accessGetter userAccessFunc, userTag names.UserTag, target names.Tag) (permission.Access, error)

GetPermission returns the permission a user has on the specified target.

func HasModelAdmin Uses

func HasModelAdmin(
    authorizer facade.Authorizer,
    user names.UserTag,
    controllerTag names.ControllerTag,
    model Model,
) (bool, error)

HasModelAdmin reports whether or not a user has admin access to the specified 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 Uses

func HasPermission(
    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 InstanceTypes Uses

func InstanceTypes(cons instanceTypeConstraints) (params.InstanceTypesResult, error)

InstanceTypes returns a list of the available instance types in the provider according to the passed constraints.

func MakeActionResult Uses

func MakeActionResult(actionReceiverTag names.Tag, action state.Action, compat bool) params.ActionResult

MakeActionResult does the actual type conversion from state.Action to params.ActionResult.

func MaxWait Uses

func MaxWait(in *time.Duration) time.Duration

MaxWait is how far in the future the backstop force cleanup will be scheduled. Default is 1min if no value is provided.

func ModelFilesystemInfo Uses

func ModelFilesystemInfo(in []state.Filesystem) []params.ModelFilesystemInfo

ModelFilesystemInfo returns information about filesystems in the model.

func ModelMachineInfo Uses

func ModelMachineInfo(st ModelManagerBackend) (machineInfo []params.ModelMachineInfo, _ error)

ModelMachineInfo returns information about machine hardware for alive top level machines (not containers).

func ModelUserInfo Uses

func ModelUserInfo(user permission.UserAccess, st modelConnectionAbleBackend) (params.ModelUserInfo, error)

ModelUserInfo converts permission.UserAccess to params.ModelUserInfo.

func ModelVolumeInfo Uses

func ModelVolumeInfo(in []state.Volume) []params.ModelVolumeInfo

ModelVolumeInfo returns information about volumes in the model.

func NewInstanceTypeConstraints Uses

func NewInstanceTypeConstraints(env environs.Environ, ctx context.ProviderCallContext, constraints constraints.Value) instanceTypeConstraints

NewInstanceTypeConstraints returns an instanceTypeConstraints with the passed parameters.

func NewToolsURLGetter Uses

func NewToolsURLGetter(modelUUID string, a APIHostPortsForAgentsGetter) *toolsURLGetter

NewToolsURLGetter creates a new ToolsURLGetter that returns tools URLs pointing at an API server.

func ParamsActionExecutionResultsToStateActionResults Uses

func ParamsActionExecutionResultsToStateActionResults(arg params.ActionExecutionResult) (state.ActionResults, error)

ParamsActionExecutionResultsToStateActionResults does exactly what the name implies.

func ReadCharmFromStorage Uses

func ReadCharmFromStorage(store storage.Storage, 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 RevokeLeadershipFunc Uses

func RevokeLeadershipFunc(leadershipRevoker leadership.Revoker) func(names.Tag)

RevokeLeadershipFunc returns a function that revokes leadership for dead units.

func StateControllerInfo Uses

func StateControllerInfo(st *state.State) (addrs []string, caCert string, _ error)

StateControllerInfo returns the local controller details for the given State.

func StateJobs Uses

func StateJobs(jobs []model.MachineJob) ([]state.MachineJob, error)

StateJobs translates a slice of multiwatcher jobs to their equivalents in state.

func StateToParamsUserAccessPermission Uses

func StateToParamsUserAccessPermission(descriptionAccess permission.Access) (params.UserAccessPermission, error)

StateToParamsUserAccessPermission converts permission.Access to params.AccessPermission.

func TagToActionReceiverFn Uses

func TagToActionReceiverFn(findEntity func(names.Tag) (state.Entity, error)) func(tag string) (state.ActionReceiver, error)

TagToActionReceiver 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 ToolsURL Uses

func ToolsURL(serverRoot string, v version.Binary) string

ToolsURL returns a tools URL pointing the API server specified by the "serverRoot".

func WatchActionNotifications Uses

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 Uses

func WatchOneActionReceiverNotifications(tagToActionReceiver func(tag string) (state.ActionReceiver, error), registerFunc func(r facade.Resource) 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 Uses

func WatchPendingActionsForReceiver(tagToActionReceiver func(tag string) (state.ActionReceiver, error), registerFunc func(r facade.Resource) 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

type APIAddresser Uses

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 Uses

func NewAPIAddresser(getter AddressAndCertGetter, resources facade.Resources) *APIAddresser

NewAPIAddresser returns a new APIAddresser that uses the given getter to fetch its addresses.

func (*APIAddresser) APIAddresses Uses

func (a *APIAddresser) APIAddresses() (params.StringsResult, error)

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

func (*APIAddresser) APIHostPorts Uses

func (a *APIAddresser) APIHostPorts() (params.APIHostPortsResult, error)

APIHostPorts returns the API server addresses.

func (*APIAddresser) ModelUUID Uses

func (a *APIAddresser) ModelUUID() params.StringResult

ModelUUID returns the model UUID to connect to the model that the current connection is for.

func (*APIAddresser) WatchAPIHostPorts Uses

func (a *APIAddresser) WatchAPIHostPorts() (params.NotifyWatchResult, error)

WatchAPIHostPorts watches the API server addresses.

type APIHostPortsForAgentsGetter Uses

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() ([]network.SpaceHostPorts, error)
}

APIHostPortsGetter is an interface providing the APIHostPortsForAgents method.

type AddressAndCertGetter Uses

type AddressAndCertGetter interface {
    Addresses() ([]string, error)
    ModelUUID() string
    APIHostPortsForAgents() ([]network.SpaceHostPorts, error)
    WatchAPIHostPortsForAgents() state.NotifyWatcher
}

AddressAndCertGetter can be used to find out controller addresses and the CA public certificate.

type AgentEntityWatcher Uses

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

AgentEntityWatcher implements a common Watch method for use by various facades.

func NewAgentEntityWatcher Uses

func NewAgentEntityWatcher(st state.EntityFinder, resources facade.Resources, 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 Uses

func (a *AgentEntityWatcher) Watch(args params.Entities) (params.NotifyWatchResults, error)

Watch starts an NotifyWatcher for each given entity.

type Application Uses

type Application interface {
    UnitCount() int
}

Application defines methods provided by a state.Application instance.

type ApplicationStatusSetter Uses

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 Uses

func NewApplicationStatusSetter(st *state.State, getCanModify GetAuthFunc, leadershipChecker leadership.Checker) *ApplicationStatusSetter

NewApplicationStatusSetter returns a ServiceStatusSetter.

func (*ApplicationStatusSetter) SetStatus Uses

func (s *ApplicationStatusSetter) SetStatus(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 Uses

type AuthFunc func(tag names.Tag) bool

AuthFunc returns whether the given entity is available to some operation.

type Authorizer Uses

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 Uses

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

BlockChecker checks for current blocks if any.

func NewBlockChecker Uses

func NewBlockChecker(s BlockGetter) *BlockChecker

func (*BlockChecker) ChangeAllowed Uses

func (c *BlockChecker) ChangeAllowed() 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 Uses

func (c *BlockChecker) DestroyAllowed() error

DestroyAllowed checks if destroy block is in place. Destroy block prevents destruction of current model.

func (*BlockChecker) RemoveAllowed Uses

func (c *BlockChecker) RemoveAllowed() error

RemoveAllowed checks if remove block is in place. Remove block prevents removal of machine, service, unit and relation from current model.

type BlockGetter Uses

type BlockGetter interface {
    GetBlockForType(t state.BlockType) (state.Block, bool, error)
}

type ControllerConfigAPI Uses

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

ControllerConfigAPI implements two common methods for use by various facades - eg Provisioner and ControllerConfig.

func NewControllerConfig Uses

func NewControllerConfig(st state.ControllerAccessor) *ControllerConfigAPI

NewControllerConfig returns a new NewControllerConfigAPI.

func NewStateControllerConfig Uses

func NewStateControllerConfig(st *state.State) *ControllerConfigAPI

NewStateControllerConfig returns a new NewControllerConfigAPI.

func (*ControllerConfigAPI) ControllerAPIInfoForModels Uses

func (s *ControllerConfigAPI) ControllerAPIInfoForModels(args params.Entities) (params.ControllerAPIInfoResults, error)

ControllerAPIInfoForModels returns the controller api connection details for the specified models.

func (*ControllerConfigAPI) ControllerConfig Uses

func (s *ControllerConfigAPI) ControllerConfig() (params.ControllerConfigResult, error)

ControllerConfig returns the controller's configuration.

type ControllerNode Uses

type ControllerNode interface {
    Id() string
    HasVote() bool
    WantsVote() bool
}

type DeadEnsurer Uses

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

DeadEnsurer implements a common EnsureDead method for use by various facades.

func NewDeadEnsurer Uses

func NewDeadEnsurer(st state.EntityFinder, afterDead func(names.Tag), getCanModify GetAuthFunc) *DeadEnsurer

NewDeadEnsurer returns a new DeadEnsurer. The GetAuthFunc will be used on each invocation of EnsureDead to determine current permissions.

func (*DeadEnsurer) EnsureDead Uses

func (d *DeadEnsurer) EnsureDead(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 EnvironConfigGetterFuncs Uses

type EnvironConfigGetterFuncs struct {
    ModelConfigFunc func() (*config.Config, error)
    CloudSpecFunc   func() (environscloudspec.CloudSpec, error)
}

EnvironConfigGetterFuncs holds implements environs.EnvironConfigGetter in a pluggable way.

func (EnvironConfigGetterFuncs) CloudSpec Uses

func (f EnvironConfigGetterFuncs) CloudSpec() (environscloudspec.CloudSpec, error)

CloudSpec implements environs.EnvironConfigGetter.

func (EnvironConfigGetterFuncs) ModelConfig Uses

func (f EnvironConfigGetterFuncs) ModelConfig() (*config.Config, error)

ModelConfig implements EnvironConfigGetter.

type GetActionsFn Uses

type GetActionsFn func() ([]state.Action, error)

GetActionsFn declares the function type that returns a slice of state.Action and error, used to curry specific list functions.

type GetAuthFunc Uses

type GetAuthFunc func() (AuthFunc, error)

GetAuthFunc returns an AuthFunc.

func AuthAlways Uses

func AuthAlways() GetAuthFunc

AuthAlways returns an authentication function that always returns true iff it is passed a valid tag.

func AuthAny Uses

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 Uses

func AuthFuncForMachineAgent(authorizer Authorizer) GetAuthFunc

AuthFuncForMachineAgent returns a GetAuthFunc which creates an AuthFunc allowing only machine agents and their controllers

func AuthFuncForTag Uses

func AuthFuncForTag(valid names.Tag) GetAuthFunc

AuthFuncForTag returns an authentication function that always returns true iff it is passed a specific tag.

func AuthFuncForTagKind Uses

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 InstanceIdGetter Uses

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

InstanceIdGetter implements a common InstanceId method for use by various facades.

func NewInstanceIdGetter Uses

func NewInstanceIdGetter(st state.EntityFinder, 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 Uses

func (ig *InstanceIdGetter) InstanceId(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 Uses

type LeadershipMachine interface {
    ApplicationNames() ([]string, error)
}

LeadershipMachine is an indirection for state.machine.

type LeadershipPinning Uses

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

LeadershipPinning defines a type for pinning and unpinning application leaders.

func NewLeadershipPinning Uses

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 Uses

func NewLeadershipPinningFromContext(ctx facade.Context) (*LeadershipPinning, error)

NewLeadershipPinningFromContext creates and returns a new leadership from a facade context. This signature is suitable for facade registration.

func (*LeadershipPinning) GetMachineApplicationNames Uses

func (a *LeadershipPinning) GetMachineApplicationNames(id string) ([]string, error)

GetMachineApplicationNames returns the applications associated with a machine.

func (*LeadershipPinning) PinApplicationLeaders Uses

func (a *LeadershipPinning) PinApplicationLeaders() (params.PinApplicationsResults, error)

PinApplicationLeaders pins leadership for applications based on the auth tag provided.

func (*LeadershipPinning) PinApplicationLeadersByName Uses

func (a *LeadershipPinning) PinApplicationLeadersByName(tag names.Tag, appNames []string) (params.PinApplicationsResults, error)

PinApplicationLeadersByName takes a slice of application names and attempts to pin them accordingly.

func (*LeadershipPinning) PinnedLeadership Uses

func (a *LeadershipPinning) PinnedLeadership() (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 Uses

func (a *LeadershipPinning) UnpinApplicationLeaders() (params.PinApplicationsResults, error)

UnpinApplicationLeaders unpins leadership for applications based on the auth tag provided.

func (*LeadershipPinning) UnpinApplicationLeadersByName Uses

func (a *LeadershipPinning) UnpinApplicationLeadersByName(tag names.Tag, appNames []string) (params.PinApplicationsResults, error)

UnpinApplicationLeadersByName takes a slice of application names and attempts to unpin them accordingly.

type LeadershipPinningBackend Uses

type LeadershipPinningBackend interface {
    Machine(string) (LeadershipMachine, error)
}

LeadershipPinningBacked describes state method wrappers used by this API.

type LifeGetter Uses

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

LifeGetter implements a common Life method for use by various facades.

func NewLifeGetter Uses

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 Uses

func (lg *LifeGetter) Life(args params.Entities) (params.LifeResults, error)

Life returns the life status of every supplied entity, where available.

type Machine Uses

type Machine interface {
    Id() string
    InstanceId() (instance.Id, error)
    InstanceNames() (instance.Id, string, error)
    Status() (status.StatusInfo, error)
    ContainerType() instance.ContainerType
    HardwareCharacteristics() (*instance.HardwareCharacteristics, error)
    Life() state.Life
    ForceDestroy(time.Duration) error
    Destroy() error
    IsManager() bool
}

type MachineStatusGetter Uses

type MachineStatusGetter interface {
    Status() (status.StatusInfo, error)
    Id() string
    Life() state.Life
}

MachineStatusGetter defines the machine functionality required to status.

type Model Uses

type Model interface {
    Type() state.ModelType
    Config() (*config.Config, error)
    Life() state.Life
    ModelTag() names.ModelTag
    Owner() names.UserTag
    Status() (status.StatusInfo, error)
    CloudName() string
    Cloud() (cloud.Cloud, error)
    CloudCredentialTag() (names.CloudCredentialTag, bool)
    CloudCredential() (state.Credential, bool, error)
    CloudRegion() string
    Users() ([]permission.UserAccess, error)
    Destroy(state.DestroyModelParams) error
    SLALevel() string
    SLAOwner() string
    MigrationMode() state.MigrationMode
    Name() string
    UUID() string
    ControllerUUID() string
    LastModelConnection(user names.UserTag) (time.Time, error)
    AddUser(state.UserAccessSpec) (permission.UserAccess, error)
    AutoConfigureContainerNetworking(environ environs.BootstrapEnviron) error
    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 ModelMachinesWatcher Uses

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

ModelMachinesWatcher implements a common WatchModelMachines method for use by various facades.

func NewModelMachinesWatcher Uses

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 Uses

func (e *ModelMachinesWatcher) WatchModelMachineStartTimes() (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 Uses

func (e *ModelMachinesWatcher) WatchModelMachines() (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 Uses

type ModelManagerBackend interface {
    APIHostPortsForAgentsGetter
    ToolsStorageGetter
    BlockGetter
    state.CloudAccessor

    ModelUUID() string
    ModelUUIDsForUser(names.UserTag) ([]string, error)
    ModelBasicInfoForUser(user names.UserTag) ([]state.ModelAccessInfo, error)
    ModelSummariesForUser(user names.UserTag, all bool) ([]state.ModelSummary, error)
    IsControllerAdmin(user names.UserTag) (bool, error)
    NewModel(state.ModelArgs) (Model, ModelManagerBackend, error)
    Model() (Model, error)
    AllModelUUIDs() ([]string, error)
    GetModel(string) (Model, func() bool, error)
    GetBackend(string) (ModelManagerBackend, func() bool, error)

    ComposeNewModelConfig(modelAttr map[string]interface{}, regionSpec *environscloudspec.CloudRegionSpec) (map[string]interface{}, error)
    ControllerModelUUID() string
    ControllerModelTag() names.ModelTag
    IsController() bool
    ControllerConfig() (controller.Config, error)
    ControllerNodes() ([]ControllerNode, error)
    ModelConfigDefaultValues(cloudName string) (config.ModelDefaultAttributes, error)
    UpdateModelConfigDefaultValues(update map[string]interface{}, remove []string, regionSpec *environscloudspec.CloudRegionSpec) error
    Unit(name string) (*state.Unit, error)
    Name() string
    ModelTag() names.ModelTag
    ModelConfig() (*config.Config, error)
    AddControllerUser(state.UserAccessSpec) (permission.UserAccess, error)
    RemoveUserAccess(names.UserTag, names.Tag) error
    UserAccess(names.UserTag, names.Tag) (permission.UserAccess, error)
    GetCloudAccess(cloud string, user names.UserTag) (permission.Access, error)
    AllMachines() (machines []Machine, err error)
    AllApplications() (applications []Application, err error)
    AllFilesystems() ([]state.Filesystem, error)
    AllVolumes() ([]state.Volume, error)
    ControllerUUID() string
    ControllerTag() names.ControllerTag
    Export() (description.Model, error)
    ExportPartial(state.ExportConfig) (description.Model, error)
    SetUserAccess(subject names.UserTag, target names.Tag, access permission.Access) (permission.UserAccess, error)
    SetModelMeterStatus(string, string) error
    AllSpaces() ([]*state.Space, error)
    AddSpace(string, network.Id, []string, bool) (*state.Space, error)
    AllEndpointBindingsSpaceNames() (set.Strings, error)
    ConstraintsBySpaceName(string) ([]*state.Constraints, error)
    DefaultEndpointBindingSpace() (string, error)
    SaveProviderSubnets([]network.SubnetInfo, string) error
    LatestMigration() (state.ModelMigration, error)
    DumpAll() (map[string]interface{}, error)
    Close() error
    HAPrimaryMachine() (names.MachineTag, error)

    // Methods required by the metricsender package.
    MetricsManager() (*state.MetricsManager, error)
    MetricsToSend(batchSize int) ([]*state.MetricBatch, error)
    SetMetricBatchesSent(batchUUIDs []string) error
    CountOfUnsentMetrics() (int, error)
    CountOfSentMetrics() (int, error)
    CleanupOldMetrics() 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 Uses

func NewModelManagerBackend(m *state.Model, pool *state.StatePool) ModelManagerBackend

NewModelManagerBackend returns a modelManagerStateShim wrapping the passed state, which implements ModelManagerBackend.

func NewUserAwareModelManagerBackend Uses

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 Uses

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 Uses

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 Uses

func (c *ModelPresenceContext) MachineStatus(machine MachineStatusGetter) (status.StatusInfo, error)

MachineStatus returns the machine agent status for a given machine, with special handling for agent presence.

func (*ModelPresenceContext) UnitStatus Uses

func (c *ModelPresenceContext) UnitStatus(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 Uses

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

ModelStatusAPI implements the ModelStatus() API.

func NewModelStatusAPI Uses

func NewModelStatusAPI(backend ModelManagerBackend, authorizer facade.Authorizer, apiUser names.UserTag) *ModelStatusAPI

NewModelStatusAPI creates an implementation providing the ModelStatus() API.

func (*ModelStatusAPI) ModelStatus Uses

func (c *ModelStatusAPI) ModelStatus(req params.Entities) (params.ModelStatusResults, error)

ModelStatus returns a summary of the model.

type ModelWatcher Uses

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

ModelWatcher implements two common methods for use by various facades - WatchForModelConfigChanges and ModelConfig.

func NewModelWatcher Uses

func NewModelWatcher(st state.ModelAccessor, resources facade.Resources, authorizer facade.Authorizer) *ModelWatcher

NewModelWatcher returns a new ModelWatcher. Active watchers will be stored in the provided Resources. The two GetAuthFunc callbacks will be used on each invocation of the methods to determine current permissions. Right now, model tags are not used, so both created AuthFuncs are called with "" for tag, which means "the current model".

func (*ModelWatcher) ModelConfig Uses

func (m *ModelWatcher) ModelConfig() (params.ModelConfigResult, error)

ModelConfig returns the current model's configuration.

func (*ModelWatcher) WatchForModelConfigChanges Uses

func (m *ModelWatcher) WatchForModelConfigChanges() (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 MultiNotifyWatcher Uses

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

MultiNotifyWatcher implements state.NotifyWatcher, combining multiple NotifyWatchers.

func NewMultiNotifyWatcher Uses

func NewMultiNotifyWatcher(w ...state.NotifyWatcher) *MultiNotifyWatcher

NewMultiNotifyWatcher creates a NotifyWatcher that combines each of the NotifyWatchers passed in. Each watcher's initial event is consumed, and a single initial event is sent. Subsequent events are not coalesced.

func (*MultiNotifyWatcher) Changes Uses

func (w *MultiNotifyWatcher) Changes() <-chan struct{}

func (*MultiNotifyWatcher) Err Uses

func (w *MultiNotifyWatcher) Err() error

func (*MultiNotifyWatcher) Kill Uses

func (w *MultiNotifyWatcher) Kill()

func (*MultiNotifyWatcher) Stop Uses

func (w *MultiNotifyWatcher) Stop() error

func (*MultiNotifyWatcher) Wait Uses

func (w *MultiNotifyWatcher) Wait() error

type NewEnvironFunc Uses

type NewEnvironFunc func() (environs.BootstrapEnviron, error)

NewEnvironFunc is a function that returns a BootstrapEnviron instance.

func EnvironFuncForModel Uses

func EnvironFuncForModel(model stateenvirons.Model, configGetter environs.EnvironConfigGetter) NewEnvironFunc

EnvironFuncForModel is a helper function that returns a NewEnvironFunc suitable for the specified model.

type PasswordChanger Uses

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

PasswordChanger implements a common SetPasswords method for use by various facades.

func NewPasswordChanger Uses

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 Uses

func (pc *PasswordChanger) SetPasswords(args params.EntityPasswords) (params.ErrorResults, error)

SetPasswords sets the given password for each supplied entity, if possible.

type RebootActionGetter Uses

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

RebootActionGetter implements the GetRebootAction API method

func NewRebootActionGetter Uses

func NewRebootActionGetter(st state.EntityFinder, auth GetAuthFunc) *RebootActionGetter

func (*RebootActionGetter) GetRebootAction Uses

func (r *RebootActionGetter) GetRebootAction(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 Uses

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

RebootFlagClearer implements the ClearReboot API call

func NewRebootFlagClearer Uses

func NewRebootFlagClearer(st state.EntityFinder, auth GetAuthFunc) *RebootFlagClearer

func (*RebootFlagClearer) ClearReboot Uses

func (r *RebootFlagClearer) ClearReboot(args params.Entities) (params.ErrorResults, error)

ClearReboot will clear the reboot flag on provided machines, if it exists.

type RebootRequester Uses

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

RebootRequester implements the RequestReboot API method

func NewRebootRequester Uses

func NewRebootRequester(st state.EntityFinder, auth GetAuthFunc) *RebootRequester

func (*RebootRequester) RequestReboot Uses

func (r *RebootRequester) RequestReboot(args params.Entities) (params.ErrorResults, error)

RequestReboot sets the reboot flag on the provided machines

type RelationUnitsWatcher Uses

type RelationUnitsWatcher interface {
    watcher.CoreWatcher
    Changes() <-chan params.RelationUnitsChange

    // Stop is needed to implement facade.Resource.
    Stop() error

    // Err implements watcher.Errer.
    Err() error
}

RelationUnitsWatcher represents a state.RelationUnitsWatcher at the apiserver level (different type for changes).

func RelationUnitsWatcherFromState Uses

func RelationUnitsWatcherFromState(source state.RelationUnitsWatcher) (RelationUnitsWatcher, error)

NewRelationUnitsWatcherFromState wraps a state-level RelationUnitsWatcher in an equivalent apiserver-level one, taking responsibility for the source watcher's lifetime.

type Remover Uses

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

Remover implements a common Remove method for use by various facades.

func NewRemover Uses

func NewRemover(st state.EntityFinder, afterDead func(tag names.Tag), callEnsureDead bool, getCanModify GetAuthFunc) *Remover

NewRemover returns a new Remover. The callEnsureDead flag specifies whether EnsureDead should be called on an entity before removing. The GetAuthFunc will be used on each invocation of Remove to determine current permissions.

func (*Remover) Remove Uses

func (r *Remover) Remove(args params.Entities) (params.ErrorResults, error)

Remove removes every given entity from state, calling EnsureDead first, then Remove. It will fail if the entity is not present.

type Resources Uses

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 Uses

func NewResources() *Resources

func (*Resources) Count Uses

func (rs *Resources) Count() int

Count returns the number of resources currently held.

func (*Resources) Get Uses

func (rs *Resources) Get(id string) facade.Resource

Get returns the resource for the given id, or nil if there is no such resource.

func (*Resources) Register Uses

func (rs *Resources) Register(r facade.Resource) string

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 Uses

func (rs *Resources) RegisterNamed(name string, r facade.Resource) error

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.

func (*Resources) Stop Uses

func (rs *Resources) Stop(id string) error

Stop stops the resource with the given id and unregisters it. It returns any error from the underlying Stop call. It does not return an error if the resource has already been unregistered.

func (*Resources) StopAll Uses

func (rs *Resources) StopAll()

StopAll stops all the resources.

type StateAddresser Uses

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

StateAddresser implements a common set of methods for getting state server addresses, and the CA certificate used to authenticate them.

func NewStateAddresser Uses

func NewStateAddresser(getter AddressAndCertGetter) *StateAddresser

NewStateAddresser returns a new StateAddresser that uses the given st value to fetch its addresses.

func (*StateAddresser) StateAddresses Uses

func (a *StateAddresser) StateAddresses() (params.StringsResult, error)

StateAddresses returns the list of addresses used to connect to the state.

type StatusAndErr Uses

type StatusAndErr struct {
    Status status.StatusInfo
    Err    error
}

StatusAndErr pairs a StatusInfo with an error associated with retrieving it.

type StatusGetter Uses

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

StatusGetter implements a common Status method for use by various facades.

func NewStatusGetter Uses

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 Uses

func (s *StatusGetter) Status(args params.Entities) (params.StatusResults, error)

Status returns the status of each given entity.

type StatusSetter Uses

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

StatusSetter implements a common SetStatus method for use by various facades.

func NewStatusSetter Uses

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 Uses

func (s *StatusSetter) SetStatus(args params.SetStatus) (params.ErrorResults, error)

SetStatus sets the status of each given entity.

func (*StatusSetter) UpdateStatus Uses

func (s *StatusSetter) UpdateStatus(args params.SetStatus) (params.ErrorResults, error)

UpdateStatus updates the status data of each given entity. TODO(fwereade): WTF. This method exists *only* for the convenience of the *client* API -- and is itself completely broken -- but we still expose it in every facade with a StatusSetter? FFS.

type StringResource Uses

type StringResource string

StringResource is just a regular 'string' that matches the Resource interface.

func (StringResource) Stop Uses

func (StringResource) Stop() error

func (StringResource) String Uses

func (s StringResource) String() string

type ToolsFinder Uses

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

func NewToolsFinder Uses

func NewToolsFinder(
    c environs.EnvironConfigGetter, s ToolsStorageGetter, t ToolsURLGetter,
    newEnviron NewEnvironFunc,
) *ToolsFinder

NewToolsFinder returns a new ToolsFinder, returning tools with their URLs pointing at the API server.

func (*ToolsFinder) FindTools Uses

func (f *ToolsFinder) FindTools(args params.FindToolsParams) (params.FindToolsResult, error)

FindTools returns a List containing all tools matching the given parameters.

type ToolsGetter Uses

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

ToolsGetter implements a common Tools method for use by various facades.

func NewToolsGetter Uses

func NewToolsGetter(
    f state.EntityFinder,
    c environs.EnvironConfigGetter,
    s ToolsStorageGetter,
    t ToolsURLGetter,
    getCanRead GetAuthFunc,
    newEnviron NewEnvironFunc,
) *ToolsGetter

NewToolsGetter returns a new ToolsGetter. The GetAuthFunc will be used on each invocation of Tools to determine current permissions.

func (*ToolsGetter) Tools Uses

func (t *ToolsGetter) Tools(args params.Entities) (params.ToolsResults, error)

Tools finds the tools necessary for the given agents.

type ToolsSetter Uses

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

ToolsSetter implements a common Tools method for use by various facades.

func NewToolsSetter Uses

func NewToolsSetter(st state.EntityFinder, 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 Uses

func (t *ToolsSetter) SetTools(args params.EntitiesVersion) (params.ErrorResults, error)

SetTools updates the recorded tools version for the agents.

type ToolsStorageGetter Uses

type ToolsStorageGetter interface {
    // ToolsStorage returns a binarystorage.StorageCloser.
    ToolsStorage() (binarystorage.StorageCloser, error)
}

ToolsStorageGetter is an interface providing the ToolsStorage method.

type ToolsURLGetter Uses

type ToolsURLGetter interface {
    // ToolsURLs returns URLs for the tools with
    // the specified binary version.
    ToolsURLs(v version.Binary) ([]string, error)
}

ToolsURLGetter is an interface providing the ToolsURL method.

type UnitAgentFinder Uses

type UnitAgentFinder struct {
    state.EntityFinder
}

UnitAgentFinder is a state.EntityFinder that finds unit agents.

func (*UnitAgentFinder) FindEntity Uses

func (ua *UnitAgentFinder) FindEntity(tag names.Tag) (state.Entity, error)

FindEntity implements state.EntityFinder and returns unit agents.

type UnitStateAPI Uses

type UnitStateAPI struct {
    AccessMachine GetAuthFunc
    // contains filtered or unexported fields
}

func NewExternalUnitStateAPI Uses

func NewExternalUnitStateAPI(
    st *state.State,
    resources facade.Resources,
    authorizer facade.Authorizer,
    accessUnit GetAuthFunc,
    logger loggo.Logger,
) *UnitStateAPI

NewExternalUnitStateAPI can be used for API registration.

func NewUnitStateAPI Uses

func NewUnitStateAPI(
    backend UnitStateBackend,
    resources facade.Resources,
    authorizer facade.Authorizer,
    accessUnit GetAuthFunc,
    logger loggo.Logger,
) *UnitStateAPI

NewUnitStateAPI returns a new UnitStateAPI. Currently both GetAuthFuncs can used to determine current permissions.

func (*UnitStateAPI) SetState Uses

func (u *UnitStateAPI) SetState(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 Uses

func (u *UnitStateAPI) State(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 Uses

type UnitStateBackend interface {
    ApplyOperation(state.ModelOperation) error
    Unit(string) (UnitStateUnit, error)
    ControllerConfig() (controller.Config, error)
}

UnitStateUnit describes unit-receiver state methods required for UnitStateAPI.

type UnitStateState Uses

type UnitStateState struct {
    St *state.State
}

UnitStateState implements the UnitStateBackend indirection over state.State.

func (UnitStateState) ApplyOperation Uses

func (s UnitStateState) ApplyOperation(op state.ModelOperation) error

func (UnitStateState) ControllerConfig Uses

func (s UnitStateState) ControllerConfig() (controller.Config, error)

func (UnitStateState) Unit Uses

func (s UnitStateState) Unit(name string) (UnitStateUnit, error)

type UnitStateUnit Uses

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 Uses

type UnitStatusGetter interface {
    AgentStatus() (status.StatusInfo, error)
    Status() (status.StatusInfo, error)
    ShouldBeAssigned() bool
    Name() string
    Life() state.Life
}

UnitStatusGetter defines the unit functionality required to determine unit agent and workload status.

type UnitsWatcher Uses

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

UnitsWatcher implements a common WatchUnits method for use by various facades.

func NewUnitsWatcher Uses

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 Uses

func (u *UnitsWatcher) WatchUnits(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 UpgradeSeriesAPI Uses

type UpgradeSeriesAPI struct {
    AccessMachine GetAuthFunc
    // contains filtered or unexported fields
}

func NewExternalUpgradeSeriesAPI Uses

func NewExternalUpgradeSeriesAPI(
    st *state.State,
    resources facade.Resources,
    authorizer facade.Authorizer,
    accessMachine GetAuthFunc,
    accessUnit GetAuthFunc,
    logger loggo.Logger,
) *UpgradeSeriesAPI

NewExternalUpgradeSeriesAPI can be used for API registration.

func NewUpgradeSeriesAPI Uses

func NewUpgradeSeriesAPI(
    backend UpgradeSeriesBackend,
    resources facade.Resources,
    authorizer facade.Authorizer,
    accessMachine GetAuthFunc,
    accessUnit GetAuthFunc,
    logger loggo.Logger,
) *UpgradeSeriesAPI

NewUpgradeSeriesAPI returns a new UpgradeSeriesAPI. Currently both GetAuthFuncs can used to determine current permissions.

func (*UpgradeSeriesAPI) GetMachine Uses

func (u *UpgradeSeriesAPI) GetMachine(tag names.Tag) (UpgradeSeriesMachine, error)

func (*UpgradeSeriesAPI) SetUpgradeSeriesUnitStatus Uses

func (u *UpgradeSeriesAPI) SetUpgradeSeriesUnitStatus(
    args params.UpgradeSeriesStatusParams,
) (params.ErrorResults, error)

SetUpgradeSeriesUnitStatus sets the upgrade series status of the unit. If no upgrade is in progress an error is returned instead.

func (*UpgradeSeriesAPI) UpgradeSeriesUnitStatus Uses

func (u *UpgradeSeriesAPI) UpgradeSeriesUnitStatus(args params.Entities) (params.UpgradeSeriesStatusResults, error)

UpgradeSeriesUnitStatus returns the current preparation status of an upgrading unit. If no series upgrade is in progress an error is returned instead.

func (*UpgradeSeriesAPI) WatchUpgradeSeriesNotifications Uses

func (u *UpgradeSeriesAPI) WatchUpgradeSeriesNotifications(args params.Entities) (params.NotifyWatchResults, error)

WatchUpgradeSeriesNotifications returns a NotifyWatcher for observing changes to upgrade series locks.

type UpgradeSeriesBackend Uses

type UpgradeSeriesBackend interface {
    Machine(string) (UpgradeSeriesMachine, error)
    Unit(string) (UpgradeSeriesUnit, error)
}

type UpgradeSeriesMachine Uses

type UpgradeSeriesMachine interface {
    WatchUpgradeSeriesNotifications() (state.NotifyWatcher, error)
    Units() ([]UpgradeSeriesUnit, error)
    UpgradeSeriesStatus() (model.UpgradeSeriesStatus, error)
    SetUpgradeSeriesStatus(model.UpgradeSeriesStatus, string) error
    StartUpgradeSeriesUnitCompletion(string) error
    UpgradeSeriesUnitStatuses() (map[string]state.UpgradeSeriesUnitStatus, error)
    RemoveUpgradeSeriesLock() error
    UpgradeSeriesTarget() (string, error)
    Series() string
    UpdateMachineSeries(series string, force bool) error
    SetInstanceStatus(status.StatusInfo) error
}

UpgradeSeriesMachine describes machine-receiver state methods for executing a series upgrade.

type UpgradeSeriesState Uses

type UpgradeSeriesState struct {
    St *state.State
}

UpgradeSeriesState implements the UpgradeSeriesBackend indirection over state.State.

func (UpgradeSeriesState) Machine Uses

func (s UpgradeSeriesState) Machine(id string) (UpgradeSeriesMachine, error)

func (UpgradeSeriesState) Unit Uses

func (s UpgradeSeriesState) Unit(id string) (UpgradeSeriesUnit, error)

type UpgradeSeriesUnit Uses

type UpgradeSeriesUnit interface {
    Tag() names.Tag
    AssignedMachineId() (string, error)
    UpgradeSeriesStatus() (model.UpgradeSeriesStatus, error)
    SetUpgradeSeriesStatus(model.UpgradeSeriesStatus, string) error
}

UpgradeSeriesUnit describes unit-receiver state methods for executing a series upgrade.

type ValueResource Uses

type ValueResource struct {
    Value interface{}
}

ValueResource is a Resource with a no-op Stop method, containing an interface{} value.

func (ValueResource) Stop Uses

func (r ValueResource) Stop() error

Directories

PathSynopsis
apihttp
cloudspec
credentialcommon
crossmodel
firewall
imagecommon
mocksPackage mocks is a generated GoMock package.
networkingcommon
networkingcommon/mocksPackage mocks is a generated GoMock package.
storagecommonPackage storagecommon provides common storage-related services for API server facades.
testing

Package common imports 54 packages (graph). Updated 2020-08-06. Refresh now. Tools for package owners.