Copyright 2019 Canonical Ltd. Licensed under the AGPLv3, see LICENCE file for details.

    Package state enables reading, observing, and changing the state stored in MongoDB of a whole model managed by juju.



    View Source
    const (
    	ModelTypeIAAS = ModelType("iaas")
    	ModelTypeCAAS = ModelType("caas")
    View Source
    const (
    	// MigrationModeNone is the default mode for a model and reflects
    	// that it isn't involved with a model migration.
    	MigrationModeNone = MigrationMode("")
    	// MigrationModeExporting reflects a model that is in the process of being
    	// exported from one controller to another.
    	MigrationModeExporting = MigrationMode("exporting")
    	// MigrationModeImporting reflects a model that is being imported into a
    	// controller, but is not yet fully active.
    	MigrationModeImporting = MigrationMode("importing")
    View Source
    const (
    	SLAUnsupported = slaLevel("unsupported")
    	SLAEssential   = slaLevel("essential")
    	SLAStandard    = slaLevel("standard")
    	SLAAdvanced    = slaLevel("advanced")
    View Source
    const (
    	CleanupAge = time.Hour * 24
    View Source
    const (
    	// ControllerSettingsGlobalKey is the key for the controller and its settings.
    	ControllerSettingsGlobalKey = "controllerSettings"
    View Source
    const InitialLeaderClaimTime = time.Minute


    View Source
    var (
    	IsCharmAlreadyUploadedError    = stateerrors.IsCharmAlreadyUploadedError
    	IsProviderIDNotUniqueError     = stateerrors.IsProviderIDNotUniqueError
    	IsParentDeviceHasChildrenError = stateerrors.IsParentDeviceHasChildrenError
    	IsIncompatibleSeriesError      = stateerrors.IsIncompatibleSeriesError
    	IsNotAlive                     = stateerrors.IsNotAlive
    	IsHasAssignedUnitsError        = stateerrors.IsHasAssignedUnitsError
    	IsHasContainersError           = stateerrors.IsHasContainersError
    	IsHasAttachmentsError          = stateerrors.IsHasAttachmentsError
    	IsHasHostedModelsError         = stateerrors.IsHasHostedModelsError
    	IsHasPersistentStorageError    = stateerrors.IsHasPersistentStorageError
    	IsModelNotEmptyError           = stateerrors.IsModelNotEmptyError
    	IsStorageAttachedError         = stateerrors.IsStorageAttachedError
    	IsDeletedUserError             = stateerrors.IsDeletedUserError
    	IsNeverLoggedInError           = stateerrors.IsNeverLoggedInError
    	IsNeverConnectedError          = stateerrors.IsNeverConnectedError
    	IsVersionInconsistentError     = stateerrors.IsVersionInconsistentError
    View Source
    var ErrChangeComplete = errors.New("change complete")

      ErrChangeComplete can be returned from Prepare to finish an Apply attempt and report success without taking any further action.

      View Source
      var ErrModelNotDying = errors.New("model is not dying")
      View Source
      var ErrNeverForwarded = errors.Errorf("cannot find ID of the last forwarded record")

        ErrNeverForwarded signals to the caller that the ID of a previously forwarded log record could not be found.

        View Source
        var ErrNoBackingVolume = errors.New("filesystem has no backing volume")

          ErrNoBackingVolume is returned by Filesystem.Volume() for filesystems without a backing volume.

          View Source
          var ErrNoDefaultStoragePool = fmt.Errorf("no storage pool specified and no default available")

            ErrNoDefaultStoragePool is returned when a storage pool is required but none is specified nor available as a default.

            View Source
            var ErrStateClosed = fmt.Errorf("state has been closed")

              ErrStateClosed is returned from watchers if their underlying state connection has been closed.

              View Source
              var ErrSubordinateConstraints = stderrors.New("constraints do not apply to subordinate applications")
              View Source
              var MinVersionSupportNewActionID = version.MustParse("2.6.999")

                MinVersionSupportNewActionID should be un-exposed after 2.7 released. TODO(action): un-expose MinVersionSupportNewActionID and IsNewActionIDSupported and remove those helper functions using these two vars in tests from 2.7.0.

                  NewBroker returns a CAAS broker. Override for testing.

                  View Source
                  var (
                  	// NewUUID wraps the utils.NewUUID() call, and exposes it as a var to
                  	// facilitate patching.
                  	NewUUID = func() (utils.UUID, error) { return utils.NewUUID() }


                  func AddActionPruneSettings

                  func AddActionPruneSettings(pool *StatePool) error

                    AddActionPruneSettings adds the model settings to control log pruning if they are missing.

                    func AddBakeryConfig

                    func AddBakeryConfig(pool *StatePool) error

                      AddBakeryConfig adds a bakery config doc to controllers collection if it does not already exist.

                      func AddCharmHubToModelConfig

                      func AddCharmHubToModelConfig(pool *StatePool) error

                        AddCharmHubToModelConfig inserts the charm-hub-url into the model-config if it's missing one.

                        func AddCharmOriginToApplications

                        func AddCharmOriginToApplications(pool *StatePool) error

                          AddCharmOriginToApplications adds a CharmOrigin to all applications. It will attempt to deduce the source from the charmurl.

                          func AddCloudModelCounts

                          func AddCloudModelCounts(pool *StatePool) error

                            AddCloudModelCounts updates cloud docs to ensure the model count field is set.

                            func AddControllerLogCollectionsSizeSettings

                            func AddControllerLogCollectionsSizeSettings(pool *StatePool) error

                              AddControllerLogCollectionsSizeSettings adds the controller settings to control log pruning and txn log size if they are missing.

                              func AddControllerNodeDocs

                              func AddControllerNodeDocs(pool *StatePool) error

                                AddControllerNodeDocs creates controller nodes for each machine that wants to be a member of the mongo replicaset.

                                func AddLocalCharmSequences

                                func AddLocalCharmSequences(pool *StatePool) error

                                  AddLocalCharmSequences creates any missing sequences in the database for tracking already used local charm revisions.

                                  func AddMachineIDToSubordinates

                                  func AddMachineIDToSubordinates(pool *StatePool) error

                                    AddMachineIDToSubordinates ensures that the subordinate units have the machine ID set that matches the principal.

                                    func AddMigrationAttempt

                                    func AddMigrationAttempt(pool *StatePool) error

                                      AddMigrationAttempt adds an "attempt" field to migration documents which are missing one.

                                      func AddModelEnvironVersion

                                      func AddModelEnvironVersion(pool *StatePool) error

                                        AddModelEnvironVersion ensures that all model docs have an environ-version field. For those that do not have one, they are seeded with version zero. This will force all environ upgrade steps to be run; there are only two providers (azure and vsphere) that had upgrade steps at the time, and the upgrade steps are required to be idempotent anyway.

                                        func AddModelLogsSize

                                        func AddModelLogsSize(pool *StatePool) error

                                          AddModelLogsSize to controller config.

                                          func AddModelType

                                          func AddModelType(pool *StatePool) error

                                            AddModelType adds a "type" field to model documents which don't have one. The "iaas" type is used.

                                            func AddNonDetachableStorageMachineId

                                            func AddNonDetachableStorageMachineId(pool *StatePool) error

                                              AddNonDetachableStorageMachineId sets the "machineid" field on volume and filesystem docs that are inherently bound to that machine.

                                              func AddOriginToIPAddresses

                                              func AddOriginToIPAddresses(pool *StatePool) error

                                                AddOriginToIPAddresses ensures that all ip address have an origin associated with them.

                                                func AddRelationStatus

                                                func AddRelationStatus(pool *StatePool) error

                                                  AddRelationStatus sets the initial status for existing relations without a status.

                                                  func AddSpaceIdToSpaceDocs

                                                  func AddSpaceIdToSpaceDocs(pool *StatePool) (err error)

                                                    AddSpaceIdToSpaceDocs ensures that every space document includes a a sequentially generated ID. It also adds a doc for the default space (ID=0).

                                                    func AddStatusHistoryPruneSettings

                                                    func AddStatusHistoryPruneSettings(pool *StatePool) error

                                                      AddStatusHistoryPruneSettings adds the model settings to control log pruning if they are missing.

                                                      func AddStorageInstanceConstraints

                                                      func AddStorageInstanceConstraints(pool *StatePool) error

                                                        AddStorageInstanceConstraints sets the "constraints" field on storage instance docs.

                                                        func AddSubnetIdToSubnetDocs

                                                        func AddSubnetIdToSubnetDocs(pool *StatePool) (err error)

                                                          AddSubnetIdToSubnetDocs ensures that every subnet document includes a a sequentially generated ID.

                                                          func AddUpdateStatusHookSettings

                                                          func AddUpdateStatusHookSettings(pool *StatePool) error

                                                            AddUpdateStatusHookSettings adds the model settings to control how often to run the update-status hook if they are missing.

                                                            func ApplicationInstances

                                                            func ApplicationInstances(st *State, application string) ([]instance.Id, error)

                                                              ApplicationInstances returns the instance IDs of provisioned machines that are assigned units of the specified application.

                                                              func ApplicationMachines

                                                              func ApplicationMachines(st *State, application string) ([]string, error)

                                                                ApplicationMachines returns the machine IDs of machines which have the specified application listed as a principal.

                                                                func Apply

                                                                func Apply(db Database, change Change) error

                                                                  Apply runs the supplied Change against the supplied Database. If it returns no error, the change succeeded.

                                                                  func ChangeSubnetAZtoSlice

                                                                  func ChangeSubnetAZtoSlice(pool *StatePool) (err error)

                                                                    ChangeSubnetAZtoSlice changes AvailabilityZone in every subnet document to AvailabilityZones, a slice of strings.

                                                                    func ChangeSubnetSpaceNameToSpaceID

                                                                    func ChangeSubnetSpaceNameToSpaceID(pool *StatePool) (err error)

                                                                      ChangeSubnetSpaceNameToSpaceID replaces the SpaceName with the SpaceID in a subnet.

                                                                      func CheckApplicationExpectsWorkload

                                                                      func CheckApplicationExpectsWorkload(m *Model, appName string) (bool, error)

                                                                        CheckApplicationExpectsWorkload checks if the application expects workload or not.

                                                                        func ControllerAccess

                                                                        func ControllerAccess(st *State, tag names.Tag) (permission.UserAccess, error)

                                                                        func ConvertAddressSpaceIDs

                                                                        func ConvertAddressSpaceIDs(pool *StatePool) error

                                                                          ConvertAddressSpaceIDs interrogates stored addresses. Where such addresses include a space name or provider ID, The space is retrieved and these fields are removed in favour of space's ID.

                                                                          func CorrectRelationUnitCounts

                                                                          func CorrectRelationUnitCounts(pool *StatePool) error

                                                                            CorrectRelationUnitCounts ensures that there aren't any rows in relationscopes for applications that shouldn't be there. Fix for

                                                                            func CreateMissingApplicationConfig

                                                                            func CreateMissingApplicationConfig(pool *StatePool) error

                                                                              CreateMissingApplicationConfig ensures that all models have an application config in the db.

                                                                              func DefaultEndpointBindingsForCharm

                                                                              func DefaultEndpointBindingsForCharm(st EndpointBinding, charmMeta *charm.Meta) (map[string]string, error)

                                                                                DefaultEndpointBindingsForCharm populates a bindings map containing each endpoint of the given charm metadata (relation name or extra-binding name) bound to an empty space.

                                                                                func DeleteCloudImageMetadata

                                                                                func DeleteCloudImageMetadata(pool *StatePool) error

                                                                                  DeleteCloudImageMetadata deletes any non-custom cloud image metadata records from the cloudimagemetadata collection.

                                                                                  func DropLeasesCollection

                                                                                  func DropLeasesCollection(pool *StatePool) error

                                                                                    DropLeasesCollection removes the leases collection. Tolerates the collection already not existing.

                                                                                    func DropPresenceDatabase

                                                                                    func DropPresenceDatabase(pool *StatePool) error

                                                                                      DropPresenceDatabase removes the legacy presence database.

                                                                                      func EnsureApplicationDeviceConstraints

                                                                                      func EnsureApplicationDeviceConstraints(pool *StatePool) error

                                                                                        EnsureApplicationDeviceConstraints ensures that there is a device constraints document for every application.

                                                                                        func EnsureDefaultModificationStatus

                                                                                        func EnsureDefaultModificationStatus(pool *StatePool) error

                                                                                          EnsureDefaultModificationStatus ensures that there is a modification status document for every machine in the statuses.

                                                                                          func EnsureDefaultSpaceSetting

                                                                                          func EnsureDefaultSpaceSetting(pool *StatePool) error

                                                                                            EnsureDefaultSpaceSetting sets the model config value for "default-space" to "" if it is unset or is set to the now-deprecated value "_default".

                                                                                            func EnsureRelationApplicationSettings

                                                                                            func EnsureRelationApplicationSettings(pool *StatePool) error

                                                                                              EnsureRelationApplicationSettings creates an application settings doc for each endpoint in each relation if one doesn't already exist.

                                                                                              func ExposeWildcardEndpointForExposedApplications

                                                                                              func ExposeWildcardEndpointForExposedApplications(pool *StatePool) error

                                                                                                ExposeWildcardEndpointForExposedApplications adds an ExposedEndpoint entry for the wildcard endpoint (to for already exposed applications. This ensures that all exposed applications are accessible at least one CIDR and allows us to drop the fallback to if no CIDRs present logic from the firewaller worker.

                                                                                                func FilesystemMountPoint

                                                                                                func FilesystemMountPoint(
                                                                                                	meta charm.Storage,
                                                                                                	tag names.StorageTag,
                                                                                                	series string,
                                                                                                ) (string, error)

                                                                                                  FilesystemMountPoint returns a mount point to use for the given charm storage. For stores with potentially multiple instances, the instance name is appended to the location.

                                                                                                  func HostedModelCountOp

                                                                                                  func HostedModelCountOp(amount int) txn.Op

                                                                                                  func IncrementTasksSequence

                                                                                                  func IncrementTasksSequence(pool *StatePool) error

                                                                                                    IncrementTasksSequence adds 1 to the "tasks" sequence. Previously, numbering started at 0, now it starts at 1 so we need to ensure that upgraded controllers do not get a conflicting task id.

                                                                                                    func InitDatabase

                                                                                                    func InitDatabase(session *mgo.Session, modelUUID string, settings *controller.Config) error

                                                                                                      InitDatabase creates all the collections and indices in a Juju database.

                                                                                                      func InitDbLogs

                                                                                                      func InitDbLogs(session *mgo.Session) error

                                                                                                        InitDbLogs sets up the capped collections for the logging, along with the indexes for the logs collection. It should be called as state is opened. It is idempotent.

                                                                                                        func InitDbLogsForModel

                                                                                                        func InitDbLogsForModel(session *mgo.Session, modelUUID string, size int) error

                                                                                                          InitDbLogsForModel sets up the indexes for the logs collection for the specified model. It should be called as state is opened. It is idempotent. This function also ensures that the logs collection is capped at the right size.

                                                                                                          func IsContainsFilesystem

                                                                                                          func IsContainsFilesystem(err error) bool

                                                                                                          func IsMigrationActive

                                                                                                          func IsMigrationActive(st *State, modelUUID string) (bool, error)

                                                                                                            IsMigrationActive returns true if a migration is in progress for the model with the given UUID. The State provided need not be for the model in question.

                                                                                                            func IsNewActionIDSupported

                                                                                                            func IsNewActionIDSupported(ver version.Number) bool

                                                                                                              IsNewActionIDSupported checks if new action ID is supported for the specified version.

                                                                                                              func LegacyLeases

                                                                                                              func LegacyLeases(pool *StatePool, localTime time.Time) (map[corelease.Key]corelease.Info, error)

                                                                                                                LegacyLeases returns information about all of the leases in the state-based lease store.

                                                                                                                func MigrateAddModelPermissions

                                                                                                                func MigrateAddModelPermissions(pool *StatePool) error

                                                                                                                  MigrateAddModelPermissions converts add-model permissions on the controller to add-model permissions on the controller cloud.

                                                                                                                  func MigrateLeasesToGlobalTime

                                                                                                                  func MigrateLeasesToGlobalTime(pool *StatePool) error

                                                                                                                    MigrateLeasesToGlobalTime removes old (<2.3-beta2) lease/clock-skew documents, replacing the lease documents with new ones for the existing lease holders.

                                                                                                                    func MigrateStorageMachineIdFields

                                                                                                                    func MigrateStorageMachineIdFields(pool *StatePool) error

                                                                                                                      MigrateStorageMachineIdFields updates the various storage collections to copy any machineid field value across to hostid.

                                                                                                                      func MoveMongoSpaceToHASpaceConfig

                                                                                                                      func MoveMongoSpaceToHASpaceConfig(pool *StatePool) error

                                                                                                                        CopyMongoSpaceToHASpaceConfig copies the Mongo space name from ControllerInfo to the HA space name in ControllerConfig. This only happens if the Mongo space state is valid, it is not empty, and if there is no value already set for the HA space name. The old keys are then deleted from ControllerInfo.

                                                                                                                        func MoveOldAuditLog

                                                                                                                        func MoveOldAuditLog(pool *StatePool) error

                                                                                                                          MoveOldAuditLog renames the no-longer-needed audit.log collection to old-audit.log if it has any rows - if it's empty it deletes it.

                                                                                                                          func NewApplicationOffers

                                                                                                                          func NewApplicationOffers(st *State) crossmodel.ApplicationOffers

                                                                                                                            NewApplicationOffers creates a application directory backed by a state instance.

                                                                                                                            func NewControllerUserAccess

                                                                                                                            func NewControllerUserAccess(st *State, userDoc userAccessDoc) (permission.UserAccess, error)

                                                                                                                              NewControllerUserAccess returns a new permission.UserAccess for the given userDoc and current Controller.

                                                                                                                              func NewDeviceBackend

                                                                                                                              func NewDeviceBackend(st *State) (*deviceBackend, error)

                                                                                                                                NewDeviceBackend creates a backend for managing device.

                                                                                                                                func NewExternalControllers

                                                                                                                                func NewExternalControllers(st *State) *externalControllers

                                                                                                                                  NewExternalControllers creates an external controllers instance backed by a state.

                                                                                                                                  func NewFirewallRules

                                                                                                                                  func NewFirewallRules(st *State) *firewallRulesState

                                                                                                                                    NewFirewallRules creates a FirewallRule instance backed by a state.

                                                                                                                                    func NewModelUserAccess

                                                                                                                                    func NewModelUserAccess(st *State, userDoc userAccessDoc) (permission.UserAccess, error)

                                                                                                                                      NewModelUserAccess returns a new permission.UserAccess for the given userDoc and current Model.

                                                                                                                                      func NewRelationEgressNetworks

                                                                                                                                      func NewRelationEgressNetworks(st *State) *relationNetworksState

                                                                                                                                        NewRelationEgressNetworks creates a RelationNetworks instance for egress CIDRS backed by a state.

                                                                                                                                        func NewRelationIngressNetworks

                                                                                                                                        func NewRelationIngressNetworks(st *State) *relationNetworksState

                                                                                                                                          NewRelationIngressNetworks creates a RelationNetworks instance for ingress CIDRS backed by a state.

                                                                                                                                          func NewRelationNetworks

                                                                                                                                          func NewRelationNetworks(st *State) *rootRelationNetworksState

                                                                                                                                            NewRelationNetworks creates a root RelationNetworks without a direction, so accessing RelationNetworks is possible agnostically.

                                                                                                                                            func NewStorageBackend

                                                                                                                                            func NewStorageBackend(st *State) (*storageBackend, error)

                                                                                                                                              NewStorageBackend creates a backend for managing storage.

                                                                                                                                              func ParseFilesystemAttachmentId

                                                                                                                                              func ParseFilesystemAttachmentId(id string) (names.Tag, names.FilesystemTag, error)

                                                                                                                                                ParseFilesystemAttachmentId parses a string as a filesystem attachment ID, returning the host and filesystem components.

                                                                                                                                                func ParseVolumeAttachmentId

                                                                                                                                                func ParseVolumeAttachmentId(id string) (names.Tag, names.VolumeTag, error)

                                                                                                                                                  ParseVolumeAttachmentId parses a string as a volume attachment ID, returning the host and volume components.

                                                                                                                                                  func PruneOperations

                                                                                                                                                  func PruneOperations(st *State, maxHistoryTime time.Duration, maxHistoryMB int) error

                                                                                                                                                    PruneOperations removes operation entries and their sub-tasks until only logs newer than <maxLogTime> remain and also ensures that the actions collection is smaller than <maxLogsMB> after the deletion.

                                                                                                                                                    func PruneStatusHistory

                                                                                                                                                    func PruneStatusHistory(st *State, maxHistoryTime time.Duration, maxHistoryMB int) error

                                                                                                                                                    func RemoveContainerImageStreamFromNonModelSettings

                                                                                                                                                    func RemoveContainerImageStreamFromNonModelSettings(pool *StatePool) error

                                                                                                                                                      RemoveContainerImageStreamFromNonModelSettings In 2.3.6 we accidentally had an upgrade step that added "container-image-stream": "released" to all settings documents, not just the ones relating to Model data. This removes it from all the ones that aren't model docs if it is exactly what we would have added in 2.3.6

                                                                                                                                                      func RemoveControllerConfigMaxLogAgeAndSize

                                                                                                                                                      func RemoveControllerConfigMaxLogAgeAndSize(pool *StatePool) error

                                                                                                                                                        RemoveControllerConfigMaxLogAgeAndSize deletes the controller configuration settings for max-logs-age and max-logs-size if they exist.

                                                                                                                                                        func RemoveInstanceCharmProfileDataCollection

                                                                                                                                                        func RemoveInstanceCharmProfileDataCollection(pool *StatePool) error

                                                                                                                                                          RemoveInstanceCharmProfileDataCollection removes the instanceCharmProfileData collection on upgrade.

                                                                                                                                                          func RemoveLinkLayerDevicesRefsCollection

                                                                                                                                                          func RemoveLinkLayerDevicesRefsCollection(pool *StatePool) error

                                                                                                                                                          func RemoveModelBlock

                                                                                                                                                          func RemoveModelBlock(st *State, t BlockType) error

                                                                                                                                                          func RemoveModelBlockOps

                                                                                                                                                          func RemoveModelBlockOps(st *State, t BlockType) ([]txn.Op, error)

                                                                                                                                                          func RemoveNilValueApplicationSettings

                                                                                                                                                          func RemoveNilValueApplicationSettings(pool *StatePool) error

                                                                                                                                                            RemoveNilValueApplicationSettings removes any application setting key-value pairs from "settings" where value is nil.

                                                                                                                                                            func RemoveUnsupportedLinkLayer

                                                                                                                                                            func RemoveUnsupportedLinkLayer(pool *StatePool) error

                                                                                                                                                              RemoveUnsupportedLinkLayer removes link-layer devices and addresses where the EC2 provider added them with the name "unsupported".

                                                                                                                                                              func RemoveUnusedLinkLayerDeviceProviderIDs

                                                                                                                                                              func RemoveUnusedLinkLayerDeviceProviderIDs(pool *StatePool) error

                                                                                                                                                              func RemoveVotingMachineIds

                                                                                                                                                              func RemoveVotingMachineIds(pool *StatePool) error

                                                                                                                                                                RemoveVotingMachineIds ensures that the 'votingmachineids' field on controller info has been removed

                                                                                                                                                                func RenameAddModelPermission

                                                                                                                                                                func RenameAddModelPermission(pool *StatePool) error

                                                                                                                                                                  RenameAddModelPermission renames any permissions called addmodel to add-model.

                                                                                                                                                                  func ReplaceNeverSetWithUnset

                                                                                                                                                                  func ReplaceNeverSetWithUnset(pool *StatePool) (err error)

                                                                                                                                                                    ReplaceNeverSetWithUnset in the status documents.

                                                                                                                                                                    func ReplacePortsDocSubnetIDCIDR

                                                                                                                                                                    func ReplacePortsDocSubnetIDCIDR(pool *StatePool) (err error)

                                                                                                                                                                      ReplacePortsDocSubnetIDCIDR ensures that every ports document use an ID rather than a CIDR for subnetID.

                                                                                                                                                                      func ReplaceSpaceNameWithIDEndpointBindings

                                                                                                                                                                      func ReplaceSpaceNameWithIDEndpointBindings(pool *StatePool) error

                                                                                                                                                                        ReplaceSpaceNameWithIDEndpointBindings replaces space names with space ids for endpoint bindings.

                                                                                                                                                                        func ReplicaSetMembers

                                                                                                                                                                        func ReplicaSetMembers(pool *StatePool) ([]replicaset.Member, error)

                                                                                                                                                                          ReplicaSetMembers gets the members of the current Mongo replica set. These are needed to bootstrap the raft cluster in an upgrade and using MongoSession directly from an upgrade steps would make testing difficult.

                                                                                                                                                                          func ResetDefaultRelationLimitInCharmMetadata

                                                                                                                                                                          func ResetDefaultRelationLimitInCharmMetadata(pool *StatePool) (err error)

                                                                                                                                                                            ResetDefaultRelationLimitInCharmMetadata patches the persisted charm metadata so that the limit attribute for each relation requirer/peer endpoint is set to 0. The "provides" endpoints are left as-is.

                                                                                                                                                                            The charm metadata parser used in juju 2.7 (and before) would inject a limit of 1 for each endpoint in the charm metadata (for requirer/peer relations) when no limit was specified. The limit was ignored prior to juju 2.8 so this upgrade step allows us to reset the limit to prevent errors when attempting to add new relations.

                                                                                                                                                                            Fixes LP1887095.

                                                                                                                                                                            func RollUpAndConvertOpenedPortDocuments

                                                                                                                                                                            func RollUpAndConvertOpenedPortDocuments(pool *StatePool) error

                                                                                                                                                                              RollUpAndConvertOpenedPortDocuments replaces pre-2.9 per-machine, per-subnet opened port documents with a single document that references port ranges by endpoint names.

                                                                                                                                                                              This upgrade step exploits the fact that pre-2.9 controllers open ports in all subnets. As a result, the opened ports collection will always contain a single document with an empty subnet ID to indicate that the port ranges apply to all subnets.

                                                                                                                                                                              func SetEnableDiskUUIDOnVsphere

                                                                                                                                                                              func SetEnableDiskUUIDOnVsphere(pool *StatePool) error

                                                                                                                                                                                SetEnableDiskUUIDOnVsphere updates the settings for all vsphere models to have enable-disk-uuid=false. The new default is true, but this maintains the previous behaviour for upgraded models.

                                                                                                                                                                                func SplitLogCollections

                                                                                                                                                                                func SplitLogCollections(pool *StatePool) error

                                                                                                                                                                                  SplitLogCollections moves log entries from the old single log collection to the log collection per model.

                                                                                                                                                                                  func StripLocalUserDomain

                                                                                                                                                                                  func StripLocalUserDomain(pool *StatePool) error

                                                                                                                                                                                    StripLocalUserDomain removes any @local suffix from any relevant document field values.

                                                                                                                                                                                    func TagFromDocID

                                                                                                                                                                                    func TagFromDocID(docID string) names.Tag

                                                                                                                                                                                      TagFromDocID tries attempts to extract an entity-identifying tag from a Mongo document ID. For example "c9741ea1-0c2a-444d-82f5-787583a48557:a#mediawiki" would yield an application tag for "mediawiki"

                                                                                                                                                                                      func UpdateInheritedControllerConfig

                                                                                                                                                                                      func UpdateInheritedControllerConfig(pool *StatePool) error

                                                                                                                                                                                        UpdateInheritedControllerConfig migrates the existing global settings doc keyed on "controller" to be keyed on the cloud name.

                                                                                                                                                                                        func UpdateK8sModelNameIndex

                                                                                                                                                                                        func UpdateK8sModelNameIndex(pool *StatePool) error

                                                                                                                                                                                          UpdateK8sModelNameIndex migrates k8s model indices to be based on the model owner rather than the cloud name.

                                                                                                                                                                                          func UpdateKubernetesStorageConfig

                                                                                                                                                                                          func UpdateKubernetesStorageConfig(pool *StatePool) error

                                                                                                                                                                                            UpdateKubernetesStorageConfig sets default storage classes for operator and workload storage.

                                                                                                                                                                                            func UpdateLegacyLXDCloudCredentials

                                                                                                                                                                                            func UpdateLegacyLXDCloudCredentials(
                                                                                                                                                                                            	st *State,
                                                                                                                                                                                            	endpoint string,
                                                                                                                                                                                            	credential cloud.Credential,
                                                                                                                                                                                            ) error

                                                                                                                                                                                              UpdateLegacyLXDCloudCredentials updates the cloud credentials for the LXD-based controller, and updates the cloud endpoint with the given value.

                                                                                                                                                                                              func UpgradeContainerImageStreamDefault

                                                                                                                                                                                              func UpgradeContainerImageStreamDefault(pool *StatePool) error

                                                                                                                                                                                                UpgradeDefaultContainerImageStreamConfig ensures that the config value for container-image-stream is set to its default value, "released".

                                                                                                                                                                                                func UpgradeNoProxyDefaults

                                                                                                                                                                                                func UpgradeNoProxyDefaults(pool *StatePool) error

                                                                                                                                                                                                  UpgradeNoProxyDefaults changes the default values of no_proxy to hold localhost values as defaults.


                                                                                                                                                                                                  type Action

                                                                                                                                                                                                  type Action interface {
                                                                                                                                                                                                  	// Id returns the local id of the Action.
                                                                                                                                                                                                  	Id() string
                                                                                                                                                                                                  	// Receiver returns the Name of the ActionReceiver for which this action
                                                                                                                                                                                                  	// is enqueued.  Usually this is a Unit Name().
                                                                                                                                                                                                  	Receiver() string
                                                                                                                                                                                                  	// Name returns the name of the action, as defined in the charm.
                                                                                                                                                                                                  	Name() string
                                                                                                                                                                                                  	// Parameters will contain a structure representing arguments or parameters to
                                                                                                                                                                                                  	// an action, and is expected to be validated by the Unit using the Charm
                                                                                                                                                                                                  	// definition of the Action.
                                                                                                                                                                                                  	Parameters() map[string]interface{}
                                                                                                                                                                                                  	// Enqueued returns the time the action was added to state as a pending
                                                                                                                                                                                                  	// Action.
                                                                                                                                                                                                  	Enqueued() time.Time
                                                                                                                                                                                                  	// Started returns the time that the Action execution began.
                                                                                                                                                                                                  	Started() time.Time
                                                                                                                                                                                                  	// Completed returns the completion time of the Action.
                                                                                                                                                                                                  	Completed() time.Time
                                                                                                                                                                                                  	// Status returns the final state of the action.
                                                                                                                                                                                                  	Status() ActionStatus
                                                                                                                                                                                                  	// Results returns the structured output of the action and any error.
                                                                                                                                                                                                  	Results() (map[string]interface{}, string)
                                                                                                                                                                                                  	// ActionTag returns an ActionTag constructed from this action's
                                                                                                                                                                                                  	// Prefix and Sequence.
                                                                                                                                                                                                  	ActionTag() names.ActionTag
                                                                                                                                                                                                  	// Begin marks an action as running, and logs the time it was started.
                                                                                                                                                                                                  	// It asserts that the action is currently pending.
                                                                                                                                                                                                  	Begin() (Action, error)
                                                                                                                                                                                                  	// Finish removes action from the pending queue and captures the output
                                                                                                                                                                                                  	// and end state of the action.
                                                                                                                                                                                                  	Finish(results ActionResults) (Action, error)
                                                                                                                                                                                                  	// Log adds message to the action's progress message array.
                                                                                                                                                                                                  	Log(message string) error
                                                                                                                                                                                                  	// Messages returns the action's progress messages.
                                                                                                                                                                                                  	Messages() []ActionMessage
                                                                                                                                                                                                  	// Cancel or Abort the action.
                                                                                                                                                                                                  	Cancel() (Action, error)
                                                                                                                                                                                                  	// Refresh the contents of the action.
                                                                                                                                                                                                  	Refresh() error

                                                                                                                                                                                                    Action represents an instance of an action designated for a unit or machine in the model.

                                                                                                                                                                                                    type ActionMessage

                                                                                                                                                                                                    type ActionMessage struct {
                                                                                                                                                                                                    	MessageValue   string    `bson:"message"`
                                                                                                                                                                                                    	TimestampValue time.Time `bson:"timestamp"`

                                                                                                                                                                                                      ActionMessage represents a progress message logged by an action.

                                                                                                                                                                                                      func (ActionMessage) Message

                                                                                                                                                                                                      func (m ActionMessage) Message() string

                                                                                                                                                                                                        Message returns the message string.

                                                                                                                                                                                                        func (ActionMessage) Timestamp

                                                                                                                                                                                                        func (m ActionMessage) Timestamp() time.Time

                                                                                                                                                                                                          Timestamp returns the message timestamp.

                                                                                                                                                                                                          type ActionReceiver

                                                                                                                                                                                                          type ActionReceiver interface {
                                                                                                                                                                                                          	// AddAction queues an action belonging to the specified operation,
                                                                                                                                                                                                          	// with the given name and payload for this ActionReceiver.
                                                                                                                                                                                                          	AddAction(operationID, name string, payload map[string]interface{}) (Action, error)
                                                                                                                                                                                                          	// CancelAction removes a pending Action from the queue for this
                                                                                                                                                                                                          	// ActionReceiver and marks it as cancelled.
                                                                                                                                                                                                          	CancelAction(action Action) (Action, error)
                                                                                                                                                                                                          	// WatchActionNotifications returns a StringsWatcher that will notify
                                                                                                                                                                                                          	// on changes to the queued actions for this ActionReceiver.
                                                                                                                                                                                                          	WatchActionNotifications() StringsWatcher
                                                                                                                                                                                                          	// WatchPendingActionNotifications returns a StringsWatcher that will notify
                                                                                                                                                                                                          	// on pending queued actions for this ActionReceiver.
                                                                                                                                                                                                          	WatchPendingActionNotifications() StringsWatcher
                                                                                                                                                                                                          	// Actions returns the list of Actions queued and completed for this
                                                                                                                                                                                                          	// ActionReceiver.
                                                                                                                                                                                                          	Actions() ([]Action, error)
                                                                                                                                                                                                          	// CompletedActions returns the list of Actions completed for this
                                                                                                                                                                                                          	// ActionReceiver.
                                                                                                                                                                                                          	CompletedActions() ([]Action, error)
                                                                                                                                                                                                          	// PendingActions returns the list of Actions queued for this
                                                                                                                                                                                                          	// ActionReceiver.
                                                                                                                                                                                                          	PendingActions() ([]Action, error)
                                                                                                                                                                                                          	// RunningActions returns the list of Actions currently running for
                                                                                                                                                                                                          	// this ActionReceiver.
                                                                                                                                                                                                          	RunningActions() ([]Action, error)

                                                                                                                                                                                                            ActionReceiver describes Entities that can have Actions queued for them, and that can get ActionRelated information about those actions. TODO(jcw4) consider implementing separate Actor classes for this interface; for example UnitActor that implements this interface, and takes a Unit and performs all these actions.

                                                                                                                                                                                                            type ActionResults

                                                                                                                                                                                                            type ActionResults struct {
                                                                                                                                                                                                            	Status  ActionStatus           `json:"status"`
                                                                                                                                                                                                            	Results map[string]interface{} `json:"results"`
                                                                                                                                                                                                            	Message string                 `json:"message"`

                                                                                                                                                                                                              ActionResults is a data transfer object that holds the key Action output and results information.

                                                                                                                                                                                                              type ActionSpecsByName

                                                                                                                                                                                                              type ActionSpecsByName map[string]charm.ActionSpec

                                                                                                                                                                                                                ActionSpecsByName is a map of action names to their respective ActionSpec.

                                                                                                                                                                                                                type ActionStatus

                                                                                                                                                                                                                type ActionStatus string

                                                                                                                                                                                                                  ActionStatus represents the possible end states for an action.

                                                                                                                                                                                                                  const (
                                                                                                                                                                                                                  	// ActionFailed signifies that the action did not complete successfully.
                                                                                                                                                                                                                  	ActionFailed ActionStatus = "failed"
                                                                                                                                                                                                                  	// ActionCompleted indicates that the action ran to completion as intended.
                                                                                                                                                                                                                  	ActionCompleted ActionStatus = "completed"
                                                                                                                                                                                                                  	// ActionCancelled means that the Action was cancelled before being run.
                                                                                                                                                                                                                  	ActionCancelled ActionStatus = "cancelled"
                                                                                                                                                                                                                  	// ActionPending is the default status when an Action is first queued.
                                                                                                                                                                                                                  	ActionPending ActionStatus = "pending"
                                                                                                                                                                                                                  	// ActionRunning indicates that the Action is currently running.
                                                                                                                                                                                                                  	ActionRunning ActionStatus = "running"
                                                                                                                                                                                                                  	// ActionAborting indicates that the Action is running but should be
                                                                                                                                                                                                                  	// aborted.
                                                                                                                                                                                                                  	ActionAborting ActionStatus = "aborting"
                                                                                                                                                                                                                  	// ActionAborted indicates the Action was aborted.
                                                                                                                                                                                                                  	ActionAborted ActionStatus = "aborted"

                                                                                                                                                                                                                  type ActionsWatcher

                                                                                                                                                                                                                  type ActionsWatcher interface {
                                                                                                                                                                                                                  	WatchActionNotifications() StringsWatcher
                                                                                                                                                                                                                  	WatchPendingActionNotifications() StringsWatcher

                                                                                                                                                                                                                    ActionsWatcher defines the methods an entity exposes to watch Actions queued up for itself

                                                                                                                                                                                                                    type AddApplicationArgs

                                                                                                                                                                                                                    type AddApplicationArgs struct {
                                                                                                                                                                                                                    	Name              string
                                                                                                                                                                                                                    	Series            string
                                                                                                                                                                                                                    	Charm             *Charm
                                                                                                                                                                                                                    	CharmOrigin       *CharmOrigin
                                                                                                                                                                                                                    	Channel           csparams.Channel
                                                                                                                                                                                                                    	Storage           map[string]StorageConstraints
                                                                                                                                                                                                                    	Devices           map[string]DeviceConstraints
                                                                                                                                                                                                                    	AttachStorage     []names.StorageTag
                                                                                                                                                                                                                    	EndpointBindings  map[string]string
                                                                                                                                                                                                                    	ApplicationConfig *application.Config
                                                                                                                                                                                                                    	CharmConfig       charm.Settings
                                                                                                                                                                                                                    	NumUnits          int
                                                                                                                                                                                                                    	Placement         []*instance.Placement
                                                                                                                                                                                                                    	Constraints       constraints.Value
                                                                                                                                                                                                                    	Resources         map[string]string

                                                                                                                                                                                                                    type AddOfferConnectionParams

                                                                                                                                                                                                                    type AddOfferConnectionParams struct {
                                                                                                                                                                                                                    	// SourceModelUUID is the UUID of the consuming model.
                                                                                                                                                                                                                    	SourceModelUUID string
                                                                                                                                                                                                                    	// OfferUUID is the UUID of the offer.
                                                                                                                                                                                                                    	OfferUUID string
                                                                                                                                                                                                                    	// Username is the name of the user who created this connection.
                                                                                                                                                                                                                    	Username string
                                                                                                                                                                                                                    	// RelationId is the id of the relation to which this offer pertains.
                                                                                                                                                                                                                    	RelationId int
                                                                                                                                                                                                                    	// RelationKey is the key of the relation to which this offer pertains.
                                                                                                                                                                                                                    	RelationKey string

                                                                                                                                                                                                                      AddOfferConnectionParams contains the parameters for adding an offer connection to the model.

                                                                                                                                                                                                                      type AddRemoteApplicationParams

                                                                                                                                                                                                                      type AddRemoteApplicationParams struct {
                                                                                                                                                                                                                      	// Name is the name to give the remote application. This does not have to
                                                                                                                                                                                                                      	// match the application name in the URL, or the name in the remote model.
                                                                                                                                                                                                                      	Name string
                                                                                                                                                                                                                      	// OfferUUID is the UUID of the offer.
                                                                                                                                                                                                                      	OfferUUID string
                                                                                                                                                                                                                      	// URL is either empty, or the URL that the remote application was offered
                                                                                                                                                                                                                      	// with on the hosting model.
                                                                                                                                                                                                                      	URL string
                                                                                                                                                                                                                      	// SourceModel is the tag of the model to which the remote application belongs.
                                                                                                                                                                                                                      	SourceModel names.ModelTag
                                                                                                                                                                                                                      	// Token is an opaque string that identifies the remote application in the
                                                                                                                                                                                                                      	// source model.
                                                                                                                                                                                                                      	Token string
                                                                                                                                                                                                                      	// Endpoints describes the endpoints that the remote application implements.
                                                                                                                                                                                                                      	Endpoints []charm.Relation
                                                                                                                                                                                                                      	// Spaces describes the network spaces that the remote
                                                                                                                                                                                                                      	// application's endpoints inhabit in the remote model.
                                                                                                                                                                                                                      	Spaces []*environs.ProviderSpaceInfo
                                                                                                                                                                                                                      	// Bindings maps each endpoint name to the remote space it is bound to.
                                                                                                                                                                                                                      	Bindings map[string]string
                                                                                                                                                                                                                      	// IsConsumerProxy is true when a remote application is created as a result
                                                                                                                                                                                                                      	// of a registration operation from a remote model.
                                                                                                                                                                                                                      	IsConsumerProxy bool
                                                                                                                                                                                                                      	// Macaroon is used for authentication on the offering side.
                                                                                                                                                                                                                      	Macaroon *macaroon.Macaroon

                                                                                                                                                                                                                        AddRemoteApplicationParams contains the parameters for adding a remote application to the model.

                                                                                                                                                                                                                        func (AddRemoteApplicationParams) Validate

                                                                                                                                                                                                                        func (p AddRemoteApplicationParams) Validate() error

                                                                                                                                                                                                                          Validate returns an error if there's a problem with the parameters being used to create a remote application.

                                                                                                                                                                                                                          type AddUnitOperation

                                                                                                                                                                                                                          type AddUnitOperation struct {
                                                                                                                                                                                                                          	// contains filtered or unexported fields

                                                                                                                                                                                                                            AddUnitOperation is a model operation that will add a unit.

                                                                                                                                                                                                                            func (*AddUnitOperation) Build

                                                                                                                                                                                                                            func (op *AddUnitOperation) Build(attempt int) ([]txn.Op, error)

                                                                                                                                                                                                                              Build is part of the ModelOperation interface.

                                                                                                                                                                                                                              func (*AddUnitOperation) Done

                                                                                                                                                                                                                              func (op *AddUnitOperation) Done(err error) error

                                                                                                                                                                                                                                Done is part of the ModelOperation interface.

                                                                                                                                                                                                                                type AddUnitParams

                                                                                                                                                                                                                                type AddUnitParams struct {
                                                                                                                                                                                                                                	// AttachStorage identifies storage instances to attach to the unit.
                                                                                                                                                                                                                                	AttachStorage []names.StorageTag
                                                                                                                                                                                                                                	// ProviderId identifies the unit for a given provider.
                                                                                                                                                                                                                                	ProviderId *string
                                                                                                                                                                                                                                	// Address is the container address.
                                                                                                                                                                                                                                	Address *string
                                                                                                                                                                                                                                	// Ports are the open ports on the container.
                                                                                                                                                                                                                                	Ports *[]string
                                                                                                                                                                                                                                	// UnitName is for CAAS models when creating stateful units.
                                                                                                                                                                                                                                	UnitName *string
                                                                                                                                                                                                                                	// contains filtered or unexported fields

                                                                                                                                                                                                                                  AddUnitParams contains parameters for the Application.AddUnit method.

                                                                                                                                                                                                                                  type Address

                                                                                                                                                                                                                                  type Address struct {
                                                                                                                                                                                                                                  	// contains filtered or unexported fields

                                                                                                                                                                                                                                    Address represents the state of an IP address assigned to a link-layer network device on a machine.

                                                                                                                                                                                                                                    func (*Address) ConfigMethod

                                                                                                                                                                                                                                    func (addr *Address) ConfigMethod() network.AddressConfigMethod

                                                                                                                                                                                                                                      ConfigMethod returns the AddressConfigMethod used for this IP address.

                                                                                                                                                                                                                                      func (*Address) DNSSearchDomains

                                                                                                                                                                                                                                      func (addr *Address) DNSSearchDomains() []string

                                                                                                                                                                                                                                        DNSSearchDomains returns the list of DNS domains to use for qualifying hostnames. Can be empty.

                                                                                                                                                                                                                                        func (*Address) DNSServers

                                                                                                                                                                                                                                        func (addr *Address) DNSServers() []string

                                                                                                                                                                                                                                          DNSServers returns the list of DNS nameservers to use, which can be empty.

                                                                                                                                                                                                                                          func (*Address) Device

                                                                                                                                                                                                                                          func (addr *Address) Device() (*LinkLayerDevice, error)

                                                                                                                                                                                                                                            Device returns the LinkLayerDevice this IP address is assigned to.

                                                                                                                                                                                                                                            func (*Address) DeviceName

                                                                                                                                                                                                                                            func (addr *Address) DeviceName() string

                                                                                                                                                                                                                                              DeviceName returns the name of the link-layer device this IP address is assigned to.

                                                                                                                                                                                                                                              func (*Address) DocID

                                                                                                                                                                                                                                              func (addr *Address) DocID() string

                                                                                                                                                                                                                                                DocID returns the globally unique ID of the IP address, including the model UUID as prefix.

                                                                                                                                                                                                                                                func (*Address) GatewayAddress

                                                                                                                                                                                                                                                func (addr *Address) GatewayAddress() string

                                                                                                                                                                                                                                                  GatewayAddress returns the gateway address to use, which can be empty.

                                                                                                                                                                                                                                                  func (*Address) IsDefaultGateway

                                                                                                                                                                                                                                                  func (addr *Address) IsDefaultGateway() bool

                                                                                                                                                                                                                                                    IsDefaultGateway returns true if this address is used for the default gateway on the machine.

                                                                                                                                                                                                                                                    func (*Address) IsShadow

                                                                                                                                                                                                                                                    func (addr *Address) IsShadow() bool

                                                                                                                                                                                                                                                      IsShadow indicates whether this address is virtual/floating/shadow address. In cross-model relations, we may want to return this address for a device if its non-shadow address is bound to a cloud-local subnet.

                                                                                                                                                                                                                                                      func (*Address) LoopbackConfigMethod

                                                                                                                                                                                                                                                      func (addr *Address) LoopbackConfigMethod() bool

                                                                                                                                                                                                                                                        LoopbackConfigMethod returns whether AddressConfigMethod used for this IP address was loopback.

                                                                                                                                                                                                                                                        func (*Address) Machine

                                                                                                                                                                                                                                                        func (addr *Address) Machine() (*Machine, error)

                                                                                                                                                                                                                                                          Machine returns the Machine this IP address belongs to.

                                                                                                                                                                                                                                                          func (*Address) MachineID

                                                                                                                                                                                                                                                          func (addr *Address) MachineID() string

                                                                                                                                                                                                                                                            MachineID returns the ID of the machine this IP address belongs to.

                                                                                                                                                                                                                                                            func (*Address) NetworkAddress

                                                                                                                                                                                                                                                            func (addr *Address) NetworkAddress() network.SpaceAddress

                                                                                                                                                                                                                                                              NetworkAddress returns the address transformed to a network.Address.

                                                                                                                                                                                                                                                              func (*Address) Origin

                                                                                                                                                                                                                                                              func (addr *Address) Origin() network.Origin

                                                                                                                                                                                                                                                                Origin represents the authoritative source of the ipAddress. it is set using precedence, with "provider" overriding "machine". It is used to determine whether the address is no longer recognised and is safe to remove.

                                                                                                                                                                                                                                                                func (*Address) ProviderID

                                                                                                                                                                                                                                                                func (addr *Address) ProviderID() network.Id

                                                                                                                                                                                                                                                                  ProviderID returns the provider-specific IP address ID, if set.

                                                                                                                                                                                                                                                                  func (*Address) ProviderNetworkID

                                                                                                                                                                                                                                                                  func (addr *Address) ProviderNetworkID() network.Id

                                                                                                                                                                                                                                                                    ProviderNetworkID returns the provider-specific network ID, if set.

                                                                                                                                                                                                                                                                    func (*Address) ProviderSubnetID

                                                                                                                                                                                                                                                                    func (addr *Address) ProviderSubnetID() network.Id

                                                                                                                                                                                                                                                                      ProviderSubnetID returns the provider-specific subnet ID, if set.

                                                                                                                                                                                                                                                                      func (*Address) Remove

                                                                                                                                                                                                                                                                      func (addr *Address) Remove() error

                                                                                                                                                                                                                                                                        Remove removes the IP address if it exists. No error is returned if the address was already removed.

                                                                                                                                                                                                                                                                        func (*Address) RemoveOps

                                                                                                                                                                                                                                                                        func (addr *Address) RemoveOps() []txn.Op

                                                                                                                                                                                                                                                                          RemoveOps returns transaction operations that will ensure that the address is not present in the collection and that if set, its provider ID is removed from the global register.

                                                                                                                                                                                                                                                                          func (*Address) SetOriginOps

                                                                                                                                                                                                                                                                          func (addr *Address) SetOriginOps(origin network.Origin) []txn.Op

                                                                                                                                                                                                                                                                            SetOriginOps returns the transaction operations required to set the input origin for the the address. If the address has a provider ID and origin is changing from provider to machine, remove the ID from the address document and the global collection.

                                                                                                                                                                                                                                                                            func (*Address) SetProviderIDOps

                                                                                                                                                                                                                                                                            func (addr *Address) SetProviderIDOps(id network.Id) ([]txn.Op, error)

                                                                                                                                                                                                                                                                              SetProviderIDOps returns the transaction operations required to update the address with the input provider ID. Setting the provider ID updates the address origin to provider.

                                                                                                                                                                                                                                                                              func (*Address) SetProviderNetIDsOps

                                                                                                                                                                                                                                                                              func (addr *Address) SetProviderNetIDsOps(networkID, subnetID network.Id) []txn.Op

                                                                                                                                                                                                                                                                                SetProviderNetIDsOps returns the transaction operations required to ensure that the input provider IDs are set against the address. This is distinct from SetProviderIDOps above, because we assume that the uniqueness of the IDs has already been established and that they are recorded in the global collection.

                                                                                                                                                                                                                                                                                func (*Address) String

                                                                                                                                                                                                                                                                                func (addr *Address) String() string

                                                                                                                                                                                                                                                                                  String returns a human-readable representation of the IP address.

                                                                                                                                                                                                                                                                                  func (*Address) Subnet

                                                                                                                                                                                                                                                                                  func (addr *Address) Subnet() (*Subnet, error)

                                                                                                                                                                                                                                                                                    Subnet returns the Subnet this IP address comes from. Returns nil and errors.NotFoundError if the address comes from an unknown subnet (i.e. machine-local one).

                                                                                                                                                                                                                                                                                    func (*Address) SubnetCIDR

                                                                                                                                                                                                                                                                                    func (addr *Address) SubnetCIDR() string

                                                                                                                                                                                                                                                                                      SubnetCIDR returns the CIDR of the subnet this IP address comes from.

                                                                                                                                                                                                                                                                                      func (*Address) UpdateOps

                                                                                                                                                                                                                                                                                      func (addr *Address) UpdateOps(args LinkLayerDeviceAddress) ([]txn.Op, error)

                                                                                                                                                                                                                                                                                      func (*Address) Value

                                                                                                                                                                                                                                                                                      func (addr *Address) Value() string

                                                                                                                                                                                                                                                                                        Value returns the value of this IP address.

                                                                                                                                                                                                                                                                                        type AgentEntity

                                                                                                                                                                                                                                                                                          AgentEntity represents an entity that can have an agent responsible for it.

                                                                                                                                                                                                                                                                                          type AgentLiving

                                                                                                                                                                                                                                                                                          type AgentLiving interface {
                                                                                                                                                                                                                                                                                          	EnsureDead() error
                                                                                                                                                                                                                                                                                          	Remove() error

                                                                                                                                                                                                                                                                                            AgentLiving describes state entities with a lifecycle and an agent that manages it.

                                                                                                                                                                                                                                                                                            type AgentTooler

                                                                                                                                                                                                                                                                                            type AgentTooler interface {
                                                                                                                                                                                                                                                                                            	AgentTools() (*tools.Tools, error)
                                                                                                                                                                                                                                                                                            	SetAgentVersion(version.Binary) error

                                                                                                                                                                                                                                                                                              AgentTooler is implemented by entities that have associated agent tools.

                                                                                                                                                                                                                                                                                              type AllWatcherBacking

                                                                                                                                                                                                                                                                                              type AllWatcherBacking interface {
                                                                                                                                                                                                                                                                                              	// GetAll retrieves information about all information
                                                                                                                                                                                                                                                                                              	// known to the Backing and stashes it in the Store.
                                                                                                                                                                                                                                                                                              	GetAll(multiwatcher.Store) error
                                                                                                                                                                                                                                                                                              	// Changed informs the backing about a change received
                                                                                                                                                                                                                                                                                              	// from a watcher channel.  The backing is responsible for
                                                                                                                                                                                                                                                                                              	// updating the Store to reflect the change.
                                                                                                                                                                                                                                                                                              	Changed(multiwatcher.Store, watcher.Change) error
                                                                                                                                                                                                                                                                                              	// Watch watches for any changes and sends them
                                                                                                                                                                                                                                                                                              	// on the given channel.
                                                                                                                                                                                                                                                                                              	Watch(chan<- watcher.Change)
                                                                                                                                                                                                                                                                                              	// Unwatch stops watching for changes on the
                                                                                                                                                                                                                                                                                              	// given channel.
                                                                                                                                                                                                                                                                                              	Unwatch(chan<- watcher.Change)

                                                                                                                                                                                                                                                                                                AllWatcherBacking is the interface required by the multiwatcher to access the underlying state.

                                                                                                                                                                                                                                                                                                func NewAllWatcherBacking

                                                                                                                                                                                                                                                                                                func NewAllWatcherBacking(pool *StatePool) AllWatcherBacking

                                                                                                                                                                                                                                                                                                  NewAllWatcherBacking creates a backing object that watches all the models in the controller for changes that are fed through the multiwatcher infrastructure.

                                                                                                                                                                                                                                                                                                  type Application

                                                                                                                                                                                                                                                                                                  type Application struct {
                                                                                                                                                                                                                                                                                                  	// contains filtered or unexported fields

                                                                                                                                                                                                                                                                                                    Application represents the state of an application.

                                                                                                                                                                                                                                                                                                    func (*Application) AddOperation

                                                                                                                                                                                                                                                                                                    func (a *Application) AddOperation(props UnitUpdateProperties) *AddUnitOperation

                                                                                                                                                                                                                                                                                                      AddOperation returns a model operation that will add a unit.

                                                                                                                                                                                                                                                                                                      func (*Application) AddUnit

                                                                                                                                                                                                                                                                                                      func (a *Application) AddUnit(args AddUnitParams) (unit *Unit, err error)

                                                                                                                                                                                                                                                                                                        AddUnit adds a new principal unit to the application.

                                                                                                                                                                                                                                                                                                        func (*Application) AgentTools

                                                                                                                                                                                                                                                                                                        func (a *Application) AgentTools() (*tools.Tools, error)

                                                                                                                                                                                                                                                                                                          AgentTools returns the tools that the operator is currently running. It an error that satisfies errors.IsNotFound if the tools have not yet been set.

                                                                                                                                                                                                                                                                                                          func (*Application) AllUnits

                                                                                                                                                                                                                                                                                                          func (a *Application) AllUnits() (units []*Unit, err error)

                                                                                                                                                                                                                                                                                                            AllUnits returns all units of the application.

                                                                                                                                                                                                                                                                                                            func (*Application) ApplicationConfig

                                                                                                                                                                                                                                                                                                            func (a *Application) ApplicationConfig() (application.ConfigAttributes, error)

                                                                                                                                                                                                                                                                                                              ApplicationConfig returns the configuration for the application itself.

                                                                                                                                                                                                                                                                                                              func (*Application) ApplicationTag

                                                                                                                                                                                                                                                                                                              func (a *Application) ApplicationTag() names.ApplicationTag

                                                                                                                                                                                                                                                                                                                ApplicationTag returns the more specific ApplicationTag rather than the generic Tag.

                                                                                                                                                                                                                                                                                                                func (*Application) ChangeScale

                                                                                                                                                                                                                                                                                                                func (a *Application) ChangeScale(scaleChange int) (int, error)

                                                                                                                                                                                                                                                                                                                  ChangeScale alters the existing scale by the provided change amount, returning the new amount. This is used on CAAS models.

                                                                                                                                                                                                                                                                                                                  func (*Application) Channel

                                                                                                                                                                                                                                                                                                                  func (a *Application) Channel() csparams.Channel

                                                                                                                                                                                                                                                                                                                    Channel identifies the charm store channel from which the application's charm was deployed. It is only needed when interacting with the charm store.

                                                                                                                                                                                                                                                                                                                    func (*Application) Charm

                                                                                                                                                                                                                                                                                                                    func (a *Application) Charm() (ch *Charm, force bool, err error)

                                                                                                                                                                                                                                                                                                                      Charm returns the application's charm and whether units should upgrade to that charm even if they are in an error state.

                                                                                                                                                                                                                                                                                                                      func (*Application) CharmConfig

                                                                                                                                                                                                                                                                                                                      func (a *Application) CharmConfig(branchName string) (charm.Settings, error)

                                                                                                                                                                                                                                                                                                                        CharmConfig returns the raw user configuration for the application's charm.

                                                                                                                                                                                                                                                                                                                        func (*Application) CharmModifiedVersion

                                                                                                                                                                                                                                                                                                                        func (a *Application) CharmModifiedVersion() int

                                                                                                                                                                                                                                                                                                                          CharmModifiedVersion increases whenever the application's charm is changed in any way.

                                                                                                                                                                                                                                                                                                                          func (*Application) CharmOrigin

                                                                                                                                                                                                                                                                                                                          func (a *Application) CharmOrigin() *CharmOrigin

                                                                                                                                                                                                                                                                                                                            CharmOrigin returns the origin of a charm associated with a application.

                                                                                                                                                                                                                                                                                                                            func (*Application) CharmURL

                                                                                                                                                                                                                                                                                                                            func (a *Application) CharmURL() (curl *charm.URL, force bool)

                                                                                                                                                                                                                                                                                                                              CharmURL returns the application's charm URL, and whether units should upgrade to the charm with that URL even if they are in an error state.

                                                                                                                                                                                                                                                                                                                              func (*Application) ClearExposed

                                                                                                                                                                                                                                                                                                                              func (a *Application) ClearExposed() error

                                                                                                                                                                                                                                                                                                                                ClearExposed removes the exposed flag from the application. See MergeExposeSettings and IsExposed.

                                                                                                                                                                                                                                                                                                                                func (*Application) ClearResources

                                                                                                                                                                                                                                                                                                                                func (a *Application) ClearResources() error

                                                                                                                                                                                                                                                                                                                                  ClearResources sets the application's pending resouces to false. This is used on CAAS models.

                                                                                                                                                                                                                                                                                                                                  func (*Application) Constraints

                                                                                                                                                                                                                                                                                                                                  func (a *Application) Constraints() (constraints.Value, error)

                                                                                                                                                                                                                                                                                                                                    Constraints returns the current application constraints.

                                                                                                                                                                                                                                                                                                                                    func (*Application) DeployedMachines

                                                                                                                                                                                                                                                                                                                                    func (a *Application) DeployedMachines() ([]*Machine, error)

                                                                                                                                                                                                                                                                                                                                      Deployed machines returns the collection of machines that this application has units deployed to.

                                                                                                                                                                                                                                                                                                                                      func (*Application) Destroy

                                                                                                                                                                                                                                                                                                                                      func (a *Application) Destroy() (err error)

                                                                                                                                                                                                                                                                                                                                        Destroy ensures that the application and all its relations will be removed at some point; if the application has no units, and no relation involving the application has any units in scope, they are all removed immediately.

                                                                                                                                                                                                                                                                                                                                        func (*Application) DestroyOperation

                                                                                                                                                                                                                                                                                                                                        func (a *Application) DestroyOperation() *DestroyApplicationOperation

                                                                                                                                                                                                                                                                                                                                          DestroyOperation returns a model operation that will destroy the application.

                                                                                                                                                                                                                                                                                                                                          func (*Application) DeviceConstraints

                                                                                                                                                                                                                                                                                                                                          func (a *Application) DeviceConstraints() (map[string]DeviceConstraints, error)

                                                                                                                                                                                                                                                                                                                                            DeviceConstraints returns the device constraints for the application.

                                                                                                                                                                                                                                                                                                                                            func (*Application) Endpoint

                                                                                                                                                                                                                                                                                                                                            func (a *Application) Endpoint(relationName string) (Endpoint, error)

                                                                                                                                                                                                                                                                                                                                              Endpoint returns the relation endpoint with the supplied name, if it exists.

                                                                                                                                                                                                                                                                                                                                              func (*Application) EndpointBindings

                                                                                                                                                                                                                                                                                                                                              func (a *Application) EndpointBindings() (*Bindings, error)

                                                                                                                                                                                                                                                                                                                                                EndpointBindings returns the mapping for each endpoint name and the space ID it is bound to (or empty if unspecified). When no bindings are stored for the application, defaults are returned.

                                                                                                                                                                                                                                                                                                                                                func (*Application) Endpoints

                                                                                                                                                                                                                                                                                                                                                func (a *Application) Endpoints() (eps []Endpoint, err error)

                                                                                                                                                                                                                                                                                                                                                  Endpoints returns the application's currently available relation endpoints.

                                                                                                                                                                                                                                                                                                                                                  func (*Application) EnsureMinUnits

                                                                                                                                                                                                                                                                                                                                                  func (a *Application) EnsureMinUnits() (err error)

                                                                                                                                                                                                                                                                                                                                                    EnsureMinUnits adds new units if the application's MinUnits value is greater than the number of alive units.

                                                                                                                                                                                                                                                                                                                                                    func (*Application) ExposedEndpoints

                                                                                                                                                                                                                                                                                                                                                    func (a *Application) ExposedEndpoints() map[string]ExposedEndpoint

                                                                                                                                                                                                                                                                                                                                                      ExposedEndpoints returns a map where keys are endpoint names (or the "" value which represents all endpoints) and values are ExposedEndpoint instances that specify which sources (spaces or CIDRs) can access the opened ports for each endpoint once the application is exposed.

                                                                                                                                                                                                                                                                                                                                                      func (*Application) GetPlacement

                                                                                                                                                                                                                                                                                                                                                      func (a *Application) GetPlacement() string

                                                                                                                                                                                                                                                                                                                                                        GetPlacement returns the application's placement directive. This is used on CAAS models.

                                                                                                                                                                                                                                                                                                                                                        func (*Application) GetScale

                                                                                                                                                                                                                                                                                                                                                        func (a *Application) GetScale() int

                                                                                                                                                                                                                                                                                                                                                          GetScale returns the application's desired scale value. This is used on CAAS models.

                                                                                                                                                                                                                                                                                                                                                          func (*Application) IsExposed

                                                                                                                                                                                                                                                                                                                                                          func (a *Application) IsExposed() bool

                                                                                                                                                                                                                                                                                                                                                            IsExposed returns whether this application is exposed. The explicitly open ports (with open-port) for exposed applications may be accessed from machines outside of the local deployment network. See MergeExposeSettings and ClearExposed.

                                                                                                                                                                                                                                                                                                                                                            func (*Application) IsPrincipal

                                                                                                                                                                                                                                                                                                                                                            func (a *Application) IsPrincipal() bool

                                                                                                                                                                                                                                                                                                                                                              IsPrincipal returns whether units of the application can have subordinate units.

                                                                                                                                                                                                                                                                                                                                                              func (*Application) IsRemote

                                                                                                                                                                                                                                                                                                                                                              func (a *Application) IsRemote() bool

                                                                                                                                                                                                                                                                                                                                                                IsRemote returns false for a local application.

                                                                                                                                                                                                                                                                                                                                                                func (*Application) LeaderSettings

                                                                                                                                                                                                                                                                                                                                                                func (a *Application) LeaderSettings() (map[string]string, error)

                                                                                                                                                                                                                                                                                                                                                                  LeaderSettings returns a application's leader settings. If nothing has been set yet, it will return an empty map; this is not an error.

                                                                                                                                                                                                                                                                                                                                                                  func (*Application) Life

                                                                                                                                                                                                                                                                                                                                                                  func (a *Application) Life() Life

                                                                                                                                                                                                                                                                                                                                                                    Life returns whether the application is Alive, Dying or Dead.

                                                                                                                                                                                                                                                                                                                                                                    func (*Application) MergeBindings

                                                                                                                                                                                                                                                                                                                                                                    func (a *Application) MergeBindings(operatorBindings *Bindings, force bool) error

                                                                                                                                                                                                                                                                                                                                                                      MergeBindings merges the provided bindings map with the existing application bindings.

                                                                                                                                                                                                                                                                                                                                                                      func (*Application) MergeExposeSettings

                                                                                                                                                                                                                                                                                                                                                                      func (a *Application) MergeExposeSettings(exposedEndpoints map[string]ExposedEndpoint) error

                                                                                                                                                                                                                                                                                                                                                                        MergeExposeSettings marks the application as exposed and merges the provided ExposedEndpoint details into the current set of expose settings. The merge operation will overwrites expose settings for each existing endpoint name.

                                                                                                                                                                                                                                                                                                                                                                        See ClearExposed and IsExposed.

                                                                                                                                                                                                                                                                                                                                                                        func (*Application) MetricCredentials

                                                                                                                                                                                                                                                                                                                                                                        func (a *Application) MetricCredentials() []byte

                                                                                                                                                                                                                                                                                                                                                                          MetricCredentials returns any metric credentials associated with this application.

                                                                                                                                                                                                                                                                                                                                                                          func (*Application) MinUnits

                                                                                                                                                                                                                                                                                                                                                                          func (a *Application) MinUnits() int

                                                                                                                                                                                                                                                                                                                                                                            MinUnits returns the minimum units count for the application.

                                                                                                                                                                                                                                                                                                                                                                            func (*Application) Name

                                                                                                                                                                                                                                                                                                                                                                            func (a *Application) Name() string

                                                                                                                                                                                                                                                                                                                                                                              Name returns the application name.

                                                                                                                                                                                                                                                                                                                                                                              func (*Application) PasswordValid

                                                                                                                                                                                                                                                                                                                                                                              func (a *Application) PasswordValid(password string) bool

                                                                                                                                                                                                                                                                                                                                                                                PasswordValid returns whether the given password is valid for the given application.

                                                                                                                                                                                                                                                                                                                                                                                func (*Application) Refresh

                                                                                                                                                                                                                                                                                                                                                                                func (a *Application) Refresh() error

                                                                                                                                                                                                                                                                                                                                                                                  Refresh refreshes the contents of the Application from the underlying state. It returns an error that satisfies errors.IsNotFound if the application has been removed.

                                                                                                                                                                                                                                                                                                                                                                                  func (*Application) RelationCount

                                                                                                                                                                                                                                                                                                                                                                                  func (a *Application) RelationCount() int

                                                                                                                                                                                                                                                                                                                                                                                    RelationCount returns the of number of active relations for this application.

                                                                                                                                                                                                                                                                                                                                                                                    func (*Application) Relations

                                                                                                                                                                                                                                                                                                                                                                                    func (a *Application) Relations() (relations []*Relation, err error)

                                                                                                                                                                                                                                                                                                                                                                                      Relations returns a Relation for every relation the application is in.

                                                                                                                                                                                                                                                                                                                                                                                      func (*Application) Series

                                                                                                                                                                                                                                                                                                                                                                                      func (a *Application) Series() string

                                                                                                                                                                                                                                                                                                                                                                                        Series returns the specified series for this charm.

                                                                                                                                                                                                                                                                                                                                                                                        func (*Application) ServiceInfo

                                                                                                                                                                                                                                                                                                                                                                                        func (a *Application) ServiceInfo() (CloudServicer, error)

                                                                                                                                                                                                                                                                                                                                                                                          ServiceInfo returns information about this application's cloud service. This is only used for CAAS models.

                                                                                                                                                                                                                                                                                                                                                                                          func (*Application) SetAgentVersion

                                                                                                                                                                                                                                                                                                                                                                                          func (a *Application) SetAgentVersion(v version.Binary) (err error)

                                                                                                                                                                                                                                                                                                                                                                                            SetAgentVersion sets the Tools value in applicationDoc.

                                                                                                                                                                                                                                                                                                                                                                                            func (*Application) SetCharm

                                                                                                                                                                                                                                                                                                                                                                                            func (a *Application) SetCharm(cfg SetCharmConfig) (err error)

                                                                                                                                                                                                                                                                                                                                                                                              SetCharm changes the charm for the application.

                                                                                                                                                                                                                                                                                                                                                                                              func (*Application) SetConstraints

                                                                                                                                                                                                                                                                                                                                                                                              func (a *Application) SetConstraints(cons constraints.Value) (err error)

                                                                                                                                                                                                                                                                                                                                                                                                SetConstraints replaces the current application constraints.

                                                                                                                                                                                                                                                                                                                                                                                                func (*Application) SetMetricCredentials

                                                                                                                                                                                                                                                                                                                                                                                                func (a *Application) SetMetricCredentials(b []byte) error

                                                                                                                                                                                                                                                                                                                                                                                                  SetMetricCredentials updates the metric credentials associated with this application.

                                                                                                                                                                                                                                                                                                                                                                                                  func (*Application) SetMinUnits

                                                                                                                                                                                                                                                                                                                                                                                                  func (a *Application) SetMinUnits(minUnits int) (err error)

                                                                                                                                                                                                                                                                                                                                                                                                    SetMinUnits changes the number of minimum units required by the application.

                                                                                                                                                                                                                                                                                                                                                                                                    func (*Application) SetOperatorStatus

                                                                                                                                                                                                                                                                                                                                                                                                    func (a *Application) SetOperatorStatus(sInfo status.StatusInfo) error

                                                                                                                                                                                                                                                                                                                                                                                                      SetOperatorStatus sets the operator status for an application. This is used on CAAS models.

                                                                                                                                                                                                                                                                                                                                                                                                      func (*Application) SetPassword

                                                                                                                                                                                                                                                                                                                                                                                                      func (a *Application) SetPassword(password string) error

                                                                                                                                                                                                                                                                                                                                                                                                        SetPassword sets the password for the application's agent. TODO(caas) - consider a separate CAAS application entity

                                                                                                                                                                                                                                                                                                                                                                                                        func (*Application) SetScale

                                                                                                                                                                                                                                                                                                                                                                                                        func (a *Application) SetScale(scale int, generation int64, force bool) error

                                                                                                                                                                                                                                                                                                                                                                                                          SetScale sets the application's desired scale value. This is used on CAAS models.

                                                                                                                                                                                                                                                                                                                                                                                                          func (*Application) SetStatus

                                                                                                                                                                                                                                                                                                                                                                                                          func (a *Application) SetStatus(statusInfo status.StatusInfo) error

                                                                                                                                                                                                                                                                                                                                                                                                            SetStatus sets the status for the application.

                                                                                                                                                                                                                                                                                                                                                                                                            func (*Application) Status

                                                                                                                                                                                                                                                                                                                                                                                                            func (a *Application) Status() (status.StatusInfo, error)

                                                                                                                                                                                                                                                                                                                                                                                                              Status returns the status of the application. Only unit leaders are allowed to set the status of the application. If no status is recorded, then there are no unit leaders and the status is derived from the unit status values.

                                                                                                                                                                                                                                                                                                                                                                                                              func (*Application) StatusHistory

                                                                                                                                                                                                                                                                                                                                                                                                              func (a *Application) StatusHistory(filter status.StatusHistoryFilter) ([]status.StatusInfo, error)

                                                                                                                                                                                                                                                                                                                                                                                                                StatusHistory returns a slice of at most filter.Size StatusInfo items or items as old as filter.Date or items newer than now - filter.Delta time representing past statuses for this application.

                                                                                                                                                                                                                                                                                                                                                                                                                func (*Application) StorageConstraints

                                                                                                                                                                                                                                                                                                                                                                                                                func (a *Application) StorageConstraints() (map[string]StorageConstraints, error)

                                                                                                                                                                                                                                                                                                                                                                                                                  StorageConstraints returns the storage constraints for the application.

                                                                                                                                                                                                                                                                                                                                                                                                                  func (*Application) String

                                                                                                                                                                                                                                                                                                                                                                                                                  func (a *Application) String() string

                                                                                                                                                                                                                                                                                                                                                                                                                    String returns the application name.

                                                                                                                                                                                                                                                                                                                                                                                                                    func (*Application) Tag

                                                                                                                                                                                                                                                                                                                                                                                                                    func (a *Application) Tag() names.Tag

                                                                                                                                                                                                                                                                                                                                                                                                                      Tag returns a name identifying the application. The returned name will be different from other Tag values returned by any other entities from the same state.

                                                                                                                                                                                                                                                                                                                                                                                                                      func (*Application) UnitCount

                                                                                                                                                                                                                                                                                                                                                                                                                      func (a *Application) UnitCount() int

                                                                                                                                                                                                                                                                                                                                                                                                                        UnitCount returns the of number of units for this application.

                                                                                                                                                                                                                                                                                                                                                                                                                        func (*Application) UnitNames

                                                                                                                                                                                                                                                                                                                                                                                                                        func (a *Application) UnitNames() ([]string, error)

                                                                                                                                                                                                                                                                                                                                                                                                                          UnitNames returns the of this application's units.

                                                                                                                                                                                                                                                                                                                                                                                                                          func (*Application) UnitStatuses

                                                                                                                                                                                                                                                                                                                                                                                                                          func (a *Application) UnitStatuses() (map[string]status.StatusInfo, error)

                                                                                                                                                                                                                                                                                                                                                                                                                            UnitStatuses returns a map of unit names to their Status results (workload status).

                                                                                                                                                                                                                                                                                                                                                                                                                            func (*Application) UnsetExposeSettings

                                                                                                                                                                                                                                                                                                                                                                                                                            func (a *Application) UnsetExposeSettings(exposedEndpoints []string) error

                                                                                                                                                                                                                                                                                                                                                                                                                              UnsetExposeSettings removes the expose settings for the provided list of endpoint names. If the resulting exposed endpoints map for the application becomes empty after the settings are removed, the application will be automatically unexposed.

                                                                                                                                                                                                                                                                                                                                                                                                                              An error will be returned if an unknown endpoint name is specified or there is no existing expose settings entry for any of the provided endpoint names.

                                                                                                                                                                                                                                                                                                                                                                                                                              See ClearExposed and IsExposed.

                                                                                                                                                                                                                                                                                                                                                                                                                              func (*Application) UpdateApplicationConfig

                                                                                                                                                                                                                                                                                                                                                                                                                              func (a *Application) UpdateApplicationConfig(
                                                                                                                                                                                                                                                                                                                                                                                                                              	changes application.ConfigAttributes,
                                                                                                                                                                                                                                                                                                                                                                                                                              	reset []string,
                                                                                                                                                                                                                                                                                                                                                                                                                              	schema environschema.Fields,
                                                                                                                                                                                                                                                                                                                                                                                                                              	defaults schema.Defaults,
                                                                                                                                                                                                                                                                                                                                                                                                                              ) error

                                                                                                                                                                                                                                                                                                                                                                                                                                UpdateApplicationConfig changes an application's config settings. Unknown and invalid values will return an error.

                                                                                                                                                                                                                                                                                                                                                                                                                                func (*Application) UpdateApplicationSeries

                                                                                                                                                                                                                                                                                                                                                                                                                                func (a *Application) UpdateApplicationSeries(series string, force bool) (err error)

                                                                                                                                                                                                                                                                                                                                                                                                                                  UpdateApplicationSeries updates the series for the Application.

                                                                                                                                                                                                                                                                                                                                                                                                                                  func (*Application) UpdateCharmConfig

                                                                                                                                                                                                                                                                                                                                                                                                                                  func (a *Application) UpdateCharmConfig(branchName string, changes charm.Settings) error

                                                                                                                                                                                                                                                                                                                                                                                                                                    UpdateCharmConfig changes a application's charm config settings. Values set to nil will be deleted; unknown and invalid values will return an error.

                                                                                                                                                                                                                                                                                                                                                                                                                                    func (*Application) UpdateCloudService

                                                                                                                                                                                                                                                                                                                                                                                                                                    func (a *Application) UpdateCloudService(providerId string, addresses []network.SpaceAddress) error

                                                                                                                                                                                                                                                                                                                                                                                                                                      UpdateCloudService updates the cloud service details for the application.

                                                                                                                                                                                                                                                                                                                                                                                                                                      func (*Application) UpdateLeaderSettings

                                                                                                                                                                                                                                                                                                                                                                                                                                      func (a *Application) UpdateLeaderSettings(token leadership.Token, updates map[string]string) error

                                                                                                                                                                                                                                                                                                                                                                                                                                        UpdateLeaderSettings updates the application's leader settings with the supplied values, but will fail (with a suitable error) if the supplied Token loses validity. Empty values in the supplied map will be cleared in the database.

                                                                                                                                                                                                                                                                                                                                                                                                                                        func (*Application) UpdateUnits

                                                                                                                                                                                                                                                                                                                                                                                                                                        func (a *Application) UpdateUnits(unitsOp *UpdateUnitsOperation) error

                                                                                                                                                                                                                                                                                                                                                                                                                                          UpdateUnits applies the given application unit update operations.

                                                                                                                                                                                                                                                                                                                                                                                                                                          func (*Application) VerifySupportedSeries

                                                                                                                                                                                                                                                                                                                                                                                                                                          func (a *Application) VerifySupportedSeries(series string, force bool) error

                                                                                                                                                                                                                                                                                                                                                                                                                                            VerifySupportedSeries verifies if the given series is supported by the application.

                                                                                                                                                                                                                                                                                                                                                                                                                                            func (*Application) Watch

                                                                                                                                                                                                                                                                                                                                                                                                                                            func (a *Application) Watch() NotifyWatcher

                                                                                                                                                                                                                                                                                                                                                                                                                                              Watch returns a watcher for observing changes to an application.

                                                                                                                                                                                                                                                                                                                                                                                                                                              func (*Application) WatchCharmConfig

                                                                                                                                                                                                                                                                                                                                                                                                                                              func (a *Application) WatchCharmConfig() (NotifyWatcher, error)

                                                                                                                                                                                                                                                                                                                                                                                                                                                WatchCharmConfig returns a watcher for observing changes to the application's charm configuration settings. The returned watcher will be valid only while the application's charm URL is not changed.

                                                                                                                                                                                                                                                                                                                                                                                                                                                func (*Application) WatchLeaderSettings

                                                                                                                                                                                                                                                                                                                                                                                                                                                func (a *Application) WatchLeaderSettings() NotifyWatcher

                                                                                                                                                                                                                                                                                                                                                                                                                                                  WatchLeaderSettings returns a watcher for observing changed to an application's leader settings.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  func (*Application) WatchRelations

                                                                                                                                                                                                                                                                                                                                                                                                                                                  func (a *Application) WatchRelations() StringsWatcher

                                                                                                                                                                                                                                                                                                                                                                                                                                                    WatchRelations returns a StringsWatcher that notifies of changes to the lifecycles of relations involving a.

                                                                                                                                                                                                                                                                                                                                                                                                                                                    func (*Application) WatchScale

                                                                                                                                                                                                                                                                                                                                                                                                                                                    func (a *Application) WatchScale() NotifyWatcher

                                                                                                                                                                                                                                                                                                                                                                                                                                                      WatchScale returns a new NotifyWatcher watching for changes to the specified application's scale value.

                                                                                                                                                                                                                                                                                                                                                                                                                                                      func (*Application) WatchServiceAddressesHash

                                                                                                                                                                                                                                                                                                                                                                                                                                                      func (a *Application) WatchServiceAddressesHash() StringsWatcher

                                                                                                                                                                                                                                                                                                                                                                                                                                                        WatchServiceAddressesHash returns a StringsWatcher that emits a hash of the unit's container address whenever it changes.

                                                                                                                                                                                                                                                                                                                                                                                                                                                        func (*Application) WatchUnits

                                                                                                                                                                                                                                                                                                                                                                                                                                                        func (a *Application) WatchUnits() StringsWatcher

                                                                                                                                                                                                                                                                                                                                                                                                                                                          WatchUnits returns a StringsWatcher that notifies of changes to the lifecycles of units of a.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          type ApplicationDescription

                                                                                                                                                                                                                                                                                                                                                                                                                                                          type ApplicationDescription interface {
                                                                                                                                                                                                                                                                                                                                                                                                                                                          	Offers() []description.ApplicationOffer

                                                                                                                                                                                                                                                                                                                                                                                                                                                            ApplicationDescription is an in-place description of an application

                                                                                                                                                                                                                                                                                                                                                                                                                                                            type ApplicationEntity

                                                                                                                                                                                                                                                                                                                                                                                                                                                            type ApplicationEntity interface {
                                                                                                                                                                                                                                                                                                                                                                                                                                                            	// Life returns the life status of the application.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            	Life() Life
                                                                                                                                                                                                                                                                                                                                                                                                                                                            	// IsRemote returns true if the application is remote (hosted in a different model).
                                                                                                                                                                                                                                                                                                                                                                                                                                                            	IsRemote() bool
                                                                                                                                                                                                                                                                                                                                                                                                                                                            	// Endpoints returns the application's currently available relation endpoints.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            	Endpoints() ([]Endpoint, error)
                                                                                                                                                                                                                                                                                                                                                                                                                                                            	// Endpoint returns the relation endpoint with the supplied name, if it exists.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            	Endpoint(relationName string) (Endpoint, error)
                                                                                                                                                                                                                                                                                                                                                                                                                                                            	// Relations returns a Relation for every relation the application is in.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            	Relations() (relations []*Relation, err error)

                                                                                                                                                                                                                                                                                                                                                                                                                                                              ApplicationEntity represents a local or remote application.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              type ApplicationOfferDescription

                                                                                                                                                                                                                                                                                                                                                                                                                                                              type ApplicationOfferDescription interface {
                                                                                                                                                                                                                                                                                                                                                                                                                                                              	Offers() []description.ApplicationOffer

                                                                                                                                                                                                                                                                                                                                                                                                                                                                ApplicationOfferDescription defines an in-place usage for reading application offers.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                type ApplicationOfferInput

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ApplicationOfferInput describes the input used for migrating application offers.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  type ApplicationOfferStateDocumentFactory

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  type ApplicationOfferStateDocumentFactory interface {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  	MakeApplicationOfferDoc(description.ApplicationOffer) (applicationOfferDoc, error)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  	MakeIncApplicationOffersRefOp(string) (txn.Op, error)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ApplicationOfferStateDocumentFactory creates documents that are useful with in the state package. In essence this just allows us to model our dependencies correctly without having to construct dependencies everywhere. Note: we need public methods here because gomock doesn't mock private methods

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    type AssignmentPolicy

                                                                                                                                                                                                                                                                                                                                                                                                                                                                    type AssignmentPolicy string

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      AssignmentPolicy controls what machine a unit will be assigned to.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      const (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	// AssignLocal indicates that all application units should be assigned
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	// to machine 0.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	AssignLocal AssignmentPolicy = "local"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	// AssignClean indicates that every application unit should be assigned
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	// to a machine which never previously has hosted any units, and that
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	// new machines should be launched if required.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	AssignClean AssignmentPolicy = "clean"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	// AssignCleanEmpty indicates that every application unit should be assigned
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	// to a machine which never previously has hosted any units, and which is not
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	// currently hosting any containers, and that new machines should be launched if required.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	AssignCleanEmpty AssignmentPolicy = "clean-empty"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	// AssignNew indicates that every application unit should be assigned to a new
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	// dedicated machine.  A new machine will be launched for each new unit.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	AssignNew AssignmentPolicy = "new"

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      type Authenticator

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      type Authenticator interface {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	Refresh() error
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	SetPassword(pass string) error
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	PasswordValid(pass string) bool

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Authenticator represents entites capable of handling password authentication.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        type BatchParam

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        type BatchParam struct {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	UUID     string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	CharmURL string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	Created  time.Time
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	Metrics  []Metric
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	Unit     names.UnitTag

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          BatchParam contains the properties of the metrics batch used when creating a metrics batch.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          type Bindings

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          type Bindings struct {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          	// contains filtered or unexported fields

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Bindings are EndpointBindings.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            func NewBindings

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            func NewBindings(st EndpointBinding, givenMap map[string]string) (*Bindings, error)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              NewBindings returns a bindings guaranteed to be in space id format.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              func (Bindings) GetBSON

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              func (b Bindings) GetBSON() (interface{}, error)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                GetBSON ensures any special characters ($ or .) are escaped in keys before marshalling the map into BSON and storing in mongo.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                func (*Bindings) Map

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                func (b *Bindings) Map() map[string]string

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Map returns the current bindingMap with space ids.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  func (*Bindings) MapWithSpaceNames

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  func (b *Bindings) MapWithSpaceNames(lookup network.SpaceInfos) (map[string]string, error)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    MapWithSpaceNames returns the current bindingMap with space names rather than ids.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    func (*Bindings) Merge

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    func (b *Bindings) Merge(mergeWith map[string]string, meta *charm.Meta) (bool, error)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Merge the default bindings based on the given charm metadata with the current bindings, overriding with mergeWith values (for the same keys). Current values and mergeWith are both optional and will ignored when empty. The current object contains the combined finalized bindings. Returns true/false if there are any actual differences.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      func (*Bindings) SetBSON

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      func (b *Bindings) SetBSON(raw bson.Raw) error

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        SetBSON ensures any special characters ($ or .) are unescaped in keys after unmarshalling the raw BSON coming from the stored document.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        type Block

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        type Block interface {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	// Id returns this block's id.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	Id() string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	// ModelUUID returns the model UUID associated with this block.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	ModelUUID() string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	// Tag returns tag for the entity that is being blocked
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	Tag() (names.Tag, error)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	// Type returns block type
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	Type() BlockType
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	// Message returns explanation that accompanies this block.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	Message() string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	// contains filtered or unexported methods

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Customers and stakeholders want to be able to prevent accidental damage to their Juju deployments. To prevent running some operations, we want to have blocks that can be switched on/off.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          type BlockDevice

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          type BlockDevice interface {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          	// Machine returns the ID of the machine the block device is attached to.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          	Machine() string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          	// Info returns the block device's BlockDeviceInfo.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          	Info() BlockDeviceInfo

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            BlockDevice represents the state of a block device in the model.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            type BlockDeviceInfo

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            type BlockDeviceInfo struct {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	DeviceName     string   `bson:"devicename"`
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	DeviceLinks    []string `bson:"devicelinks,omitempty"`
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	Label          string   `bson:"label,omitempty"`
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	UUID           string   `bson:"uuid,omitempty"`
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	HardwareId     string   `bson:"hardwareid,omitempty"`
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	WWN            string   `bson:"wwn,omitempty"`
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	BusAddress     string   `bson:"busaddress,omitempty"`
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	Size           uint64   `bson:"size"`
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	FilesystemType string   `bson:"fstype,omitempty"`
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	InUse          bool     `bson:"inuse"`
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	MountPoint     string   `bson:"mountpoint,omitempty"`
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	SerialId       string   `bson:"serialid,omitempty"`

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              BlockDeviceInfo describes information about a block device.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              type BlockType

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              type BlockType int8

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                BlockType specifies block type for enum benefit.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                const (
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                	// DestroyBlock type identifies block that prevents model destruction.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                	DestroyBlock BlockType = iota
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                	// RemoveBlock type identifies block that prevents
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                	// removal of machines, applications, units or relations.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                	// ChangeBlock type identifies block that prevents model changes such
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                	// as additions, modifications, removals of model entities.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                func AllTypes

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                func AllTypes() []BlockType

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  AllTypes returns all supported block types.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  func ParseBlockType

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  func ParseBlockType(str string) BlockType

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ParseBlockType returns BlockType from humanly readable type representation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    func (BlockType) MigrationValue

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    func (t BlockType) MigrationValue() string

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      MigrationValue converts the block type value into a useful human readable string for model migration.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      func (BlockType) String

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      func (t BlockType) String() string

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        String returns humanly readable type representation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        func (BlockType) ToParams

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        func (t BlockType) ToParams() model.BlockType

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ToParams returns the type as model.BlockType.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          type CAASModel

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          type CAASModel struct {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          	// TODO(caas) - this is all still messy until things shake out.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          	// contains filtered or unexported fields

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            CAASModel contains functionality that is specific to an Containers-As-A-Service (CAAS) model. It embeds a Model so that all generic Model functionality is also available.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            func (*CAASModel) Containers

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            func (m *CAASModel) Containers(providerIds ...string) ([]CloudContainer, error)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Containers returns the containers for the specified provider ids.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              func (*CAASModel) PodSpec

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              func (m *CAASModel) PodSpec(appTag names.ApplicationTag) (string, error)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                PodSpec returns the pod spec for the given application tag.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                func (*CAASModel) RawK8sSpec

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                func (m *CAASModel) RawK8sSpec(appTag names.ApplicationTag) (string, error)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  RawK8sSpec returns the raw k8s spec for the given application tag.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  func (*CAASModel) SetPodSpec

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  func (m *CAASModel) SetPodSpec(token leadership.Token, appTag names.ApplicationTag, spec *string) error

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    SetPodSpec sets the pod spec for the given application tag while making sure that the caller is the leader by validating the provided token. For cases where leadership checks are not important (e.g. migrations), a nil Token can be provided to bypass the leadership checks.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    An error will be returned if the specified application is not alive or the leadership check fails.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    func (*CAASModel) SetPodSpecOperation

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    func (m *CAASModel) SetPodSpecOperation(token leadership.Token, appTag names.ApplicationTag, spec *string) ModelOperation

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      SetPodSpecOperation returns a ModelOperation for updating a PodSpec. For cases where leadership checks are not important (e.g. migrations), a nil Token can be provided to bypass the leadership checks.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      func (*CAASModel) SetRawK8sSpecOperation

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      func (m *CAASModel) SetRawK8sSpecOperation(token leadership.Token, appTag names.ApplicationTag, spec *string) ModelOperation

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        SetRawK8sSpecOperation returns a ModelOperation for updating a raw k8s spec. For cases where leadership checks are not important (e.g. migrations), a nil Token can be provided to bypass the leadership checks.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        func (*CAASModel) WatchPodSpec

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        func (m *CAASModel) WatchPodSpec(appTag names.ApplicationTag) (NotifyWatcher, error)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          WatchPodSpec returns a watcher observing changes that affect the pod spec for an application or unit.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          type Change

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          type Change interface {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          	// Prepare ensures that db is in a valid base state for applying
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          	// the change, and returns mgo/txn operations that will fail any
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          	// enclosing transaction if the state has materially changed; or
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          	// returns an error.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          	Prepare(db Database) ([]txn.Op, error)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Change represents any mgo/txn-representable change to a Database.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            type Channel

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            type Channel struct {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	Track  string `bson:"track,omitempty"`
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	Risk   string `bson:"risk"`
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	Branch string `bson:"branch,omitempty"`

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Channel identifies and describes completely a store channel. TODO (stickupkid): Add architecture.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              type Charm

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              type Charm struct {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              	// contains filtered or unexported fields

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Charm represents the state of a charm in the model.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                func (*Charm) Actions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                func (c *Charm) Actions() *charm.Actions

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Actions returns the actions definition of the charm.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  func (*Charm) BundleSha256

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  func (c *Charm) BundleSha256() string

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    BundleSha256 returns the SHA256 digest of the charm bundle bytes.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    func (*Charm) Config

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    func (c *Charm) Config() *charm.Config

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Config returns the configuration of the charm.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      func (*Charm) Destroy

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      func (c *Charm) Destroy() error

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Destroy sets the charm to Dying and prevents it from being used by applications or units. It only works on local charms, and only when the charm is not referenced by any application.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        func (*Charm) IsPlaceholder

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        func (c *Charm) IsPlaceholder() bool

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          IsPlaceholder returns whether the charm record is just a placeholder rather than representing a deployed charm.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          func (*Charm) IsUploaded

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          func (c *Charm) IsUploaded() bool

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            IsUploaded returns whether the charm has been uploaded to the model storage.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            func (*Charm) LXDProfile

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            func (c *Charm) LXDProfile() *LXDProfile

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              LXDProfile returns the lxd profile definition of the charm.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              func (*Charm) Life

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              func (c *Charm) Life() Life

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Life returns the charm's life state.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                func (*Charm) Macaroon

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                func (c *Charm) Macaroon() (macaroon.Slice, error)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Macaroon return the macaroon that can be used to request data about the charm from the charmstore, or nil if the charm is not private.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  func (*Charm) Meta

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  func (c *Charm) Meta() *charm.Meta

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Meta returns the metadata of the charm.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    func (*Charm) Metrics

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    func (c *Charm) Metrics() *charm.Metrics

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Metrics returns the metrics declared for the charm.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      func (*Charm) Refresh

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      func (c *Charm) Refresh() error

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Refresh loads fresh charm data from the database. In practice, the only observable change should be to its Life value.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        func (*Charm) Remove

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        func (c *Charm) Remove() error

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Remove will delete the charm's stored archive and render the charm inaccessible to future clients. It will fail unless the charm is already Dying (indicating that someone has called Destroy).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          func (*Charm) Revision

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          func (c *Charm) Revision() int

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Revision returns the monotonically increasing charm revision number.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            func (*Charm) StoragePath

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            func (c *Charm) StoragePath() string

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              StoragePath returns the storage path of the charm bundle.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              func (*Charm) String

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              func (c *Charm) String() string

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              func (*Charm) Tag

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              func (c *Charm) Tag() names.Tag

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Tag returns a tag identifying the charm. Implementing state.GlobalEntity interface.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                func (*Charm) URL

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                func (c *Charm) URL() *charm.URL

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  URL returns the URL that identifies the charm.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  func (*Charm) UpdateMacaroon

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  func (c *Charm) UpdateMacaroon(m macaroon.Slice) error

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    UpdateMacaroon updates the stored macaroon for this charm.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    func (*Charm) Version

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    func (c *Charm) Version() string

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Version returns the charm version.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      type CharmInfo

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      type CharmInfo struct {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	Charm       charm.Charm
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	ID          *charm.URL
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	StoragePath string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	SHA256      string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	Macaroon    macaroon.Slice
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      	Version     string

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        CharmInfo contains all the data necessary to store a charm's metadata.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        type CharmOrigin

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        type CharmOrigin struct {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	Source   string   `bson:"source"`
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	ID       string   `bson:"id"`
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	Hash     string   `bson:"hash"`
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	Revision *int     `bson:"revision,omitempty"`
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	Channel  *Channel `bson:"channel,omitempty"`

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          CharmOrigin holds the original source of a charm. Information about where the charm was installed from (charm-hub, charm-store, local) and any additional information we can utilise when making modelling decisions for upgrading or changing.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          type CloudAccessor

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          type CloudAccessor interface {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          	Cloud(cloud string) (cloud.Cloud, error)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          	Clouds() (map[names.CloudTag]cloud.Cloud, error)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          	CloudCredential(tag names.CloudCredentialTag) (Credential, error)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            CloudAccessor defines the methods needed to obtain information about clouds and credentials.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            type CloudContainer

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            type CloudContainer interface {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	// Unit returns the name of the unit for this container.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	Unit() string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	// ProviderId returns the id assigned to the container/pod
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	// by the cloud.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	ProviderId() string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	// Address returns the container address.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	Address() *network.SpaceAddress
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	// Ports returns the open container ports.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            	Ports() []string

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              CloudContainer represents the state of a CAAS container, eg pod.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              type CloudInfo

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              type CloudInfo struct {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              	// Access is the access level the supplied user has on this cloud.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              	Access permission.Access

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                CloudInfo describes interesting information for a given cloud.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                type CloudService

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                type CloudService struct {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                	// contains filtered or unexported fields

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  CloudService is an implementation of CloudService.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  func (*CloudService) Addresses

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  func (c *CloudService) Addresses() network.SpaceAddresses

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Addresses implements CloudServicer.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    func (*CloudService) CloudService

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    func (c *CloudService) CloudService() (*CloudService, error)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      CloudService return the content of cloud service from the underlying state. It returns an error that satisfies errors.IsNotFound if the cloud service has been removed.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      func (*CloudService) DesiredScaleProtected

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      func (c *CloudService) DesiredScaleProtected() bool

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        DesiredScaleProtected implements CloudServicer.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        func (*CloudService) Generation

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        func (c *CloudService) Generation() int64

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Generation implements CloudServicer.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          func (*CloudService) Id

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          func (c *CloudService) Id() string

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Id implements CloudServicer.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            func (*CloudService) ProviderId

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            func (c *CloudService) ProviderId() string

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              ProviderId implements CloudServicer.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              func (*CloudService) Refresh

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              func (c *CloudService) Refresh() error

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Refresh refreshes the content of cloud service from the underlying state. It returns an error that satisfies errors.IsNotFound if the cloud service has been removed.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                func (*CloudService) Watch

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                func (c *CloudService) Watch() NotifyWatcher

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Watch returns a watcher for observing changes to a controller service.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  type CloudServicer

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  type CloudServicer interface {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  	// ProviderId returns the id assigned to the service
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  	// by the cloud.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  	ProviderId() string
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  	// Addresses returns the service addresses.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  	Addresses() network.SpaceAddresses
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  	// Generation returns the service config generation.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  	Generation() int64
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  	// DesiredScaleProtected indicates if current desired scale in application has been applied to the cluster.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  	DesiredScaleProtected() bool

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    CloudServicer represents the state of a CAAS service.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    type CollectionInfo

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    type CollectionInfo struct {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    	// contains filtered or unexported fields

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      collectionInfo describes important features of a collection.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      type CollectionSchema

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      type CollectionSchema map[string]CollectionInfo

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        collectionSchema defines the set of collections used in juju.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        func (CollectionSchema) Create

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        func (schema CollectionSchema) Create(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	db *mgo.Database,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	settings *controller.Config,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ) error

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Create causes all recorded collections to be created and indexed as specified