Documentation ¶
Overview ¶
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.
Index ¶
- Constants
- Variables
- func AddActionPruneSettings(pool *StatePool) error
- func AddBakeryConfig(pool *StatePool) error
- func AddCharmHubToModelConfig(pool *StatePool) error
- func AddCharmOriginToApplications(pool *StatePool) error
- func AddCloudModelCounts(pool *StatePool) error
- func AddControllerLogCollectionsSizeSettings(pool *StatePool) error
- func AddControllerNodeDocs(pool *StatePool) error
- func AddLocalCharmSequences(pool *StatePool) error
- func AddMachineIDToSubordinates(pool *StatePool) error
- func AddMigrationAttempt(pool *StatePool) error
- func AddModelEnvironVersion(pool *StatePool) error
- func AddModelLogsSize(pool *StatePool) error
- func AddModelType(pool *StatePool) error
- func AddNonDetachableStorageMachineId(pool *StatePool) error
- func AddOriginToIPAddresses(pool *StatePool) error
- func AddRelationStatus(pool *StatePool) error
- func AddSpaceIdToSpaceDocs(pool *StatePool) (err error)
- func AddStatusHistoryPruneSettings(pool *StatePool) error
- func AddStorageInstanceConstraints(pool *StatePool) error
- func AddSubnetIdToSubnetDocs(pool *StatePool) (err error)
- func AddUpdateStatusHookSettings(pool *StatePool) error
- func ApplicationInstances(st *State, application string) ([]instance.Id, error)
- func ApplicationMachines(st *State, application string) ([]string, error)
- func Apply(db Database, change Change) error
- func ChangeSubnetAZtoSlice(pool *StatePool) (err error)
- func ChangeSubnetSpaceNameToSpaceID(pool *StatePool) (err error)
- func CheckApplicationExpectsWorkload(m *Model, appName string) (bool, error)
- func ControllerAccess(st *State, tag names.Tag) (permission.UserAccess, error)
- func ConvertAddressSpaceIDs(pool *StatePool) error
- func CorrectRelationUnitCounts(pool *StatePool) error
- func CreateMissingApplicationConfig(pool *StatePool) error
- func DefaultEndpointBindingsForCharm(st EndpointBinding, charmMeta *charm.Meta) (map[string]string, error)
- func DeleteCloudImageMetadata(pool *StatePool) error
- func DropLeasesCollection(pool *StatePool) error
- func DropPresenceDatabase(pool *StatePool) error
- func EnsureApplicationDeviceConstraints(pool *StatePool) error
- func EnsureDefaultModificationStatus(pool *StatePool) error
- func EnsureDefaultSpaceSetting(pool *StatePool) error
- func EnsureRelationApplicationSettings(pool *StatePool) error
- func ExposeWildcardEndpointForExposedApplications(pool *StatePool) error
- func FilesystemMountPoint(meta charm.Storage, tag names.StorageTag, series string) (string, error)
- func HostedModelCountOp(amount int) txn.Op
- func IncrementTasksSequence(pool *StatePool) error
- func InitDatabase(session *mgo.Session, modelUUID string, settings *controller.Config) error
- func InitDbLogs(session *mgo.Session) error
- func InitDbLogsForModel(session *mgo.Session, modelUUID string, size int) error
- func IsContainsFilesystem(err error) bool
- func IsMigrationActive(st *State, modelUUID string) (bool, error)
- func LegacyLeases(pool *StatePool, localTime time.Time) (map[corelease.Key]corelease.Info, error)
- func MigrateAddModelPermissions(pool *StatePool) error
- func MigrateLeasesToGlobalTime(pool *StatePool) error
- func MigrateStorageMachineIdFields(pool *StatePool) error
- func MoveMongoSpaceToHASpaceConfig(pool *StatePool) error
- func MoveOldAuditLog(pool *StatePool) error
- func NewApplicationOffers(st *State) crossmodel.ApplicationOffers
- func NewControllerUserAccess(st *State, userDoc userAccessDoc) (permission.UserAccess, error)
- func NewDeviceBackend(st *State) (*deviceBackend, error)
- func NewExternalControllers(st *State) *externalControllers
- func NewFirewallRules(st *State) *firewallRulesState
- func NewModelUserAccess(st *State, userDoc userAccessDoc) (permission.UserAccess, error)
- func NewRelationEgressNetworks(st *State) *relationNetworksState
- func NewRelationIngressNetworks(st *State) *relationNetworksState
- func NewRelationNetworks(st *State) *rootRelationNetworksState
- func NewStorageBackend(st *State) (*storageBackend, error)
- func ParseFilesystemAttachmentId(id string) (names.Tag, names.FilesystemTag, error)
- func ParseVolumeAttachmentId(id string) (names.Tag, names.VolumeTag, error)
- func PruneOperations(stop <-chan struct{}, st *State, maxHistoryTime time.Duration, ...) error
- func PruneStatusHistory(stop <-chan struct{}, st *State, maxHistoryTime time.Duration, ...) error
- func RemoveContainerImageStreamFromNonModelSettings(pool *StatePool) error
- func RemoveControllerConfigMaxLogAgeAndSize(pool *StatePool) error
- func RemoveInstanceCharmProfileDataCollection(pool *StatePool) error
- func RemoveLinkLayerDevicesRefsCollection(pool *StatePool) error
- func RemoveModelBlock(st *State, t BlockType) error
- func RemoveModelBlockOps(st *State, t BlockType) ([]txn.Op, error)
- func RemoveNilValueApplicationSettings(pool *StatePool) error
- func RemoveUnsupportedLinkLayer(pool *StatePool) error
- func RemoveUnusedLinkLayerDeviceProviderIDs(pool *StatePool) error
- func RemoveVotingMachineIds(pool *StatePool) error
- func RenameAddModelPermission(pool *StatePool) error
- func ReplaceNeverSetWithUnset(pool *StatePool) (err error)
- func ReplacePortsDocSubnetIDCIDR(pool *StatePool) (err error)
- func ReplaceSpaceNameWithIDEndpointBindings(pool *StatePool) error
- func ReplicaSetMembers(pool *StatePool) ([]replicaset.Member, error)
- func ResetDefaultRelationLimitInCharmMetadata(pool *StatePool) (err error)
- func RollUpAndConvertOpenedPortDocuments(pool *StatePool) error
- func SetEnableDiskUUIDOnVsphere(pool *StatePool) error
- func SplitLogCollections(pool *StatePool) error
- func StripLocalUserDomain(pool *StatePool) error
- func TagFromDocID(docID string) names.Tag
- func TranslateK8sServiceTypes(pool *StatePool) error
- func UpdateInheritedControllerConfig(pool *StatePool) error
- func UpdateK8sModelNameIndex(pool *StatePool) error
- func UpdateKubernetesStorageConfig(pool *StatePool) error
- func UpdateLegacyKubernetesCloudCredentials(st *State) error
- func UpdateLegacyLXDCloudCredentials(st *State, endpoint string, credential cloud.Credential) error
- func UpgradeContainerImageStreamDefault(pool *StatePool) error
- func UpgradeNoProxyDefaults(pool *StatePool) error
- type Action
- type ActionMessage
- type ActionReceiver
- type ActionResults
- type ActionSpecsByName
- type ActionStatus
- type ActionsWatcher
- type AddApplicationArgs
- type AddOfferConnectionParams
- type AddRemoteApplicationParams
- type AddUnitOperation
- type AddUnitParams
- type Address
- func (addr *Address) ConfigMethod() network.AddressConfigMethod
- func (addr *Address) DNSSearchDomains() []string
- func (addr *Address) DNSServers() []string
- func (addr *Address) Device() (*LinkLayerDevice, error)
- func (addr *Address) DeviceName() string
- func (addr *Address) DocID() string
- func (addr *Address) GatewayAddress() string
- func (addr *Address) IsDefaultGateway() bool
- func (addr *Address) IsSecondary() bool
- func (addr *Address) IsShadow() bool
- func (addr *Address) LoopbackConfigMethod() bool
- func (addr *Address) Machine() (*Machine, error)
- func (addr *Address) MachineID() string
- func (addr *Address) NetworkAddress() network.SpaceAddress
- func (addr *Address) Origin() network.Origin
- func (addr *Address) ProviderID() network.Id
- func (addr *Address) ProviderNetworkID() network.Id
- func (addr *Address) ProviderSubnetID() network.Id
- func (addr *Address) Remove() error
- func (addr *Address) RemoveOps() []txn.Op
- func (addr *Address) SetOriginOps(origin network.Origin) []txn.Op
- func (addr *Address) SetProviderIDOps(id network.Id) ([]txn.Op, error)
- func (addr *Address) SetProviderNetIDsOps(networkID, subnetID network.Id) []txn.Op
- func (addr *Address) String() string
- func (addr *Address) Subnet() (*Subnet, error)
- func (addr *Address) SubnetCIDR() string
- func (addr *Address) UpdateOps(args LinkLayerDeviceAddress) ([]txn.Op, error)
- func (addr *Address) Value() string
- type AgentEntity
- type AgentLiving
- type AgentTooler
- type AllWatcherBacking
- type Application
- func (a *Application) AddOperation(props UnitUpdateProperties) *AddUnitOperation
- func (a *Application) AddUnit(args AddUnitParams) (unit *Unit, err error)
- func (a *Application) AgentTools() (*tools.Tools, error)
- func (a *Application) AllUnits() (units []*Unit, err error)
- func (a *Application) ApplicationConfig() (application.ConfigAttributes, error)
- func (a *Application) ApplicationTag() names.ApplicationTag
- func (a *Application) ChangeScale(scaleChange int) (int, error)
- func (a *Application) Channel() csparams.Channel
- func (a *Application) Charm() (ch *Charm, force bool, err error)
- func (a *Application) CharmConfig(branchName string) (charm.Settings, error)
- func (a *Application) CharmModifiedVersion() int
- func (a *Application) CharmOrigin() *CharmOrigin
- func (a *Application) CharmURL() (curl *charm.URL, force bool)
- func (a *Application) ClearExposed() error
- func (a *Application) ClearResources() error
- func (a *Application) Constraints() (constraints.Value, error)
- func (a *Application) DeployedMachines() ([]*Machine, error)
- func (a *Application) Destroy() (err error)
- func (a *Application) DestroyOperation() *DestroyApplicationOperation
- func (a *Application) DeviceConstraints() (map[string]DeviceConstraints, error)
- func (a *Application) Endpoint(relationName string) (Endpoint, error)
- func (a *Application) EndpointBindings() (*Bindings, error)
- func (a *Application) Endpoints() (eps []Endpoint, err error)
- func (a *Application) EnsureMinUnits() (err error)
- func (a *Application) ExposedEndpoints() map[string]ExposedEndpoint
- func (a *Application) GetPlacement() string
- func (a *Application) GetScale() int
- func (a *Application) IsExposed() bool
- func (a *Application) IsPrincipal() bool
- func (a *Application) IsRemote() bool
- func (a *Application) LeaderSettings() (map[string]string, error)
- func (a *Application) Life() Life
- func (a *Application) MergeBindings(operatorBindings *Bindings, force bool) error
- func (a *Application) MergeExposeSettings(exposedEndpoints map[string]ExposedEndpoint) error
- func (a *Application) MetricCredentials() []byte
- func (a *Application) MinUnits() int
- func (a *Application) Name() string
- func (a *Application) PasswordValid(password string) bool
- func (a *Application) Refresh() error
- func (a *Application) RelationCount() int
- func (a *Application) Relations() (relations []*Relation, err error)
- func (a *Application) Series() string
- func (a *Application) ServiceInfo() (CloudServicer, error)
- func (a *Application) SetAgentVersion(v version.Binary) (err error)
- func (a *Application) SetCharm(cfg SetCharmConfig) (err error)
- func (a *Application) SetConstraints(cons constraints.Value) (err error)
- func (a *Application) SetMetricCredentials(b []byte) error
- func (a *Application) SetMinUnits(minUnits int) (err error)
- func (a *Application) SetOperatorStatus(sInfo status.StatusInfo) error
- func (a *Application) SetPassword(password string) error
- func (a *Application) SetScale(scale int, generation int64, force bool) error
- func (a *Application) SetStatus(statusInfo status.StatusInfo) error
- func (a *Application) Status() (status.StatusInfo, error)
- func (a *Application) StatusHistory(filter status.StatusHistoryFilter) ([]status.StatusInfo, error)
- func (a *Application) StorageConstraints() (map[string]StorageConstraints, error)
- func (a *Application) String() string
- func (a *Application) Tag() names.Tag
- func (a *Application) UnitCount() int
- func (a *Application) UnitNames() ([]string, error)
- func (a *Application) UnitStatuses() (map[string]status.StatusInfo, error)
- func (a *Application) UnsetExposeSettings(exposedEndpoints []string) error
- func (a *Application) UpdateApplicationConfig(changes application.ConfigAttributes, reset []string, ...) error
- func (a *Application) UpdateApplicationSeries(series string, force bool) (err error)
- func (a *Application) UpdateCharmConfig(branchName string, changes charm.Settings) error
- func (a *Application) UpdateCloudService(providerId string, addresses []network.SpaceAddress) error
- func (a *Application) UpdateLeaderSettings(token leadership.Token, updates map[string]string) error
- func (a *Application) UpdateUnits(unitsOp *UpdateUnitsOperation) error
- func (a *Application) VerifySupportedSeries(series string, force bool) error
- func (a *Application) Watch() NotifyWatcher
- func (a *Application) WatchCharmConfig() (NotifyWatcher, error)
- func (a *Application) WatchLeaderSettings() NotifyWatcher
- func (a *Application) WatchRelations() StringsWatcher
- func (a *Application) WatchScale() NotifyWatcher
- func (a *Application) WatchServiceAddressesHash() StringsWatcher
- func (a *Application) WatchUnits() StringsWatcher
- type ApplicationDescription
- type ApplicationEntity
- type ApplicationOfferDescription
- type ApplicationOfferInput
- type ApplicationOfferStateDocumentFactory
- type AssignmentPolicy
- type Authenticator
- type BatchParam
- type Bindings
- func (b Bindings) GetBSON() (interface{}, error)
- func (b *Bindings) Map() map[string]string
- func (b *Bindings) MapWithSpaceNames(lookup network.SpaceInfos) (map[string]string, error)
- func (b *Bindings) Merge(mergeWith map[string]string, meta *charm.Meta) (bool, error)
- func (b *Bindings) SetBSON(raw bson.Raw) error
- type Block
- type BlockDevice
- type BlockDeviceInfo
- type BlockType
- type CAASModel
- func (m *CAASModel) Containers(providerIds ...string) ([]CloudContainer, error)
- func (m *CAASModel) PodSpec(appTag names.ApplicationTag) (string, error)
- func (m *CAASModel) RawK8sSpec(appTag names.ApplicationTag) (string, error)
- func (m *CAASModel) SetPodSpec(token leadership.Token, appTag names.ApplicationTag, spec *string) error
- func (m *CAASModel) SetPodSpecOperation(token leadership.Token, appTag names.ApplicationTag, spec *string) ModelOperation
- func (m *CAASModel) SetRawK8sSpecOperation(token leadership.Token, appTag names.ApplicationTag, spec *string) ModelOperation
- func (m *CAASModel) WatchPodSpec(appTag names.ApplicationTag) (NotifyWatcher, error)
- type Change
- type Channel
- type Charm
- func (c *Charm) Actions() *charm.Actions
- func (c *Charm) BundleSha256() string
- func (c *Charm) Config() *charm.Config
- func (c *Charm) Destroy() error
- func (c *Charm) IsPlaceholder() bool
- func (c *Charm) IsUploaded() bool
- func (c *Charm) LXDProfile() *LXDProfile
- func (c *Charm) Life() Life
- func (c *Charm) Macaroon() (macaroon.Slice, error)
- func (c *Charm) Meta() *charm.Meta
- func (c *Charm) Metrics() *charm.Metrics
- func (c *Charm) Refresh() error
- func (c *Charm) Remove() error
- func (c *Charm) Revision() int
- func (c *Charm) StoragePath() string
- func (c *Charm) String() string
- func (c *Charm) Tag() names.Tag
- func (c *Charm) URL() *charm.URL
- func (c *Charm) UpdateMacaroon(m macaroon.Slice) error
- func (c *Charm) Version() string
- type CharmInfo
- type CharmOrigin
- type CloudAccessor
- type CloudContainer
- type CloudInfo
- type CloudService
- func (c *CloudService) Addresses() network.SpaceAddresses
- func (c *CloudService) CloudService() (*CloudService, error)
- func (c *CloudService) DesiredScaleProtected() bool
- func (c *CloudService) Generation() int64
- func (c *CloudService) Id() string
- func (c *CloudService) ProviderId() string
- func (c *CloudService) Refresh() error
- func (c *CloudService) Watch() NotifyWatcher
- type CloudServicer
- type CollectionInfo
- type CollectionSchema
- type Constraints
- type Controller
- func (ctlr *Controller) Close() error
- func (ctlr *Controller) GetState(modelTag names.ModelTag) (*PooledState, error)
- func (ctrl *Controller) Import(model description.Model) (_ *Model, _ *State, err error)
- func (ctlr *Controller) NewModel(args ModelArgs) (_ *Model, _ *State, err error)
- func (ctlr *Controller) Ping() error
- func (ctlr *Controller) StatePool() *StatePool
- func (ctlr *Controller) SystemState() *State
- type ControllerAccessor
- type ControllerInfo
- type ControllerNode
- type ControllerSessioner
- type ControllersChanges
- type Credential
- type CredentialOwnerModelAccess
- type Database
- type DbLogger
- type DebugLogger
- type DestroyApplicationOperation
- type DestroyModelParams
- type DestroyRelationOperation
- type DestroyRemoteApplicationOperation
- type DestroyUnitOperation
- type DeviceConstraints
- type DeviceType
- type DocModelNamespace
- type DockerMetadataStorage
- type Endpoint
- type EndpointBinding
- type EnsureDeader
- type Entity
- type EntityFinder
- type EntityWithApplication
- type ExportConfig
- type ExportStateMigration
- type ExposedEndpoint
- type ExternalController
- type ExternalControllerStateDocumentFactory
- type ExternalControllers
- type ExternalControllersDescription
- type ExternalControllersInput
- type Filesystem
- type FilesystemAttachment
- type FilesystemAttachmentInfo
- type FilesystemAttachmentParams
- type FilesystemInfo
- type FilesystemParams
- type FirewallRule
- type FirewallRuler
- type FirewallRulesDescription
- type FirewallRulesInput
- type ForcedOperation
- type Generation
- func (g *Generation) Abort(userName string) error
- func (g *Generation) AssignAllUnits(appName string) error
- func (g *Generation) AssignApplication(appName string) error
- func (g *Generation) AssignUnit(unitName string) error
- func (g *Generation) AssignUnits(appName string, numUnits int) error
- func (g *Generation) AssignedUnits() map[string][]string
- func (g *Generation) BranchName() string
- func (g *Generation) CheckNotComplete() error
- func (g *Generation) Commit(userName string) (int, error)
- func (g *Generation) Completed() int64
- func (g *Generation) CompletedBy() string
- func (g *Generation) Config() map[string]settings.ItemChanges
- func (g *Generation) Created() int64
- func (g *Generation) CreatedBy() string
- func (g *Generation) GenerationId() int
- func (g *Generation) HasChangesFor(appName string) bool
- func (g *Generation) IsCompleted() bool
- func (g *Generation) IsTracking(unitName string) bool
- func (g *Generation) ModelUUID() string
- func (g *Generation) Refresh() error
- func (g *Generation) UpdateCharmConfig(appName string, master *Settings, validChanges charm.Settings) error
- type GlobalEntity
- type HistoryGetter
- type HostFilesystemParams
- type HostVolumeParams
- type ImportApplicationOffer
- type ImportExternalControllers
- type ImportFirewallRules
- type ImportRelationNetworks
- type ImportRemoteApplications
- type ImportRemoteEntities
- type ImportStateMigration
- type InitDatabaseFunc
- type InitializeParams
- type InstanceIdGetter
- type LXDProfile
- type LastSentLogTracker
- type LeaveScopeOperation
- type Life
- type Lifer
- type LinkLayerDevice
- func (dev *LinkLayerDevice) AddAddressOps(args LinkLayerDeviceAddress) ([]txn.Op, error)
- func (dev *LinkLayerDevice) Addresses() ([]*Address, error)
- func (dev *LinkLayerDevice) DocID() string
- func (dev *LinkLayerDevice) EthernetDeviceForBridge(name string, askProviderForAddress bool) (network.InterfaceInfo, error)
- func (dev *LinkLayerDevice) ID() string
- func (dev *LinkLayerDevice) IsAutoStart() bool
- func (dev *LinkLayerDevice) IsLoopbackDevice() bool
- func (dev *LinkLayerDevice) IsUp() bool
- func (dev *LinkLayerDevice) MACAddress() string
- func (dev *LinkLayerDevice) MTU() uint
- func (dev *LinkLayerDevice) Machine() (*Machine, error)
- func (dev *LinkLayerDevice) MachineID() string
- func (dev *LinkLayerDevice) Name() string
- func (dev *LinkLayerDevice) ParentDevice() (*LinkLayerDevice, error)
- func (dev *LinkLayerDevice) ParentID() string
- func (dev *LinkLayerDevice) ParentName() string
- func (dev *LinkLayerDevice) ProviderID() network.Id
- func (dev *LinkLayerDevice) Remove() (err error)
- func (dev *LinkLayerDevice) RemoveAddresses() error
- func (dev *LinkLayerDevice) RemoveOps() []txn.Op
- func (dev *LinkLayerDevice) SetProviderIDOps(id network.Id) ([]txn.Op, error)
- func (dev *LinkLayerDevice) String() string
- func (dev *LinkLayerDevice) Type() network.LinkLayerDeviceType
- func (dev *LinkLayerDevice) UpdateOps(args LinkLayerDeviceArgs) []txn.Op
- func (dev *LinkLayerDevice) VirtualPortType() network.VirtualPortType
- type LinkLayerDeviceAddress
- type LinkLayerDeviceArgs
- type Living
- type LogRecord
- type LogTailer
- type LogTailerParams
- type LogTailerState
- type MacaroonCache
- type MacaroonCacheState
- type Machine
- func (m *Machine) Actions() ([]Action, error)
- func (m *Machine) AddAction(operationID, name string, payload map[string]interface{}, parallel *bool, ...) (Action, error)
- func (m *Machine) AddLinkLayerDeviceOps(devArgs LinkLayerDeviceArgs, addrArgs ...LinkLayerDeviceAddress) ([]txn.Op, error)
- func (m *Machine) Addresses() (addresses network.SpaceAddresses)
- func (m *Machine) AddressesBySpaceID() (map[string][]network.SpaceAddress, error)
- func (m *Machine) AgentStartTime() time.Time
- func (m *Machine) AgentTools() (*tools.Tools, error)
- func (m *Machine) AllAddresses() ([]*Address, error)
- func (m *Machine) AllLinkLayerDevices() ([]*LinkLayerDevice, error)
- func (m *Machine) AllNetworkAddresses() (corenetwork.SpaceAddresses, error)
- func (m *Machine) AllProviderInterfaceInfos() ([]corenetwork.ProviderInterfaceInfo, error)
- func (m *Machine) AllSpaces() (set.Strings, error)
- func (m *Machine) ApplicationNames() ([]string, error)
- func (m *Machine) AssertAliveOp() txn.Op
- func (m *Machine) AvailabilityZone() (string, error)
- func (m *Machine) CancelAction(action Action) (Action, error)
- func (m *Machine) CharmProfiles() ([]string, error)
- func (m *Machine) CheckProvisioned(nonce string) bool
- func (m *Machine) Clean() bool
- func (m *Machine) CompleteUpgradeSeries() error
- func (m *Machine) CompletedActions() ([]Action, error)
- func (m *Machine) Constraints() (constraints.Value, error)
- func (m *Machine) ContainerType() instance.ContainerType
- func (m *Machine) Containers() ([]string, error)
- func (m *Machine) CreateUpgradeSeriesLock(unitNames []string, toSeries string) error
- func (m *Machine) Destroy() error
- func (m *Machine) DestroyWithContainers() error
- func (m *Machine) EnsureDead() error
- func (m *Machine) ForceDestroy(maxWait time.Duration) error
- func (m *Machine) ForceDestroyed() bool
- func (m *Machine) GetRebootFlag() (bool, error)
- func (m *Machine) GetUpgradeSeriesMessages() ([]string, bool, error)
- func (m *Machine) HardwareCharacteristics() (*instance.HardwareCharacteristics, error)
- func (m *Machine) Hostname() string
- func (m *Machine) Id() string
- func (m *Machine) InstanceId() (instance.Id, error)
- func (m *Machine) InstanceNames() (instance.Id, string, error)
- func (m *Machine) InstanceStatus() (status.StatusInfo, error)
- func (m *Machine) InstanceStatusHistory(filter status.StatusHistoryFilter) ([]status.StatusInfo, error)
- func (m *Machine) IsContainer() bool
- func (m *Machine) IsLockedForSeriesUpgrade() (bool, error)
- func (m *Machine) IsManager() bool
- func (m *Machine) IsManual() (bool, error)
- func (m *Machine) IsParentLockedForSeriesUpgrade() (bool, error)
- func (m *Machine) Jobs() []MachineJob
- func (m *Machine) KeepInstance() (bool, error)
- func (m *Machine) Life() Life
- func (m *Machine) LinkLayerDevice(name string) (*LinkLayerDevice, error)
- func (m *Machine) MachineAddresses() (addresses network.SpaceAddresses)
- func (m *Machine) MachineTag() names.MachineTag
- func (m *Machine) MarkForRemoval() (err error)
- func (m *Machine) ModelName() string
- func (m *Machine) ModificationStatus() (status.StatusInfo, error)
- func (m *Machine) OpenedPortRanges() (MachinePortRanges, error)
- func (m *Machine) ParentId() (string, bool)
- func (m *Machine) PasswordValid(password string) bool
- func (m *Machine) PendingActions() ([]Action, error)
- func (m *Machine) Placement() string
- func (m *Machine) Principals() []string
- func (m *Machine) PrivateAddress() (network.SpaceAddress, error)
- func (m *Machine) ProviderAddresses() (addresses network.SpaceAddresses)
- func (m *Machine) PublicAddress() (network.SpaceAddress, error)
- func (m *Machine) RecordAgentStartInformation(hostname string) error
- func (m *Machine) Refresh() error
- func (m *Machine) Remove() (err error)
- func (m *Machine) RemoveAllAddresses() error
- func (m *Machine) RemoveAllLinkLayerDevices() error
- func (m *Machine) RemoveUpgradeSeriesLock() error
- func (m *Machine) RunningActions() ([]Action, error)
- func (m *Machine) Series() string
- func (m *Machine) SetAgentVersion(v version.Binary) (err error)
- func (m *Machine) SetCharmProfiles(profiles []string) error
- func (m *Machine) SetConstraints(cons constraints.Value) (err error)
- func (m *Machine) SetDevicesAddresses(devicesAddresses ...LinkLayerDeviceAddress) (err error)
- func (m *Machine) SetInstanceInfo(id instance.Id, displayName string, nonce string, ...) error
- func (m *Machine) SetInstanceStatus(sInfo status.StatusInfo) (err error)
- func (m *Machine) SetKeepInstance(keepInstance bool) error
- func (m *Machine) SetLinkLayerDevices(devicesArgs ...LinkLayerDeviceArgs) (err error)deprecated
- func (m *Machine) SetMachineAddresses(addresses ...network.SpaceAddress) error
- func (m *Machine) SetMachineBlockDevices(info ...BlockDeviceInfo) error
- func (m *Machine) SetModificationStatus(sInfo status.StatusInfo) (err error)
- func (m *Machine) SetMongoPassword(password string) error
- func (m *Machine) SetPassword(password string) error
- func (m *Machine) SetProviderAddresses(addresses ...network.SpaceAddress) error
- func (m *Machine) SetProvisioned(id instance.Id, displayName string, nonce string, ...) (err error)
- func (m *Machine) SetRebootFlag(flag bool) error
- func (m *Machine) SetStatus(statusInfo status.StatusInfo) error
- func (m *Machine) SetSupportedContainers(containers []instance.ContainerType) (err error)
- func (m *Machine) SetUpgradeSeriesMessagesAsSeen(messages []UpgradeSeriesMessage) error
- func (m *Machine) SetUpgradeSeriesStatus(status model.UpgradeSeriesStatus, message string) error
- func (m *Machine) SetUpgradeSeriesUnitStatus(unitName string, status model.UpgradeSeriesStatus, message string) error
- func (m *Machine) ShouldRebootOrShutdown() (RebootAction, error)
- func (m *Machine) StartUpgradeSeriesUnitCompletion(message string) error
- func (m *Machine) Status() (status.StatusInfo, error)
- func (m *Machine) StatusHistory(filter status.StatusHistoryFilter) ([]status.StatusInfo, error)
- func (m *Machine) String() string
- func (m *Machine) SupportedContainers() ([]instance.ContainerType, bool)
- func (m *Machine) SupportsNoContainers() (err error)
- func (m *Machine) Tag() names.Tag
- func (m *Machine) Units() (units []*Unit, err error)
- func (m *Machine) UpdateMachineSeries(series string) error
- func (m *Machine) UpdateOperation() *UpdateMachineOperation
- func (m *Machine) UpgradeSeriesStatus() (model.UpgradeSeriesStatus, error)
- func (m *Machine) UpgradeSeriesTarget() (string, error)
- func (m *Machine) UpgradeSeriesUnitStatus(unitName string) (model.UpgradeSeriesStatus, error)
- func (m *Machine) UpgradeSeriesUnitStatuses() (map[string]UpgradeSeriesUnitStatus, error)
- func (m *Machine) VolumeAttachments() ([]VolumeAttachment, error)
- func (m *Machine) Watch() NotifyWatcher
- func (m *Machine) WatchActionNotifications() StringsWatcher
- func (m *Machine) WatchAddresses() NotifyWatcher
- func (m *Machine) WatchAllContainers() StringsWatcher
- func (m *Machine) WatchContainers(ctype instance.ContainerType) StringsWatcher
- func (m *Machine) WatchForRebootEvent() NotifyWatcher
- func (m *Machine) WatchInstanceData() NotifyWatcher
- func (m *Machine) WatchLXDProfileUpgradeNotifications(applicationName string) (StringsWatcher, error)
- func (m *Machine) WatchPendingActionNotifications() StringsWatcher
- func (m *Machine) WatchPrincipalUnits() StringsWatcher
- func (m *Machine) WatchUnits() StringsWatcher
- func (m *Machine) WatchUpgradeSeriesNotifications() (NotifyWatcher, error)
- type MachineJob
- type MachineModelInfo
- type MachinePortRanges
- type MachineTemplate
- type MeterStatus
- type MeterStatusCode
- type Metric
- type MetricBatch
- func (m *MetricBatch) CharmURL() string
- func (m *MetricBatch) Created() time.Time
- func (m *MetricBatch) Credentials() []byte
- func (m *MetricBatch) MarshalJSON() ([]byte, error)
- func (m *MetricBatch) Metrics() []Metric
- func (m *MetricBatch) ModelUUID() string
- func (m *MetricBatch) SLACredentials() []byte
- func (m *MetricBatch) Sent() bool
- func (m *MetricBatch) SetSent(t time.Time) error
- func (m *MetricBatch) UUID() string
- func (m *MetricBatch) UniqueMetrics() []Metric
- func (m *MetricBatch) Unit() string
- type MetricsManager
- func (m *MetricsManager) ConsecutiveErrors() int
- func (m *MetricsManager) GracePeriod() time.Duration
- func (m *MetricsManager) IncrementConsecutiveErrors() error
- func (m *MetricsManager) LastSuccessfulSend() time.Time
- func (m *MetricsManager) MeterStatus() MeterStatus
- func (m *MetricsManager) ModelStatus() MeterStatus
- func (m *MetricsManager) SetGracePeriod(t time.Duration) error
- func (m *MetricsManager) SetLastSuccessfulSend(t time.Time) error
- type MigrationMode
- type MigrationSpec
- type MinionReports
- type Model
- func (m *Model) Action(id string) (Action, error)
- func (m *Model) ActionByTag(tag names.ActionTag) (Action, error)
- func (m *Model) AddBranch(branchName, userName string) error
- func (m *Model) AddUser(spec UserAccessSpec) (permission.UserAccess, error)
- func (m *Model) AgentVersion() (version.Number, error)
- func (m *Model) AllActions() ([]Action, error)
- func (m *Model) AllConstraints() (*ModelConstraints, error)
- func (m *Model) AllEndpointBindings() (map[string]*Bindings, error)
- func (m *Model) AllInstanceData() (*ModelInstanceData, error)
- func (m *Model) AllOperations() ([]Operation, error)
- func (m *Model) AllUnits() ([]*Unit, error)
- func (m *Model) Annotation(entity GlobalEntity, key string) (string, error)
- func (m *Model) Annotations(entity GlobalEntity) (map[string]string, error)
- func (m *Model) AutoConfigureContainerNetworking(environ environs.BootstrapEnviron) error
- func (m *Model) Branch(name string) (*Generation, error)
- func (m *Model) Branches() ([]*Generation, error)
- func (m *Model) CAASModel() (*CAASModel, error)
- func (m *Model) Cloud() (jujucloud.Cloud, error)
- func (m *Model) CloudCredential() (Credential, bool, error)
- func (m *Model) CloudCredentialTag() (names.CloudCredentialTag, bool)
- func (m *Model) CloudName() string
- func (m *Model) CloudRegion() string
- func (m *Model) Config() (*config.Config, error)
- func (m *Model) ControllerTag() names.ControllerTag
- func (m *Model) ControllerUUID() string
- func (m *Model) Destroy(args DestroyModelParams) (err error)
- func (m *Model) EnqueueAction(operationID string, receiver names.Tag, actionName string, ...) (Action, error)
- func (m *Model) EnqueueOperation(summary string) (string, error)
- func (m *Model) EnvironVersion() int
- func (m *Model) FindActionsByName(name string) ([]Action, error)
- func (m *Model) ForceDestroyed() bool
- func (m *Model) Generation(id int) (*Generation, error)
- func (m *Model) Generations() ([]*Generation, error)
- func (m *Model) IsControllerModel() bool
- func (m *Model) LastModelConnection(user names.UserTag) (time.Time, error)
- func (m *Model) LatestToolsVersion() version.Number
- func (m *Model) Life() Life
- func (m *Model) ListOperations(actionNames []string, actionReceivers []names.Tag, ...) ([]OperationInfo, bool, error)
- func (m *Model) LoadModelStatus() (*ModelStatus, error)
- func (m *Model) MeterStatus() MeterStatus
- func (m *Model) MigrationMode() MigrationMode
- func (m *Model) ModelConfig() (*config.Config, error)
- func (model *Model) ModelConfigValues() (config.ConfigValues, error)
- func (m *Model) ModelTag() names.ModelTag
- func (m *Model) Name() string
- func (m *Model) OpenedPortRangesForAllMachines() ([]MachinePortRanges, error)
- func (m *Model) OpenedPortRangesForMachine(machineID string) (MachinePortRanges, error)
- func (m *Model) Operation(id string) (Operation, error)
- func (m *Model) OperationWithActions(id string) (*OperationInfo, error)
- func (m *Model) Owner() names.UserTag
- func (m *Model) PasswordHash() string
- func (m *Model) PasswordValid(password string) bool
- func (m *Model) Refresh() error
- func (m *Model) SLACredential() []byte
- func (m *Model) SLALevel() string
- func (m *Model) SLAOwner() string
- func (m *Model) SetAnnotations(entity GlobalEntity, annotations map[string]string) (err error)
- func (m *Model) SetCloudCredential(tag names.CloudCredentialTag) (bool, error)
- func (m *Model) SetEnvironVersion(v int) error
- func (m *Model) SetMeterStatus(status, info string) error
- func (m *Model) SetMigrationMode(mode MigrationMode) error
- func (m *Model) SetPassword(password string) error
- func (m *Model) SetSLA(level, owner string, credentials []byte) error
- func (m *Model) SetStatus(sInfo status.StatusInfo) error
- func (model *Model) State() *State
- func (m *Model) Status() (status.StatusInfo, error)
- func (m *Model) StatusHistory(filter status.StatusHistoryFilter) ([]status.StatusInfo, error)
- func (m *Model) String() string
- func (m *Model) Tag() names.Tag
- func (m *Model) Type() ModelType
- func (m *Model) UUID() string
- func (m *Model) UpdateLastModelConnection(user names.UserTag) error
- func (m *Model) UpdateLatestToolsVersion(ver version.Number) error
- func (m *Model) UpdateModelConfig(updateAttrs map[string]interface{}, removeAttrs []string, ...) error
- func (m *Model) Users() ([]permission.UserAccess, error)
- func (m *Model) ValidateCloudCredential(tag names.CloudCredentialTag, credential cloud.Credential) error
- func (m *Model) Watch() NotifyWatcher
- func (m *Model) WatchActionResults() StringsWatcher
- func (m *Model) WatchActionResultsFilteredBy(receivers ...ActionReceiver) StringsWatcher
- func (model *Model) WatchCloudSpecChanges() NotifyWatcher
- func (model *Model) WatchForModelConfigChanges() NotifyWatcher
- func (m *Model) WatchModelCredential() NotifyWatcher
- type ModelAccessInfo
- type ModelAccessor
- type ModelArgs
- type ModelBatchParam
- type ModelConstraints
- type ModelInstanceData
- type ModelMachinesWatcher
- type ModelMigration
- type ModelOperation
- type ModelPayloads
- type ModelSessioner
- type ModelStatus
- func (m *ModelStatus) FullUnitWorkloadVersion(unitName string) (status.StatusInfo, error)
- func (m *ModelStatus) MachineAgent(machineID string) (status.StatusInfo, error)
- func (m *ModelStatus) MachineInstance(machineID string) (status.StatusInfo, error)
- func (m *ModelStatus) MachineModification(machineID string) (status.StatusInfo, error)
- func (m *ModelStatus) Model() (status.StatusInfo, error)
- func (m *ModelStatus) UnitAgent(unitName string) (status.StatusInfo, error)
- func (m *ModelStatus) UnitWorkload(unitName string, expectWorkload bool) (status.StatusInfo, error)
- func (m *ModelStatus) UnitWorkloadVersion(unitName string) (string, error)
- type ModelSummary
- type ModelType
- type MongoSessioner
- type NewPolicyFunc
- type NotifyWatcher
- type NotifyWatcherFactory
- type OfferConnection
- type OpenParams
- type Operation
- type OperationInfo
- type Persistence
- type Platform
- type Policy
- type PoolHelper
- type PoolItem
- type PooledState
- type QueryDetails
- type QueryTracker
- type RebootAction
- type RebootActionGetter
- type RebootFlagSetter
- type Relation
- func (r *Relation) AllRemoteUnits(appName string) ([]*RelationUnit, error)
- func (r *Relation) ApplicationSettings(appName string) (map[string]interface{}, error)
- func (r *Relation) Destroy() error
- func (r *Relation) DestroyOperation(force bool) *DestroyRelationOperation
- func (r *Relation) DestroyWithForce(force bool, maxWait time.Duration) ([]error, error)
- func (r *Relation) Endpoint(applicationname string) (Endpoint, error)
- func (r *Relation) Endpoints() []Endpoint
- func (r *Relation) Id() int
- func (r *Relation) Life() Life
- func (r *Relation) Refresh() error
- func (r *Relation) RelatedEndpoints(applicationname string) ([]Endpoint, error)
- func (r *Relation) RemoteApplication() (*RemoteApplication, bool, error)
- func (r *Relation) RemoteUnit(unitName string) (*RelationUnit, error)
- func (r *Relation) SetStatus(statusInfo status.StatusInfo) error
- func (r *Relation) SetSuspended(suspended bool, suspendedReason string) error
- func (r *Relation) Status() (status.StatusInfo, error)
- func (r *Relation) String() string
- func (r *Relation) Suspended() bool
- func (r *Relation) SuspendedReason() string
- func (r *Relation) Tag() names.Tag
- func (r *Relation) Unit(u *Unit) (*RelationUnit, error)
- func (r *Relation) UnitCount() int
- func (r *Relation) UpdateApplicationSettings(appName string, token leadership.Token, updates map[string]interface{}) error
- func (r *Relation) UpdateApplicationSettingsOperation(appName string, token leadership.Token, updates map[string]interface{}) (ModelOperation, error)
- func (r *Relation) WatchApplicationSettings(app *Application) (NotifyWatcher, error)
- func (r *Relation) WatchLifeSuspendedStatus() StringsWatcher
- func (r *Relation) WatchRelationEgressNetworks() StringsWatcher
- func (r *Relation) WatchRelationIngressNetworks() StringsWatcher
- func (r *Relation) WatchUnits(appName string) (RelationUnitsWatcher, error)
- type RelationNetworkDirection
- type RelationNetworker
- type RelationNetworks
- type RelationNetworksDescription
- type RelationNetworksInput
- type RelationScopeChange
- type RelationScopeWatcher
- type RelationUnit
- func (ru *RelationUnit) CounterpartApplications() []string
- func (ru *RelationUnit) Endpoint() Endpoint
- func (ru *RelationUnit) EnterScope(settings map[string]interface{}) error
- func (ru *RelationUnit) InScope() (bool, error)
- func (ru *RelationUnit) Joined() (bool, error)
- func (ru *RelationUnit) LeaveScope() error
- func (ru *RelationUnit) LeaveScopeOperation(force bool) *LeaveScopeOperation
- func (ru *RelationUnit) LeaveScopeWithForce(force bool, maxWait time.Duration) ([]error, error)
- func (ru *RelationUnit) PrepareLeaveScope() error
- func (ru *RelationUnit) ReadSettings(uname string) (m map[string]interface{}, err error)
- func (ru *RelationUnit) Relation() *Relation
- func (ru *RelationUnit) Settings() (*Settings, error)
- func (ru *RelationUnit) UnitName() string
- func (ru *RelationUnit) Valid() (bool, error)
- func (ru *RelationUnit) Watch() RelationUnitsWatcher
- func (ru *RelationUnit) WatchScope() *RelationScopeWatcher
- type RelationUnitsWatcher
- type RemoteApplication
- func (s *RemoteApplication) AddEndpoints(eps []charm.Relation) error
- func (s *RemoteApplication) Bindings() map[string]string
- func (s *RemoteApplication) Destroy() error
- func (s *RemoteApplication) DestroyOperation(force bool) *DestroyRemoteApplicationOperation
- func (s *RemoteApplication) DestroyWithForce(force bool, maxWait time.Duration) (opErrs []error, err error)
- func (s *RemoteApplication) Endpoint(relationName string) (Endpoint, error)
- func (s *RemoteApplication) Endpoints() ([]Endpoint, error)
- func (s *RemoteApplication) IsConsumerProxy() bool
- func (s *RemoteApplication) IsRemote() bool
- func (s *RemoteApplication) Life() Life
- func (s *RemoteApplication) Macaroon() (*macaroon.Macaroon, error)
- func (s *RemoteApplication) Name() string
- func (s *RemoteApplication) OfferUUID() string
- func (s *RemoteApplication) Refresh() error
- func (s *RemoteApplication) Relations() (relations []*Relation, err error)
- func (s *RemoteApplication) SetStatus(info status.StatusInfo) error
- func (s *RemoteApplication) SourceModel() names.ModelTag
- func (s *RemoteApplication) SpaceForEndpoint(endpointName string) (RemoteSpace, bool)
- func (s *RemoteApplication) Spaces() []RemoteSpace
- func (s *RemoteApplication) Status() (status.StatusInfo, error)
- func (s *RemoteApplication) String() string
- func (s *RemoteApplication) Tag() names.Tag
- func (s *RemoteApplication) TerminateOperation(message string) ModelOperation
- func (s *RemoteApplication) Token() (string, error)
- func (s *RemoteApplication) URL() (string, bool)
- func (s *RemoteApplication) WatchRelations() StringsWatcher
- type RemoteApplicationsDescription
- type RemoteApplicationsInput
- type RemoteConnectionStatus
- type RemoteEntities
- func (r *RemoteEntities) ExportLocalEntity(entity names.Tag) (string, error)
- func (r *RemoteEntities) GetMacaroon(entity names.Tag) (*macaroon.Macaroon, error)
- func (r *RemoteEntities) GetRemoteEntity(token string) (names.Tag, error)
- func (r *RemoteEntities) GetToken(entity names.Tag) (string, error)
- func (r *RemoteEntities) ImportRemoteEntity(entity names.Tag, token string) error
- func (r *RemoteEntities) RemoveRemoteEntity(entity names.Tag) error
- func (r *RemoteEntities) SaveMacaroon(entity names.Tag, mac *macaroon.Macaroon) error
- type RemoteEntitiesDescription
- type RemoteEntitiesInput
- type RemoteEntity
- type RemoteSpace
- type RemoteSubnet
- type RemoveOfferOperation
- type RemoveUnitOperation
- type Remover
- type ResolvedMode
- type ResourcePersistence
- func (p ResourcePersistence) GetResource(id string) (res resource.Resource, storagePath string, _ error)
- func (p ResourcePersistence) ListPendingResources(applicationID string) ([]resource.Resource, error)
- func (p ResourcePersistence) ListResources(applicationID string) (resource.ApplicationResources, error)
- func (p ResourcePersistence) NewRemovePendingAppResourcesOps(applicationID string, pendingIDs map[string]string) ([]txn.Op, error)
- func (p ResourcePersistence) NewRemoveResourcesOps(applicationID string) ([]txn.Op, error)
- func (p ResourcePersistence) NewRemoveUnitResourcesOps(unitID string) ([]txn.Op, error)
- func (p ResourcePersistence) NewResolvePendingResourceOps(resID, pendingID string) ([]txn.Op, error)
- func (p ResourcePersistence) RemovePendingAppResources(applicationID string, pendingIDs map[string]string) error
- func (p ResourcePersistence) SetCharmStoreResource(id, applicationID string, res charmresource.Resource, lastPolled time.Time) error
- func (p ResourcePersistence) SetResource(res resource.Resource) error
- func (p ResourcePersistence) SetUnitResource(unitID string, res resource.Resource) error
- func (p ResourcePersistence) SetUnitResourceProgress(unitID string, res resource.Resource, progress int64) error
- func (p ResourcePersistence) StageResource(res resource.Resource, storagePath string) (*StagedResource, error)
- type ResourcePersistenceBase
- type Resources
- type ResourcesPersistence
- type RunTransactionObserverFunc
- type SSHHostKeys
- type SaveCloudServiceArgs
- type SessionCloser
- type SetCharmConfig
- type Settings
- func (s *Settings) Delete(key string)
- func (s *Settings) Get(key string) (value interface{}, found bool)
- func (s *Settings) Keys() []string
- func (s *Settings) Map() map[string]interface{}
- func (s *Settings) Read() error
- func (s *Settings) Set(key string, value interface{})
- func (s *Settings) Update(kv map[string]interface{})
- func (s *Settings) Write() (settings.ItemChanges, error)
- func (s *Settings) WriteOperation() ModelOperation
- type Space
- func (s *Space) EnsureDead() (err error)
- func (s *Space) Id() string
- func (s *Space) IsPublic() bool
- func (s *Space) Life() Life
- func (s *Space) Name() string
- func (s *Space) NetworkSpace() (network.SpaceInfo, error)
- func (s *Space) ProviderId() network.Id
- func (s *Space) Refresh() error
- func (s *Space) Remove() (err error)
- func (s *Space) RemoveSpaceOps() []txn.Op
- func (s *Space) RenameSpaceOps(toName string) []txn.Op
- func (s *Space) String() string
- func (s *Space) Subnets() ([]*Subnet, error)
- type StagedResource
- type State
- func (st *State) APIHostPortsForAgents() ([]network.SpaceHostPorts, error)
- func (st *State) APIHostPortsForClients() ([]network.SpaceHostPorts, error)
- func (st *State) AbortCurrentUpgrade() error
- func (st *State) AddApplication(args AddApplicationArgs) (_ *Application, err error)
- func (st *State) AddBranch(branchName, userName string) error
- func (st *State) AddCharm(info CharmInfo) (stch *Charm, err error)
- func (st *State) AddCharmPlaceholder(curl *charm.URL) (err error)
- func (st *State) AddCloud(c cloud.Cloud, owner string) error
- func (st *State) AddControllerNode() (*controllerNode, error)
- func (st *State) AddControllerUser(spec UserAccessSpec) (permission.UserAccess, error)
- func (st *State) AddMachine(series string, jobs ...MachineJob) (*Machine, error)
- func (st *State) AddMachineInsideMachine(template MachineTemplate, parentId string, ...) (*Machine, error)
- func (st *State) AddMachineInsideNewMachine(template, parentTemplate MachineTemplate, containerType instance.ContainerType) (*Machine, error)
- func (st *State) AddMachines(templates ...MachineTemplate) (_ []*Machine, err error)
- func (st *State) AddMetrics(batch BatchParam) (*MetricBatch, error)
- func (st *State) AddModelMetrics(batch ModelBatchParam) (*MetricBatch, error)
- func (st *State) AddOfferConnection(args AddOfferConnectionParams) (_ *OfferConnection, err error)
- func (st *State) AddOneMachine(template MachineTemplate) (*Machine, error)
- func (st *State) AddRelation(eps ...Endpoint) (r *Relation, err error)
- func (st *State) AddRemoteApplication(args AddRemoteApplicationParams) (_ *RemoteApplication, err error)
- func (st *State) AddSpace(name string, providerId network.Id, subnetIDs []string, isPublic bool) (newSpace *Space, err error)
- func (st *State) AddSubnet(args network.SubnetInfo) (subnet *Subnet, err error)
- func (st *State) AddSubnetOps(args network.SubnetInfo) ([]txn.Op, error)
- func (st *State) AddUser(name, displayName, password, creator string) (*User, error)
- func (st *State) AddUserWithSecretKey(name, displayName, creator string) (*User, error)
- func (st *State) Addresses() ([]string, error)
- func (st *State) AllApplications() (applications []*Application, err error)
- func (st *State) AllBlocks() ([]Block, error)
- func (st *State) AllBlocksForController() ([]Block, error)
- func (st *State) AllCharms() ([]*Charm, error)
- func (st *State) AllCloudCredentials(user names.UserTag) ([]Credential, error)
- func (st *State) AllConstraints() ([]*Constraints, error)
- func (st *State) AllEndpointBindingsSpaceNames() (set.Strings, error)
- func (st *State) AllIPAddresses() (addresses []*Address, err error)
- func (st *State) AllLinkLayerDevices() (devices []*LinkLayerDevice, err error)
- func (st *State) AllMachineRemovals() ([]string, error)
- func (st *State) AllMachines() ([]*Machine, error)
- func (st *State) AllMetricBatches() ([]MetricBatch, error)
- func (st *State) AllModelUUIDs() ([]string, error)
- func (st *State) AllModelUUIDsIncludingDead() ([]string, error)
- func (st *State) AllOfferConnections() ([]*OfferConnection, error)
- func (st *State) AllRelations() (relations []*Relation, err error)
- func (st *State) AllRemoteApplications() (applications []*RemoteApplication, err error)
- func (st *State) AllRemoteEntities() ([]RemoteEntity, error)
- func (st *State) AllSpaceInfos() (network.SpaceInfos, error)
- func (st *State) AllSpaces() ([]*Space, error)
- func (st *State) AllSubnetInfos() (network.SubnetInfos, error)
- func (st *State) AllSubnets() (subnets []*Subnet, err error)
- func (st *State) AllUnitAssignments() ([]UnitAssignment, error)
- func (st *State) AllUsers(includeDeactivated bool) ([]*User, error)
- func (st *State) Application(name string) (_ *Application, err error)
- func (st *State) ApplicationLeaders() (map[string]string, error)
- func (st *State) ApplyOperation(op ModelOperation) error
- func (st *State) AssignStagedUnits(ids []string) ([]UnitAssignmentResult, error)
- func (st *State) AssignUnit(u *Unit, policy AssignmentPolicy) (err error)
- func (st *State) AssignUnitWithPlacement(unit *Unit, placement *instance.Placement) error
- func (st *State) AutocertCache() autocert.Cache
- func (st *State) Branch(name string) (*Generation, error)
- func (st *State) Branches() ([]*Generation, error)
- func (st *State) Charm(curl *charm.URL) (*Charm, error)
- func (st *State) Cleanup() (err error)
- func (st *State) CleanupOldMetrics() error
- func (st *State) ClearUpgradeInfo() error
- func (st *State) Close() (err error)
- func (st *State) Cloud(name string) (cloud.Cloud, error)
- func (st *State) CloudCredential(tag names.CloudCredentialTag) (Credential, error)
- func (st *State) CloudCredentials(user names.UserTag, cloudName string) (map[string]Credential, error)
- func (st *State) CloudService(id string) (*CloudService, error)
- func (st *State) Clouds() (map[names.CloudTag]cloud.Cloud, error)
- func (st *State) CloudsForUser(user names.UserTag, all bool) ([]CloudInfo, error)
- func (st *State) CommittedBranch(id int) (*Generation, error)
- func (st *State) CommittedBranches() ([]*Generation, error)
- func (st *State) CompleteMachineRemovals(ids ...string) error
- func (st *State) CompletedMigration() (ModelMigration, error)
- func (st *State) CompletedMigrationForModel(modelUUID string) (ModelMigration, error)
- func (st *State) ComposeNewModelConfig(modelAttr map[string]interface{}, ...) (map[string]interface{}, error)
- func (st *State) ConstraintsBySpaceName(spaceName string) ([]*Constraints, error)
- func (st *State) ControllerConfig() (jujucontroller.Config, error)
- func (st *State) ControllerIds() ([]string, error)
- func (st *State) ControllerInfo() (*ControllerInfo, error)
- func (st *State) ControllerModelTag() names.ModelTag
- func (st *State) ControllerModelUUID() string
- func (st *State) ControllerNode(id string) (ControllerNode, error)
- func (st *State) ControllerNodes() ([]*controllerNode, error)
- func (st *State) ControllerOwner() (names.UserTag, error)
- func (st *State) ControllerTag() names.ControllerTag
- func (st *State) ControllerTimestamp() (*time.Time, error)
- func (st *State) ControllerUUID() string
- func (st *State) ConvertSpaceHostPort(sHP network.SpaceHostPort) (network.ProviderHostPort, error)
- func (st *State) ConvertSpaceHostPorts(sHPs network.SpaceHostPorts) (network.ProviderHostPorts, error)
- func (st *State) CountOfSentMetrics() (int, error)
- func (st *State) CountOfUnsentMetrics() (int, error)
- func (st *State) CreateCloudAccess(cloud string, user names.UserTag, access permission.Access) error
- func (st *State) CreateMigration(spec MigrationSpec) (ModelMigration, error)
- func (st *State) CreateOfferAccess(offer names.ApplicationOfferTag, user names.UserTag, access permission.Access) error
- func (st *State) CredentialModels(tag names.CloudCredentialTag) (map[string]string, error)
- func (st *State) CredentialModelsAndOwnerAccess(tag names.CloudCredentialTag) ([]CredentialOwnerModelAccess, error)
- func (st *State) DashboardSetVersion(vers version.Number) error
- func (st *State) DashboardStorage() (binarystorage.StorageCloser, error)
- func (st *State) DashboardVersion() (vers version.Number, err error)
- func (st *State) DefaultEndpointBindingSpace() (string, error)
- func (st *State) DumpAll() (map[string]interface{}, error)
- func (st *State) EnableHA(numControllers int, cons constraints.Value, series string, placement []string) (ControllersChanges, error)
- func (st *State) EndpointsRelation(endpoints ...Endpoint) (*Relation, error)
- func (st *State) EnsureModelRemoved() error
- func (st *State) EnsureUpgradeInfo(controllerId string, previousVersion, targetVersion version.Number) (*UpgradeInfo, error)
- func (st *State) Export() (description.Model, error)
- func (st *State) ExportPartial(cfg ExportConfig) (description.Model, error)
- func (st *State) ExternalControllerForModel(modelUUID string) (*externalController, error)
- func (st *State) FindEntity(tag names.Tag) (Entity, error)
- func (st *State) GetBlockForType(t BlockType) (Block, bool, error)
- func (st *State) GetCloudAccess(cloud string, user names.UserTag) (permission.Access, error)
- func (st *State) GetCloudUsers(cloud string) (map[string]permission.Access, error)
- func (st *State) GetOfferAccess(offerUUID string, user names.UserTag) (permission.Access, error)
- func (st *State) GetOfferUsers(offerUUID string) (map[string]permission.Access, error)
- func (st *State) GetSSHHostKeys(tag names.MachineTag) (SSHHostKeys, error)
- func (st *State) HAPrimaryMachine() (names.MachineTag, error)
- func (st *State) HasUpgradeSeriesLocks() (bool, error)
- func (st *State) ImageStorage() imagestorage.Storage
- func (st *State) InferEndpoints(names ...string) ([]Endpoint, error)
- func (st *State) InvalidateCloudCredential(tag names.CloudCredentialTag, reason string) error
- func (st *State) InvalidateModelCredential(reason string) error
- func (st *State) IsController() bool
- func (st *State) IsControllerAdmin(user names.UserTag) (bool, error)
- func (st *State) IsMigrationActive() (bool, error)
- func (st *State) IsUpgrading() (bool, error)
- func (st *State) KeyRelation(key string) (*Relation, error)
- func (st *State) LatestMigration() (ModelMigration, error)
- func (st *State) LatestPlaceholderCharm(curl *charm.URL) (*Charm, error)
- func (st *State) LeaseNotifyTarget(logDest io.Writer, errorLogger raftleasestore.Logger) raftlease.NotifyTarget
- func (st *State) LeaseTrapdoorFunc() raftlease.TrapdoorFunc
- func (st *State) LinkLayerDevice(id string) (*LinkLayerDevice, error)
- func (st *State) Machine(id string) (*Machine, error)
- func (st *State) MaybePruneTransactions() error
- func (st *State) MetricBatch(id string) (*MetricBatch, error)
- func (st *State) MetricBatchesForApplication(application string) ([]MetricBatch, error)
- func (st *State) MetricBatchesForModel() ([]MetricBatch, error)
- func (st *State) MetricBatchesForUnit(unit string) ([]MetricBatch, error)
- func (st *State) MetricsManager() (*MetricsManager, error)
- func (st *State) MetricsToSend(batchSize int) ([]*MetricBatch, error)
- func (st *State) Migration(id string) (ModelMigration, error)
- func (st *State) Model() (*Model, error)
- func (st *State) ModelBasicInfoForUser(user names.UserTag) ([]ModelAccessInfo, error)
- func (st *State) ModelConfigDefaultValues(cloudName string) (config.ModelDefaultAttributes, error)
- func (st *State) ModelConstraints() (constraints.Value, error)
- func (st *State) ModelExists(uuid string) (bool, error)
- func (st *State) ModelMeterStatus() (MeterStatus, error)
- func (st *State) ModelPayloads() (ModelPayloads, error)
- func (st *State) ModelSummariesForUser(user names.UserTag, all bool) ([]ModelSummary, error)
- func (st *State) ModelUUID() string
- func (st *State) ModelUUIDsForUser(user names.UserTag) ([]string, error)
- func (st *State) MongoSession() *mgo.Session
- func (st *State) MongoVersion() (string, error)
- func (st *State) NeedsCleanup() (bool, error)
- func (st *State) NewBakeryConfig() bakerystorage.BakeryConfig
- func (st *State) NewBakeryStorage() (bakerystorage.ExpirableStorage, error)
- func (st *State) NewControllerSettings() *StateSettings
- func (st *State) NewSettings() *StateSettings
- func (st *State) OfferConnectionForRelation(relationKey string) (*OfferConnection, error)
- func (st *State) OfferConnections(offerUUID string) ([]*OfferConnection, error)
- func (st *State) OfferConnectionsForUser(username string) ([]*OfferConnection, error)
- func (st *State) Ping() error
- func (st *State) PrepareCharmUpload(curl *charm.URL) (*Charm, error)
- func (st *State) PrepareLocalCharmUpload(curl *charm.URL) (chosenURL *charm.URL, err error)
- func (st *State) ProcessDyingModel() (err error)
- func (st *State) ReadSettings(collection, key string) (*Settings, error)
- func (st *State) Relation(id int) (*Relation, error)
- func (st *State) RemoteApplication(name string) (_ *RemoteApplication, err error)
- func (st *State) RemoteApplicationByToken(token string) (_ *RemoteApplication, err error)
- func (st *State) RemoteConnectionStatus(offerUUID string) (*RemoteConnectionStatus, error)
- func (st *State) RemoteEntities() *RemoteEntities
- func (st *State) RemoveAllBlocksForController() error
- func (st *State) RemoveCloud(name string) error
- func (st *State) RemoveCloudAccess(cloud string, user names.UserTag) error
- func (st *State) RemoveCloudCredential(tag names.CloudCredentialTag) error
- func (st *State) RemoveControllerReference(c controllerReference) error
- func (st *State) RemoveDyingModel() error
- func (st *State) RemoveExportingModelDocs() error
- func (st *State) RemoveImportingModelDocs() error
- func (st *State) RemoveModelsCredential(tag names.CloudCredentialTag) error
- func (st *State) RemoveOfferAccess(offer names.ApplicationOfferTag, user names.UserTag) error
- func (st *State) RemoveUser(tag names.UserTag) error
- func (st *State) RemoveUserAccess(subject names.UserTag, target names.Tag) error
- func (st *State) Report() map[string]interface{}
- func (st *State) ResolveConstraints(cons constraints.Value) (constraints.Value, error)
- func (st *State) Resources() (Resources, error)
- func (st *State) ResourcesPersistence() (ResourcesPersistence, error)
- func (st *State) ResumeTransactions() error
- func (st *State) SLACredential() ([]byte, error)
- func (st *State) SLALevel() (string, error)
- func (st *State) SafeControllerIds() ([]string, error)
- func (st *State) SaveCloudService(args SaveCloudServiceArgs) (_ *CloudService, err error)
- func (st *State) SaveProviderSubnets(subnets []network.SubnetInfo, spaceID string) error
- func (st *State) Sequences() (map[string]int, error)
- func (st *State) SetAPIHostPorts(newHostPorts []network.SpaceHostPorts) error
- func (st *State) SetAdminMongoPassword(password string) error
- func (st *State) SetMetricBatchesSent(batchUUIDs []string) error
- func (st *State) SetModelAgentVersion(newVersion version.Number, ignoreAgentVersions bool) (err error)
- func (st *State) SetModelConstraints(cons constraints.Value) error
- func (st *State) SetModelMeterStatus(status, info string) error
- func (st *State) SetSLA(level, owner string, credentials []byte) error
- func (st *State) SetSSHHostKeys(tag names.MachineTag, keys SSHHostKeys) error
- func (st *State) SetStateServingInfo(info jujucontroller.StateServingInfo) error
- func (st *State) SetUserAccess(subject names.UserTag, target names.Tag, access permission.Access) (permission.UserAccess, error)
- func (st *State) Space(id string) (*Space, error)
- func (st *State) SpaceByName(name string) (*Space, error)
- func (st *State) StartSync()
- func (st *State) StateServingInfo() (jujucontroller.StateServingInfo, error)
- func (st *State) Subnet(id string) (*Subnet, error)
- func (st *State) SubnetByCIDR(cidr string) (*Subnet, error)
- func (st *State) SubnetUpdate(args network.SubnetInfo) error
- func (st *State) SubnetsByCIDR(cidr string) ([]*Subnet, error)
- func (st *State) SwitchBlockOff(t BlockType) error
- func (st *State) SwitchBlockOn(t BlockType, msg string) error
- func (st *State) ToolsStorage() (binarystorage.StorageCloser, error)
- func (s *State) TrackQueries(method string) QueryTracker
- func (st *State) Unit(name string) (*Unit, error)
- func (st *State) UnitPayloads(unit *Unit) (UnitPayloads, error)
- func (st *State) UnitsFor(machineId string) ([]*Unit, error)
- func (st *State) UnitsInError() ([]*Unit, error)
- func (st *State) UpdateCloud(c cloud.Cloud) error
- func (st *State) UpdateCloudAccess(cloud string, user names.UserTag, access permission.Access) error
- func (st *State) UpdateCloudCredential(tag names.CloudCredentialTag, credential cloud.Credential) error
- func (st *State) UpdateControllerConfig(updateAttrs map[string]interface{}, removeAttrs []string) error
- func (st *State) UpdateModelConfigDefaultValues(updateAttrs map[string]interface{}, removeAttrs []string, ...) error
- func (st *State) UpdateOfferAccess(offer names.ApplicationOfferTag, user names.UserTag, access permission.Access) error
- func (st *State) UpdateUploadedCharm(info CharmInfo) (*Charm, error)
- func (st *State) User(tag names.UserTag) (*User, error)
- func (st *State) UserAccess(subject names.UserTag, target names.Tag) (permission.UserAccess, error)
- func (st *State) UserPermission(subject names.UserTag, target names.Tag) (permission.Access, error)
- func (st *State) WatchAPIHostPortsForAgents() NotifyWatcher
- func (st *State) WatchAPIHostPortsForClients() NotifyWatcher
- func (st *State) WatchActionLogs(actionId string) StringsWatcher
- func (st *State) WatchApplications() StringsWatcher
- func (st *State) WatchCleanups() NotifyWatcher
- func (st *State) WatchControllerConfig() NotifyWatcher
- func (st *State) WatchControllerInfo() StringsWatcher
- func (st *State) WatchControllerStatusChanges() StringsWatcher
- func (st *State) WatchCredential(cred names.CloudCredentialTag) NotifyWatcher
- func (st *State) WatchForMigration() NotifyWatcher
- func (st *State) WatchForUnitAssignment() StringsWatcher
- func (st *State) WatchMachineRemovals() NotifyWatcher
- func (st *State) WatchMigrationStatus() NotifyWatcher
- func (st *State) WatchMinUnits() StringsWatcher
- func (st *State) WatchModelEntityReferences(mUUID string) NotifyWatcher
- func (st *State) WatchModelLives() StringsWatcher
- func (st *State) WatchModelMachineStartTimes(quiesceInterval time.Duration) StringsWatcher
- func (st *State) WatchModelMachines() StringsWatcher
- func (st *State) WatchModels() StringsWatcher
- func (st *State) WatchOffer(offerName string) NotifyWatcher
- func (st *State) WatchOfferStatus(offerUUID string) (NotifyWatcher, error)
- func (st *State) WatchOpenedPorts() StringsWatcher
- func (st *State) WatchRemoteApplications() StringsWatcher
- func (st *State) WatchRemoteRelations() StringsWatcher
- func (st *State) WatchSubnets(subnetFilter func(id interface{}) bool) StringsWatcher
- func (st *State) WatchUpgradeInfo() NotifyWatcher
- type StateDocumentFactory
- type StatePool
- func (p *StatePool) Clock() clock.Clock
- func (p *StatePool) Close() error
- func (p *StatePool) Get(modelUUID string) (*PooledState, error)
- func (p *StatePool) GetModel(modelUUID string) (*Model, PoolHelper, error)
- func (p *StatePool) IntrospectionReport() string
- func (p *StatePool) Remove(modelUUID string) (bool, error)
- func (p *StatePool) Report() map[string]interface{}
- func (p *StatePool) StartWorkers(st *State) error
- func (p *StatePool) SystemState() *State
- func (p *StatePool) TxnWatcherStarted() <-chan struct{}
- type StateSettings
- func (s *StateSettings) CreateSettings(key string, settings map[string]interface{}) error
- func (s *StateSettings) DeltaOps(key string, delta settings.ItemChanges) ([]txn.Op, error)
- func (s *StateSettings) ListSettings(keyPrefix string) (map[string]map[string]interface{}, error)
- func (s *StateSettings) ReadSettings(key string) (map[string]interface{}, error)
- func (s *StateSettings) RemoveSettings(key string) error
- func (s *StateSettings) ReplaceSettings(key string, settings map[string]interface{}) error
- type StorageAttachment
- type StorageConstraints
- type StorageInstance
- type StorageKind
- type StringsWatcher
- type Subnet
- func (s *Subnet) AvailabilityZones() []string
- func (s *Subnet) CIDR() string
- func (s *Subnet) EnsureDead() (err error)
- func (s *Subnet) FanLocalUnderlay() string
- func (s *Subnet) FanOverlay() string
- func (s *Subnet) GoString() string
- func (s *Subnet) ID() string
- func (s *Subnet) IsPublic() bool
- func (s *Subnet) Life() Life
- func (s *Subnet) NetworkSubnet() network.SubnetInfo
- func (s *Subnet) ProviderId() network.Id
- func (s *Subnet) ProviderNetworkId() network.Id
- func (s *Subnet) Refresh() error
- func (s *Subnet) Remove() (err error)
- func (s *Subnet) SpaceID() string
- func (s *Subnet) SpaceName() string
- func (s *Subnet) String() string
- func (s *Subnet) Update(args network.SubnetInfo) error
- func (s *Subnet) UpdateSpaceOps(spaceID string) []txn.Op
- func (s *Subnet) VLANTag() int
- type TimeUnit
- type TransactionRunner
- type Unit
- func (u *Unit) ActionSpecs() (ActionSpecsByName, error)
- func (u *Unit) Actions() ([]Action, error)
- func (u *Unit) AddAction(operationID, name string, payload map[string]interface{}, parallel *bool, ...) (Action, error)
- func (u *Unit) Agent() *UnitAgent
- func (u *Unit) AgentHistory() status.StatusHistoryGetter
- func (u *Unit) AgentStatus() (status.StatusInfo, error)
- func (u *Unit) AgentTools() (*tools.Tools, error)
- func (u *Unit) AllAddresses() (addrs network.SpaceAddresses, _ error)
- func (u *Unit) Application() (*Application, error)
- func (u *Unit) ApplicationName() string
- func (u *Unit) AssignToCleanEmptyMachine() (m *Machine, err error)
- func (u *Unit) AssignToCleanMachine() (m *Machine, err error)
- func (u *Unit) AssignToMachine(m *Machine) (err error)
- func (u *Unit) AssignToNewMachine() (err error)
- func (u *Unit) AssignToNewMachineOrContainer() (err error)
- func (u *Unit) AssignedMachineId() (id string, err error)
- func (u *Unit) AvailabilityZone() (string, error)
- func (u *Unit) CancelAction(action Action) (Action, error)
- func (u *Unit) CharmURL() (*charm.URL, bool)
- func (u *Unit) ClearResolved() error
- func (u *Unit) CompletedActions() ([]Action, error)
- func (u *Unit) ConfigSettings() (charm.Settings, error)
- func (u *Unit) Constraints() (*constraints.Value, error)
- func (u *Unit) ContainerInfo() (CloudContainer, error)
- func (u *Unit) Destroy() error
- func (u *Unit) DestroyOperation() *DestroyUnitOperation
- func (u *Unit) DestroyWithForce(force bool, maxWait time.Duration) (errs []error, err error)
- func (u *Unit) EnsureDead() (err error)
- func (u *Unit) GetMeterStatus() (MeterStatus, error)
- func (u *Unit) IsEmbedded() (bool, error)
- func (u *Unit) IsPrincipal() bool
- func (u *Unit) Life() Life
- func (u *Unit) Name() string
- func (u *Unit) OpenedPortRanges() (UnitPortRanges, error)
- func (u *Unit) PasswordValid(password string) bool
- func (u *Unit) PendingActions() ([]Action, error)
- func (u *Unit) PrincipalName() (string, bool)
- func (u *Unit) PrivateAddress() (network.SpaceAddress, error)
- func (u *Unit) PublicAddress() (network.SpaceAddress, error)
- func (u *Unit) Refresh() error
- func (u *Unit) RelationsInScope() ([]*Relation, error)
- func (u *Unit) RelationsJoined() ([]*Relation, error)
- func (u *Unit) Remove() error
- func (u *Unit) RemoveOperation(force bool) *RemoveUnitOperation
- func (u *Unit) RemoveWithForce(force bool, maxWait time.Duration) ([]error, error)
- func (u *Unit) Resolve(retryHooks bool) error
- func (u *Unit) Resolved() ResolvedMode
- func (u *Unit) RunningActions() ([]Action, error)
- func (u *Unit) Series() string
- func (u *Unit) SetAgentStatus(agentStatus status.StatusInfo) error
- func (u *Unit) SetAgentVersion(v version.Binary) (err error)
- func (u *Unit) SetCharmURL(curl *charm.URL) error
- func (u *Unit) SetMeterStatus(codeStr, info string) error
- func (u *Unit) SetPassword(password string) error
- func (u *Unit) SetResolved(mode ResolvedMode) (err error)
- func (u *Unit) SetState(unitState *UnitState, limits UnitStateSizeLimits) error
- func (u *Unit) SetStateOperation(unitState *UnitState, limits UnitStateSizeLimits) ModelOperation
- func (u *Unit) SetStatus(unitStatus status.StatusInfo) error
- func (u *Unit) SetUpgradeSeriesStatus(status model.UpgradeSeriesStatus, message string) error
- func (u *Unit) SetWorkloadVersion(version string) error
- func (u *Unit) ShouldBeAssigned() bool
- func (u *Unit) State() (*UnitState, error)
- func (u *Unit) Status() (status.StatusInfo, error)
- func (u *Unit) StatusHistory(filter status.StatusHistoryFilter) ([]status.StatusInfo, error)
- func (u *Unit) StorageConstraints() (map[string]StorageConstraints, error)
- func (u *Unit) String() string
- func (u *Unit) SubordinateNames() []string
- func (u *Unit) Tag() names.Tag
- func (u *Unit) UnassignFromMachine() (err error)
- func (u *Unit) UnitTag() names.UnitTag
- func (u *Unit) UpdateOperation(props UnitUpdateProperties) *UpdateUnitOperation
- func (u *Unit) UpgradeSeriesStatus() (model.UpgradeSeriesStatus, error)
- func (u *Unit) Watch() NotifyWatcher
- func (u *Unit) WatchActionNotifications() StringsWatcher
- func (u *Unit) WatchApplicationConfigSettings() (NotifyWatcher, error)
- func (u *Unit) WatchApplicationConfigSettingsHash() (StringsWatcher, error)
- func (u *Unit) WatchConfigSettings() (NotifyWatcher, error)
- func (u *Unit) WatchConfigSettingsHash() (StringsWatcher, error)
- func (u *Unit) WatchContainerAddresses() NotifyWatcher
- func (u *Unit) WatchLXDProfileUpgradeNotifications() (StringsWatcher, error)
- func (u *Unit) WatchMachineAndEndpointAddressesHash() (StringsWatcher, error)
- func (u *Unit) WatchMeterStatus() NotifyWatcher
- func (u *Unit) WatchPendingActionNotifications() StringsWatcher
- func (u *Unit) WatchSubordinateUnits() StringsWatcher
- func (u *Unit) WorkloadVersion() (string, error)
- func (u *Unit) WorkloadVersionHistory() *HistoryGetter
- type UnitAgent
- func (u *UnitAgent) SetStatus(unitAgentStatus status.StatusInfo) (err error)
- func (u *UnitAgent) Status() (status.StatusInfo, error)
- func (u *UnitAgent) StatusHistory(filter status.StatusHistoryFilter) ([]status.StatusInfo, error)
- func (u *UnitAgent) String() string
- func (u *UnitAgent) Tag() names.Tag
- type UnitAssignment
- type UnitAssignmentResult
- type UnitPayloads
- type UnitPortRanges
- type UnitState
- func (u *UnitState) CharmState() (map[string]string, bool)
- func (u *UnitState) MeterStatusState() (string, bool)
- func (u *UnitState) Modified() bool
- func (u *UnitState) RelationState() (map[int]string, bool)
- func (u *UnitState) SetCharmState(state map[string]string)
- func (u *UnitState) SetMeterStatusState(state string)
- func (u *UnitState) SetRelationState(state map[int]string)
- func (u *UnitState) SetStorageState(state string)
- func (u *UnitState) SetUniterState(state string)
- func (u *UnitState) StorageState() (string, bool)
- func (u *UnitState) UniterState() (string, bool)
- type UnitStateSizeLimits
- type UnitUpdateProperties
- type UnitsWatcher
- type UpdateMachineOperation
- type UpdateUnitOperation
- type UpdateUnitsOperation
- type UpgradeInfo
- func (info *UpgradeInfo) Abort() error
- func (info *UpgradeInfo) AllProvisionedControllersReady() (bool, error)
- func (info *UpgradeInfo) ControllersDone() []string
- func (info *UpgradeInfo) ControllersReady() []string
- func (info *UpgradeInfo) PreviousVersion() version.Number
- func (info *UpgradeInfo) Refresh() error
- func (info *UpgradeInfo) SetControllerDone(controllerId string) error
- func (info *UpgradeInfo) SetStatus(status UpgradeStatus) error
- func (info *UpgradeInfo) Started() time.Time
- func (info *UpgradeInfo) Status() UpgradeStatus
- func (info *UpgradeInfo) TargetVersion() version.Number
- func (info *UpgradeInfo) Watch() NotifyWatcher
- type UpgradeSeriesMessage
- type UpgradeSeriesUnitStatus
- type UpgradeStatus
- type User
- func (u *User) CreatedBy() string
- func (u *User) DateCreated() time.Time
- func (u *User) Disable() error
- func (u *User) DisplayName() string
- func (u *User) Enable() error
- func (u *User) IsDeleted() bool
- func (u *User) IsDisabled() bool
- func (u *User) LastLogin() (time.Time, error)
- func (u *User) Name() string
- func (u *User) PasswordValid(password string) bool
- func (u *User) Refresh() error
- func (u *User) ResetPassword() ([]byte, error)
- func (u *User) SecretKey() []byte
- func (u *User) SetPassword(password string) error
- func (u *User) SetPasswordHash(pwHash string, pwSalt string) error
- func (u *User) String() string
- func (u *User) Tag() names.Tag
- func (u *User) UpdateLastLogin() (err error)
- func (u *User) UserTag() names.UserTag
- type UserAccessInfo
- type UserAccessSpec
- type ValidateConfigFunc
- type Volume
- type VolumeAttachment
- type VolumeAttachmentInfo
- type VolumeAttachmentParams
- type VolumeAttachmentPlan
- type VolumeAttachmentPlanInfo
- type VolumeInfo
- type VolumeParams
- type WatchParams
- type Watcher
Constants ¶
const ( ModelTypeIAAS = ModelType("iaas") ModelTypeCAAS = ModelType("caas") )
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") )
const ( SLAUnsupported = slaLevel("unsupported") SLAEssential = slaLevel("essential") SLAStandard = slaLevel("standard") SLAAdvanced = slaLevel("advanced") )
const (
CleanupAge = time.Hour * 24
)
const (
// ControllerSettingsGlobalKey is the key for the controller and its settings.
ControllerSettingsGlobalKey = "controllerSettings"
)
const InitialLeaderClaimTime = time.Minute
const MaxDocOps = 2000
MaxDocOps defines the number of documents to put into a single transaction, if we make this number too large, mongo and client side transactions struggle to complete. It is unclear what the optimum is, but without some sort of cap, we've seen txns try to touch 100k docs which makes things fail.
Variables ¶
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 )
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.
var ErrModelNotDying = errors.New("model is not dying")
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.
var ErrNoBackingVolume = errors.New("filesystem has no backing volume")
ErrNoBackingVolume is returned by Filesystem.Volume() for filesystems without a backing volume.
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.
var ErrStateClosed = fmt.Errorf("state has been closed")
ErrStateClosed is returned from watchers if their underlying state connection has been closed.
var ErrSubordinateConstraints = stderrors.New("constraints do not apply to subordinate applications")
var NewBroker caas.NewContainerBrokerFunc = caas.New
NewBroker returns a CAAS broker. Override for testing.
Functions ¶
func AddActionPruneSettings ¶
AddActionPruneSettings adds the model settings to control log pruning if they are missing.
func AddBakeryConfig ¶
AddBakeryConfig adds a bakery config doc to controllers collection if it does not already exist.
func AddCharmHubToModelConfig ¶
AddCharmHubToModelConfig inserts the charmhub-url into the model-config if it's missing one.
func AddCharmOriginToApplications ¶
AddCharmOriginToApplications adds a CharmOrigin to all applications. It will attempt to deduce the source from the charmurl.
func AddCloudModelCounts ¶
AddCloudModelCounts updates cloud docs to ensure the model count field is set.
func AddControllerLogCollectionsSizeSettings ¶
AddControllerLogCollectionsSizeSettings adds the controller settings to control log pruning and txn log size if they are missing.
func AddControllerNodeDocs ¶
AddControllerNodeDocs creates controller nodes for each machine that wants to be a member of the mongo replicaset.
func AddLocalCharmSequences ¶
AddLocalCharmSequences creates any missing sequences in the database for tracking already used local charm revisions.
func AddMachineIDToSubordinates ¶
AddMachineIDToSubordinates ensures that the subordinate units have the machine ID set that matches the principal.
func AddMigrationAttempt ¶
AddMigrationAttempt adds an "attempt" field to migration documents which are missing one.
func AddModelEnvironVersion ¶
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 ¶
AddModelLogsSize to controller config.
func AddModelType ¶
AddModelType adds a "type" field to model documents which don't have one. The "iaas" type is used.
func AddNonDetachableStorageMachineId ¶
AddNonDetachableStorageMachineId sets the "machineid" field on volume and filesystem docs that are inherently bound to that machine.
func AddOriginToIPAddresses ¶
AddOriginToIPAddresses ensures that all ip address have an origin associated with them.
func AddRelationStatus ¶
AddRelationStatus sets the initial status for existing relations without a status.
func AddSpaceIdToSpaceDocs ¶
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 ¶
AddStatusHistoryPruneSettings adds the model settings to control log pruning if they are missing.
func AddStorageInstanceConstraints ¶
AddStorageInstanceConstraints sets the "constraints" field on storage instance docs.
func AddSubnetIdToSubnetDocs ¶
AddSubnetIdToSubnetDocs ensures that every subnet document includes a a sequentially generated ID.
func AddUpdateStatusHookSettings ¶
AddUpdateStatusHookSettings adds the model settings to control how often to run the update-status hook if they are missing.
func ApplicationInstances ¶
ApplicationInstances returns the instance IDs of provisioned machines that are assigned units of the specified application.
func ApplicationMachines ¶
ApplicationMachines returns the machine IDs of machines which have the specified application listed as a principal.
func Apply ¶
Apply runs the supplied Change against the supplied Database. If it returns no error, the change succeeded.
func ChangeSubnetAZtoSlice ¶
ChangeSubnetAZtoSlice changes AvailabilityZone in every subnet document to AvailabilityZones, a slice of strings.
func ChangeSubnetSpaceNameToSpaceID ¶
ChangeSubnetSpaceNameToSpaceID replaces the SpaceName with the SpaceID in a subnet.
func CheckApplicationExpectsWorkload ¶
CheckApplicationExpectsWorkload checks if the application expects workload or not.
func ControllerAccess ¶
func ControllerAccess(st *State, tag names.Tag) (permission.UserAccess, error)
func ConvertAddressSpaceIDs ¶
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 ¶
CorrectRelationUnitCounts ensures that there aren't any rows in relationscopes for applications that shouldn't be there. Fix for https://bugs.launchpad.net/juju/+bug/1699050
func CreateMissingApplicationConfig ¶
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 ¶
DeleteCloudImageMetadata deletes any non-custom cloud image metadata records from the cloudimagemetadata collection.
func DropLeasesCollection ¶
DropLeasesCollection removes the leases collection. Tolerates the collection already not existing.
func DropPresenceDatabase ¶
DropPresenceDatabase removes the legacy presence database.
func EnsureApplicationDeviceConstraints ¶
EnsureApplicationDeviceConstraints ensures that there is a device constraints document for every application.
func EnsureDefaultModificationStatus ¶
EnsureDefaultModificationStatus ensures that there is a modification status document for every machine in the statuses.
func EnsureDefaultSpaceSetting ¶
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 ¶
EnsureRelationApplicationSettings creates an application settings doc for each endpoint in each relation if one doesn't already exist.
func ExposeWildcardEndpointForExposedApplications ¶
ExposeWildcardEndpointForExposedApplications adds an ExposedEndpoint entry for the wildcard endpoint (to 0.0.0.0/0) for already exposed applications. This ensures that all exposed applications are accessible at least one CIDR and allows us to drop the fallback to 0.0.0.0/0 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 IncrementTasksSequence ¶
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 ¶
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 IsMigrationActive ¶
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 LegacyLeases ¶
LegacyLeases returns information about all of the leases in the state-based lease store.
func MigrateAddModelPermissions ¶
MigrateAddModelPermissions converts add-model permissions on the controller to add-model permissions on the controller cloud.
func MigrateLeasesToGlobalTime ¶
MigrateLeasesToGlobalTime removes old (<2.3-beta2) lease/clock-skew documents, replacing the lease documents with new ones for the existing lease holders.
func MigrateStorageMachineIdFields ¶
MigrateStorageMachineIdFields updates the various storage collections to copy any machineid field value across to hostid.
func MoveMongoSpaceToHASpaceConfig ¶
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 ¶
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 ¶
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 ¶
NewStorageBackend creates a backend for managing storage.
func ParseFilesystemAttachmentId ¶
ParseFilesystemAttachmentId parses a string as a filesystem attachment ID, returning the host and filesystem components.
func ParseVolumeAttachmentId ¶
ParseVolumeAttachmentId parses a string as a volume attachment ID, returning the host and volume components.
func PruneOperations ¶
func PruneOperations(stop <-chan struct{}, 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(stop <-chan struct{}, st *State, maxHistoryTime time.Duration, maxHistoryMB int) error
PruneStatusHistory prunes the status history collection.
func RemoveContainerImageStreamFromNonModelSettings ¶
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 ¶
RemoveControllerConfigMaxLogAgeAndSize deletes the controller configuration settings for max-logs-age and max-logs-size if they exist.
func RemoveInstanceCharmProfileDataCollection ¶
RemoveInstanceCharmProfileDataCollection removes the instanceCharmProfileData collection on upgrade.
func RemoveModelBlock ¶
func RemoveNilValueApplicationSettings ¶
RemoveNilValueApplicationSettings removes any application setting key-value pairs from "settings" where value is nil.
func RemoveUnsupportedLinkLayer ¶
RemoveUnsupportedLinkLayer removes link-layer devices and addresses where the EC2 provider added them with the name "unsupported".
func RemoveVotingMachineIds ¶
RemoveVotingMachineIds ensures that the 'votingmachineids' field on controller info has been removed
func RenameAddModelPermission ¶
RenameAddModelPermission renames any permissions called addmodel to add-model.
func ReplaceNeverSetWithUnset ¶
ReplaceNeverSetWithUnset in the status documents.
func ReplacePortsDocSubnetIDCIDR ¶
ReplacePortsDocSubnetIDCIDR ensures that every ports document use an ID rather than a CIDR for subnetID.
func ReplaceSpaceNameWithIDEndpointBindings ¶
ReplaceSpaceNameWithIDEndpointBindings replaces space names with space ids for endpoint bindings.
func ReplicaSetMembers ¶
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 ¶
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 ¶
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 ¶
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 ¶
SplitLogCollections moves log entries from the old single log collection to the log collection per model.
func StripLocalUserDomain ¶
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 TranslateK8sServiceTypes ¶
TranslateK8sServiceTypes converts any existing app config using the native k8s service types to the Juju values.
func UpdateInheritedControllerConfig ¶
UpdateInheritedControllerConfig migrates the existing global settings doc keyed on "controller" to be keyed on the cloud name.
func UpdateK8sModelNameIndex ¶
UpdateK8sModelNameIndex migrates k8s model indices to be based on the model owner rather than the cloud name.
func UpdateKubernetesStorageConfig ¶
UpdateKubernetesStorageConfig sets default storage classes for operator and workload storage.
func UpdateLegacyKubernetesCloudCredentials ¶
UpdateLegacyKubernetesCloudCredentials updates the cloud credentials for Kubernetes clouds. This is to introduce bug fix changes from 2.9 onwards.
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 ¶
UpgradeDefaultContainerImageStreamConfig ensures that the config value for container-image-stream is set to its default value, "released".
func UpgradeNoProxyDefaults ¶
UpgradeNoProxyDefaults changes the default values of no_proxy to hold localhost values as defaults.
Types ¶
type Action ¶
type Action interface { Entity // 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{} // Parallel returns true if the action can run without // needed to acquire the machine lock. Parallel() bool // ExecutionGroup is the group of actions which cannot // execute in parallel with each other. ExecutionGroup() string // 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 { Entity // 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{}, parallel *bool, executionGroup *string) (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 { Entity 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 ¶
DNSSearchDomains returns the list of DNS domains to use for qualifying hostnames. Can be empty.
func (*Address) DNSServers ¶
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 ¶
DeviceName returns the name of the link-layer device this IP address is assigned to.
func (*Address) DocID ¶
DocID returns the globally unique ID of the IP address, including the model UUID as prefix.
func (*Address) GatewayAddress ¶
GatewayAddress returns the gateway address to use, which can be empty.
func (*Address) IsDefaultGateway ¶
IsDefaultGateway returns true if this address is used for the default gateway on the machine.
func (*Address) IsSecondary ¶
IsSecondary if true, indicates that this address is not the primary address associated with the NIC.
func (*Address) IsShadow ¶
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 ¶
LoopbackConfigMethod returns whether AddressConfigMethod used for this IP address was loopback.
func (*Address) NetworkAddress ¶
func (addr *Address) NetworkAddress() network.SpaceAddress
NetworkAddress returns the address transformed to a network.Address.
func (*Address) 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 ¶
ProviderID returns the provider-specific IP address ID, if set.
func (*Address) ProviderNetworkID ¶
ProviderNetworkID returns the provider-specific network ID, if set.
func (*Address) ProviderSubnetID ¶
ProviderSubnetID returns the provider-specific subnet ID, if set.
func (*Address) Remove ¶
Remove removes the IP address if it exists. No error is returned if the address was already removed.
func (*Address) RemoveOps ¶
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 ¶
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 ¶
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 ¶
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) Subnet ¶
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 ¶
SubnetCIDR returns the CIDR of the subnet this IP address comes from.
type AgentEntity ¶
type AgentEntity interface { Entity Lifer Authenticator AgentTooler status.StatusSetter EnsureDeader Remover NotifyWatcherFactory }
AgentEntity represents an entity that can have an agent responsible for it.
type AgentLiving ¶
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) 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. TODO (stickupkid): This will be removed once we align all upgrade-series commands.
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 { status.StatusGetter // 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 ¶
type ApplicationOfferInput interface { DocModelNamespace ApplicationOfferStateDocumentFactory ApplicationOfferDescription }
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) MapWithSpaceNames ¶
MapWithSpaceNames returns the current bindingMap with space names rather than ids.
func (*Bindings) Merge ¶
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.
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. RemoveBlock // ChangeBlock type identifies block that prevents model changes such // as additions, modifications, removals of model entities. ChangeBlock )
func ParseBlockType ¶
ParseBlockType returns BlockType from humanly readable type representation.
func (BlockType) MigrationValue ¶
MigrationValue converts the block type value into a useful human readable string for model migration.
type CAASModel ¶
type CAASModel struct { // TODO(caas) - this is all still messy until things shake out. *Model // 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) RawK8sSpec ¶
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.
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 ¶
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 ¶
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 ¶
IsPlaceholder returns whether the charm record is just a placeholder rather than representing a deployed charm.
func (*Charm) IsUploaded ¶
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) Macaroon ¶
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) Metrics ¶
func (c *Charm) Metrics() *charm.Metrics
Metrics returns the metrics declared for the charm.
func (*Charm) Refresh ¶
Refresh loads fresh charm data from the database. In practice, the only observable change should be to its Life value.
func (*Charm) Remove ¶
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) StoragePath ¶
StoragePath returns the storage path of the charm bundle.
func (*Charm) Tag ¶
func (c *Charm) Tag() names.Tag
Tag returns a tag identifying the charm. Implementing state.GlobalEntity interface.
func (*Charm) UpdateMacaroon ¶
UpdateMacaroon updates the stored macaroon for this charm.
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"` Type string `bson:"type,omitempty"` ID string `bson:"id"` Hash string `bson:"hash"` Revision *int `bson:"revision,omitempty"` Channel *Channel `bson:"channel,omitempty"` Platform *Platform `bson:"platform,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 { cloud.Cloud // 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) 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
type Constraints ¶
type Constraints struct {
// contains filtered or unexported fields
}
Constraints represents the state of a constraints with an ID.
func (*Constraints) ChangeSpaceNameOps ¶
func (c *Constraints) ChangeSpaceNameOps(from, to string) []txn.Op
ChangeSpaceNameOps returns the transaction operations required to rename a space used in these constraints.
func (*Constraints) ID ¶
func (c *Constraints) ID() string
ID returns the Mongo document ID for the constraints instance.
func (*Constraints) Value ¶
func (c *Constraints) Value() constraints.Value
Value returns the constraints.Value represented by the Constraints' Mongo document.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller encapsulates state for the Juju controller as a whole, as opposed to model specific functionality.
This type is primarily used in the state.Initialize function, and in the yet to be hooked up controller worker.
func Initialize ¶
func Initialize(args InitializeParams) (_ *Controller, err error)
Initialize sets up the database with all the collections and indices it needs. It also creates the initial model for the controller. This needs to be performed only once for the initial controller model. It returns unauthorizedError if access is unauthorized.
func NewController ¶
func NewController(pool *StatePool) *Controller
NewController returns a controller object that doesn't own the state pool it has been given. This is for convenience at this time to get access to controller methods.
func OpenController ¶
func OpenController(args OpenParams) (*Controller, error)
OpenController connects to the server with the given parameters, waits for it to be initialized, and returns a new Controller instance.
OpenController returns unauthorizedError if access is unauthorized.
func (*Controller) Close ¶
func (ctlr *Controller) Close() error
Close the connection to the database.
func (*Controller) GetState ¶
func (ctlr *Controller) GetState(modelTag names.ModelTag) (*PooledState, error)
GetState returns a new State instance for the specified model. The connection uses the same credentials and policy as the Controller.
func (*Controller) Import ¶
func (ctrl *Controller) Import(model description.Model) (_ *Model, _ *State, err error)
Import the database agnostic model representation into the database.
func (*Controller) NewModel ¶
func (ctlr *Controller) NewModel(args ModelArgs) (_ *Model, _ *State, err error)
NewModel creates a new model with its own UUID and prepares it for use. Model and State instances for the new model are returned.
The controller model's UUID is attached to the new model's document. Having the server UUIDs stored with each model document means that we have a way to represent external models, perhaps for future use around cross model relations.
func (*Controller) Ping ¶
func (ctlr *Controller) Ping() error
Ping probes the Controllers's database connection to ensure that it is still alive.
func (*Controller) StatePool ¶
func (ctlr *Controller) StatePool() *StatePool
StatePool provides access to the state pool of the controller.
func (*Controller) SystemState ¶
func (ctlr *Controller) SystemState() *State
SystemState returns the State object for the controller model.
type ControllerAccessor ¶
type ControllerAccessor interface { ControllerConfig() (controller.Config, error) ControllerInfo(modelUUID string) (addrs []string, CACert string, _ error) }
ControllerAccessor defines the methods needed to access controller information.
type ControllerInfo ¶
type ControllerInfo struct { // CloudName is the name of the cloud to which this controller is deployed. CloudName string // ModelTag identifies the initial model. Only the initial // model is able to have machines that manage state. The initial // model is the model that is created when bootstrapping. ModelTag names.ModelTag // ControllerIds holds the ids of all the controller nodes. // It's main purpose is to allow assertions tha the set of // controllers hasn't changed when adding/removing controller nodes. ControllerIds []string }
ControllerInfo holds information about currently configured controller machines.
type ControllerNode ¶
type ControllerNode interface { Id() string Tag() names.Tag Refresh() error WantsVote() bool HasVote() bool SetHasVote(hasVote bool) error Watch() NotifyWatcher SetMongoPassword(password string) error }
ControllerNode represents an instance of a HA controller.
type ControllerSessioner ¶
type ControllerSessioner interface { MongoSessioner // IsController indicates if current state is controller. IsController() bool // contains filtered or unexported methods }
ControllerSessioner supports creating new mongo sessions for the controller.
type ControllersChanges ¶
type ControllersChanges struct { Added []string Removed []string Maintained []string Converted []string }
Change in controllers after the ensure availability txn has committed.
type Credential ¶
type Credential struct {
// contains filtered or unexported fields
}
Credential contains information about the credential as stored on the controller.
func (Credential) CloudCredentialTag ¶
func (c Credential) CloudCredentialTag() (names.CloudCredentialTag, error)
CloudCredentialTag returns cloud credential tag.
func (Credential) IsValid ¶
func (c Credential) IsValid() bool
IsValid indicates whether the credential is valid.
type CredentialOwnerModelAccess ¶
type CredentialOwnerModelAccess struct { ModelUUID string ModelName string OwnerAccess permission.Access Error error }
CredentialOwnerModelAccess stores cloud credential model information for the credential owner or an error retrieving it.
type Database ¶
type Database interface { // Copy returns a matching Database with its own session, and a // func that must be called when the Database is no longer needed. // // GetCollection and TransactionRunner results from the resulting Database // will all share a session; this does not absolve you of responsibility // for calling those collections' closers. Copy() (Database, SessionCloser) // CopyForModel returns a matching Database with its own session and // its own modelUUID and a func that must be called when the Database is no // longer needed. // // Same warnings apply for CopyForModel than for Copy. CopyForModel(modelUUID string) (Database, SessionCloser) // GetCollection returns the named Collection, and a func that must be // called when the Collection is no longer needed. The returned Collection // might or might not have its own session, depending on the Database; the // closer must always be called regardless. // // If the schema specifies model-filtering for the named collection, // the returned collection will automatically filter queries; for details, // see modelStateCollection. GetCollection(name string) (mongo.Collection, SessionCloser) // GetCollectionFor returns the named collection, scoped for the // model specified. As for GetCollection, a closer is also returned. GetCollectionFor(modelUUID, name string) (mongo.Collection, SessionCloser) // GetRawCollection returns the named mgo Collection. As no // automatic model filtering is performed by the returned // collection it should be rarely used. GetCollection() should be // used in almost all cases. GetRawCollection(name string) (*mgo.Collection, SessionCloser) // TransactionRunner() returns a runner responsible for making changes to // the database, and a func that must be called when the runner is no longer // needed. The returned Runner might or might not have its own session, // depending on the Database; the closer must always be called regardless. // // It will reject transactions that reference raw-access (or unknown) // collections; it will automatically rewrite operations that reference // non-global collections; and it will ensure that non-global documents can // only be inserted while the corresponding model is still Alive. TransactionRunner() (jujutxn.Runner, SessionCloser) // RunTransaction is a convenience method for running a single // transaction. RunTransaction(ops []txn.Op) error // RunTransaction is a convenience method for running a single // transaction for the model specified. RunTransactionFor(modelUUID string, ops []txn.Op) error // RunRawTransaction is a convenience method that will run a // single transaction using a "raw" transaction runner that won't // perform model filtering. RunRawTransaction(ops []txn.Op) error // Run is a convenience method running a transaction using a // transaction building function. Run(transactions jujutxn.TransactionSource) error // Schema returns the schema used to load the database. The returned schema // is not a copy and must not be modified. Schema() CollectionSchema }
Database exposes the mongodb capabilities that most of state should see.
type DbLogger ¶
type DbLogger struct {
// contains filtered or unexported fields
}
func NewDbLogger ¶
func NewDbLogger(st ModelSessioner) *DbLogger
func (*DbLogger) Close ¶
func (logger *DbLogger) Close()
Close cleans up resources used by the DbLogger instance.
func (*DbLogger) Log ¶
Log writes log messages to the database. Log records are written to the database in bulk; callers should buffer log records to and call Log with a batch to minimise database writes.
The ModelUUID and ID fields of records are ignored; DbLogger is scoped to a single model, and ID is controlled by the DbLogger code.
type DebugLogger ¶
type DebugLogger interface {
Debugf(string, ...interface{})
}
DebugLogger is a logger that implements Debugf.
type DestroyApplicationOperation ¶
type DestroyApplicationOperation struct { // DestroyStorage controls whether or not storage attached // to units of the application are destroyed. If this is false, // then detachable storage will be detached and left in the model. DestroyStorage bool // RemoveOffers controls whether or not application offers // are removed. If this is false, then the operation will // fail if there are any offers remaining. RemoveOffers bool // CleanupIgnoringResources is true if this operation has been // scheduled by a forced cleanup task. CleanupIgnoringResources bool // PostDestoryAppLife is the life of the app if destroy completes without error. PostDestoryAppLife Life // ForcedOperation stores needed information to force this operation. ForcedOperation // contains filtered or unexported fields }
DestroyApplicationOperation is a model operation for destroying an application.
func (*DestroyApplicationOperation) Build ¶
func (op *DestroyApplicationOperation) Build(attempt int) ([]txn.Op, error)
Build is part of the ModelOperation interface.
func (*DestroyApplicationOperation) Done ¶
func (op *DestroyApplicationOperation) Done(err error) error
Done is part of the ModelOperation interface.
type DestroyModelParams ¶
type DestroyModelParams struct { // DestroyHostedModels controls whether or not hosted models // are destroyed also. This only applies to the controller // model. // // If this is false when destroying the controller model, // there must be no hosted models, or an error satisfying // IsHasHostedModelsError will be returned. // // TODO(axw) this should be moved to the Controller type. DestroyHostedModels bool // DestroyStorage controls whether or not storage in the // model (and hosted models, if DestroyHostedModels is true) // should be destroyed. // // This is ternary: nil, false, or true. If nil and // there is persistent storage in the model (or hosted // models), an error satisfying IsHasPersistentStorageError // will be returned. DestroyStorage *bool // Force specifies whether model destruction will be forced, i.e. // keep going despite operational errors. Force *bool // MaxWait specifies the amount of time that each step in model destroy process // will wait before forcing the next step to kick-off. This parameter // only makes sense in combination with 'force' set to 'true'. MaxWait time.Duration }
DestroyModelParams contains parameters for destroy a model.
type DestroyRelationOperation ¶
type DestroyRelationOperation struct { // ForcedOperation stores needed information to force this operation. ForcedOperation // contains filtered or unexported fields }
DestroyRelationOperation is a model operation destroy relation.
func (*DestroyRelationOperation) Build ¶
func (op *DestroyRelationOperation) Build(attempt int) ([]txn.Op, error)
Build is part of the ModelOperation interface.
func (*DestroyRelationOperation) Done ¶
func (op *DestroyRelationOperation) Done(err error) error
Done is part of the ModelOperation interface.
type DestroyRemoteApplicationOperation ¶
type DestroyRemoteApplicationOperation struct { // ForcedOperation stores needed information to force this operation. ForcedOperation // contains filtered or unexported fields }
DestroyRemoteApplicationOperation is a model operation to destroy a remote application.
func (*DestroyRemoteApplicationOperation) Build ¶
func (op *DestroyRemoteApplicationOperation) Build(attempt int) ([]txn.Op, error)
Build is part of the ModelOperation interface.
func (*DestroyRemoteApplicationOperation) Done ¶
func (op *DestroyRemoteApplicationOperation) Done(err error) error
Done is part of the ModelOperation interface.
type DestroyUnitOperation ¶
type DestroyUnitOperation struct { // ForcedOperation stores needed information to force this operation. ForcedOperation // DestroyStorage controls whether or not storage attached // to the unit is destroyed. If this is false, then detachable // storage will be detached and left in the model. DestroyStorage bool // contains filtered or unexported fields }
DestroyUnitOperation is a model operation for destroying a unit.
func (*DestroyUnitOperation) Build ¶
func (op *DestroyUnitOperation) Build(attempt int) ([]txn.Op, error)
Build is part of the ModelOperation interface.
func (*DestroyUnitOperation) Done ¶
func (op *DestroyUnitOperation) Done(err error) error
Done is part of the ModelOperation interface.
type DeviceConstraints ¶
type DeviceConstraints struct { // Type is the device type or device-class. // currently supported types are // - gpu // - nvidia.com/gpu // - amd.com/gpu Type DeviceType `bson:"type"` // Count is the number of devices that the user has asked for - count min and max are the // number of devices the charm requires. Count int64 `bson:"count"` // Attributes is a collection of key value pairs device related (node affinity labels/tags etc.). Attributes map[string]string `bson:"attributes"` }
DeviceConstraints describes a set of device constraints.
type DeviceType ¶
type DeviceType string
type DocModelNamespace ¶
DocModelNamespace takes a document model ID and ensures it has a model id associated with the model.
type DockerMetadataStorage ¶
type DockerMetadataStorage interface { Save(resourceID string, drInfo resources.DockerImageDetails) error Remove(resourceID string) error Get(resourceID string) (io.ReadCloser, int64, error) }
DockerMetadataStorage provides the interface for storing Docker resource-type data
func NewDockerMetadataStorage ¶
func NewDockerMetadataStorage(st *State) DockerMetadataStorage
NewDockerMetadataStorage returns a dockerMetadataStorage for persisting Docker resources.
type Endpoint ¶
type Endpoint struct { ApplicationName string // TODO: thumper 2016-06-27 // This is pure evil and we should not be storing structures from // external packages directly in mongo. charm.Relation }
Endpoint represents one endpoint of a relation.
func ApplicationOfferEndpoint ¶
func ApplicationOfferEndpoint(offer crossmodel.ApplicationOffer, relationName string) (Endpoint, error)
ApplicationOfferEndpoint returns from the specified offer, the relation endpoint with the supplied name, if it exists.
func (Endpoint) CanRelateTo ¶
CanRelateTo returns whether a relation may be established between e and other.
type EndpointBinding ¶
type EndpointBinding interface { network.SpaceLookup DefaultEndpointBindingSpace() (string, error) Space(id string) (*Space, error) }
EndpointBinding are the methods necessary for exported methods of Bindings to work.
type EnsureDeader ¶
type EnsureDeader interface {
EnsureDead() error
}
EnsureDeader with an EnsureDead method.
type Entity ¶
type Entity interface {
Tag() names.Tag
}
Entity represents any entity that can be returned by State.FindEntity. All entities have a tag.
type EntityFinder ¶
EntityFinder is implemented by *State. See State.FindEntity for documentation on the method.
type EntityWithApplication ¶
type EntityWithApplication interface {
Application() (*Application, error)
}
EntityWithApplication is implemented by Units it is intended for anything that can return its Application.
type ExportConfig ¶
type ExportConfig struct { IgnoreIncompleteModel bool SkipActions bool SkipAnnotations bool SkipCloudImageMetadata bool SkipCredentials bool SkipIPAddresses bool SkipSettings bool SkipSSHHostKeys bool SkipStatusHistory bool SkipLinkLayerDevices bool SkipUnitAgentBinaries bool SkipMachineAgentBinaries bool SkipRelationData bool SkipInstanceData bool SkipApplicationOffers bool SkipOfferConnections bool SkipExternalControllers bool }
ExportConfig allows certain aspects of the model to be skipped during the export. The intent of this is to be able to get a partial export to support other API calls, like status.
type ExportStateMigration ¶
type ExportStateMigration struct {
// contains filtered or unexported fields
}
ExportStateMigration defines a migration for exporting various entities into a destination description model from the source state. It accumulates a series of migrations to run at a later time. Running the state migration visits all the migrations and exits upon seeing the first error from the migration.
func (*ExportStateMigration) Add ¶
func (m *ExportStateMigration) Add(f func() error)
Add adds a migration to execute at a later time Return error from the addition will cause the Run to terminate early.
func (*ExportStateMigration) Run ¶
func (m *ExportStateMigration) Run() error
Run executes all the migrations required to be run.
type ExposedEndpoint ¶
type ExposedEndpoint struct { // A list of spaces that should be able to reach the opened ports // for an exposed application's endpoint. ExposeToSpaceIDs []string `bson:"to-space-ids,omitempty"` // A list of CIDRs that should be able to reach the opened ports // for an exposed application's endpoint. ExposeToCIDRs []string `bson:"to-cidrs,omitempty"` }
ExposedEndpoint encapsulates the expose-related details of a particular application endpoint with respect to the sources (CIDRs or space IDs) that should be able to access the ports opened by the application charm for an endpoint.
func (ExposedEndpoint) AllowTrafficFromAnyNetwork ¶
func (exp ExposedEndpoint) AllowTrafficFromAnyNetwork() bool
AllowTrafficFromAnyNetwork returns true if the exposed endpoint parameters include the 0.0.0.0/0 CIDR.
type ExternalController ¶
type ExternalController interface { // Id returns the external controller UUID, also used as // the mongo id. Id() string // ControllerInfo returns the details required to connect to the // external controller. ControllerInfo() crossmodel.ControllerInfo }
ExternalController represents the state of a controller hosting other models.
type ExternalControllerStateDocumentFactory ¶
type ExternalControllerStateDocumentFactory interface { ExternalControllerDoc(string) (*externalControllerDoc, error) MakeExternalControllerOp(externalControllerDoc, *externalControllerDoc) txn.Op }
ExternalControllerStateDocumentFactory 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 ExternalControllers ¶
type ExternalControllers interface { Save(_ crossmodel.ControllerInfo, modelUUIDs ...string) (ExternalController, error) SaveAndMoveModels(_ crossmodel.ControllerInfo, modelUUIDs ...string) error Controller(controllerUUID string) (ExternalController, error) ControllerForModel(modelUUID string) (ExternalController, error) Remove(controllerUUID string) error Watch() StringsWatcher WatchController(controllerUUID string) NotifyWatcher }
ExternalControllers instances provide access to external controllers in state.
type ExternalControllersDescription ¶
type ExternalControllersDescription interface {
ExternalControllers() []description.ExternalController
}
ExternalControllersDescription defines an in-place usage for reading external controllers
type ExternalControllersInput ¶
type ExternalControllersInput interface { ExternalControllerStateDocumentFactory ExternalControllersDescription }
ExternalControllersInput describes the input used for migrating external controllers.
type Filesystem ¶
type Filesystem interface { GlobalEntity Lifer status.StatusGetter status.StatusSetter // FilesystemTag returns the tag for the filesystem. FilesystemTag() names.FilesystemTag // Storage returns the tag of the storage instance that this // filesystem is assigned to, if any. If the filesystem is not // assigned to a storage instance, an error satisfying // errors.IsNotAssigned will be returned. // // A filesystem can be assigned to at most one storage instance, and // a storage instance can have at most one associated filesystem. Storage() (names.StorageTag, error) // Volume returns the tag of the volume backing this filesystem, // or ErrNoBackingVolume if the filesystem is not backed by a volume // managed by Juju. Volume() (names.VolumeTag, error) // Info returns the filesystem's FilesystemInfo, or a NotProvisioned // error if the filesystem has not yet been provisioned. Info() (FilesystemInfo, error) // Params returns the parameters for provisioning the filesystem, // if it needs to be provisioned. Params returns true if the returned // parameters are usable for provisioning, otherwise false. Params() (FilesystemParams, bool) // Detachable reports whether or not the filesystem is detachable. Detachable() bool // Releasing reports whether or not the filesystem is to be released // from the model when it is Dying/Dead. Releasing() bool }
Filesystem describes a filesystem in the model. Filesystems may be backed by a volume, and managed by Juju; otherwise they are first-class entities managed by a filesystem provider.
type FilesystemAttachment ¶
type FilesystemAttachment interface { Lifer // Filesystem returns the tag of the related Filesystem. Filesystem() names.FilesystemTag // Host returns the tag of the entity to which this attachment belongs. Host() names.Tag // Info returns the filesystem attachment's FilesystemAttachmentInfo, or a // NotProvisioned error if the attachment has not yet been made. // // Note that the presence of FilesystemAttachmentInfo does not necessarily // imply that the filesystem is mounted; model storage providers may // need to prepare a filesystem for attachment to a machine before it can // be mounted. Info() (FilesystemAttachmentInfo, error) // Params returns the parameters for creating the filesystem attachment, // if it has not already been made. Params returns true if the returned // parameters are usable for creating an attachment, otherwise false. Params() (FilesystemAttachmentParams, bool) }
FilesystemAttachment describes an attachment of a filesystem to a machine.
type FilesystemAttachmentInfo ¶
type FilesystemAttachmentInfo struct { // MountPoint is the path at which the filesystem is mounted on the // machine. MountPoint may be empty, meaning that the filesystem is // not mounted yet. MountPoint string `bson:"mountpoint"` ReadOnly bool `bson:"read-only"` }
FilesystemAttachmentInfo describes information about a filesystem attachment.
type FilesystemAttachmentParams ¶
type FilesystemAttachmentParams struct { Location string `bson:"location"` ReadOnly bool `bson:"read-only"` // contains filtered or unexported fields }
FilesystemAttachmentParams records parameters for attaching a filesystem to a machine.
type FilesystemInfo ¶
type FilesystemInfo struct { Size uint64 `bson:"size"` Pool string `bson:"pool"` // FilesystemId is the provider-allocated unique ID of the // filesystem. This will be the string representation of // the filesystem tag for filesystems backed by volumes. FilesystemId string `bson:"filesystemid"` }
FilesystemInfo describes information about a filesystem.
type FilesystemParams ¶
type FilesystemParams struct { Pool string `bson:"pool"` Size uint64 `bson:"size"` // contains filtered or unexported fields }
FilesystemParams records parameters for provisioning a new filesystem.
type FirewallRule ¶
type FirewallRule struct {
// contains filtered or unexported fields
}
FirewallRule instances describe the ingress networks whitelist/blacklist for a given well known service. Primarily, whitelisting allowed ingress subnets is the main use case. However, blacklisting subnets is useful to allow restrictions placed on incoming traffic for cross model relations, where the source of traffic is requested from the consuming side. WellKnownService is either a well known internet service (currently just SSH) or a Juju defined value. Supported values are: - ssh - juju-controller - juju-application-offer
func NewFirewallRule ¶
func NewFirewallRule(serviceType firewall.WellKnownServiceType, cidrs []string) FirewallRule
NewFirewallRule will create a new FirewallRule using the service type and some CIDRs.
func (FirewallRule) WellKnownService ¶
func (f FirewallRule) WellKnownService() firewall.WellKnownServiceType
WellKnownService is the known service for the firewall rules entity.
func (FirewallRule) WhitelistCIDRs ¶
func (f FirewallRule) WhitelistCIDRs() []string
WhitelistCIDRS is the whitelist CIDRs for the rule.
type FirewallRuler ¶
type FirewallRuler interface { Save(service firewall.WellKnownServiceType, whiteListCidrs []string) (FirewallRule, error) Rule(service firewall.WellKnownServiceType) (FirewallRule, error) AllRules() ([]FirewallRule, error) }
FirewallRuler instances provide access to firewall rules in state.
type FirewallRulesDescription ¶
type FirewallRulesDescription interface {
FirewallRules() []description.FirewallRule
}
FirewallRulesDescription defines an in-place usage for reading firewall rules.
type FirewallRulesInput ¶
type FirewallRulesInput interface { FirewallRulesDescription }
FirewallRulesInput describes the input used for migrating firewall rules.
type ForcedOperation ¶
type ForcedOperation struct { // Force controls whether or not the removal of a unit // will be forced, i.e. ignore operational errors. Force bool // Errors contains errors encountered while applying this operation. // Generally, these are non-fatal errors that have been encountered // during, say, force. They may not have prevented the operation from being // aborted but the user might still want to know about them. Errors []error // MaxWait specifies the amount of time that each step in relation destroy process // will wait before forcing the next step to kick-off. This parameter // only makes sense in combination with 'force' set to 'true'. MaxWait time.Duration }
ForcedOperation that allows accumulation of operational errors and can be forced.
func (*ForcedOperation) AddError ¶
func (op *ForcedOperation) AddError(one ...error)
AddError adds an error to the collection of errors for this operation.
func (*ForcedOperation) FatalError ¶
func (op *ForcedOperation) FatalError(err error) bool
FatalError returns true if the err is not nil and Force is false. If the error is not nil, it's added to the slice of errors for the operation.
func (*ForcedOperation) LastError ¶
func (op *ForcedOperation) LastError() error
LastError returns last added error for this operation.
type Generation ¶
type Generation struct {
// contains filtered or unexported fields
}
Generation represents the state of a model generation.
func (*Generation) Abort ¶
func (g *Generation) Abort(userName string) error
Abort marks the generation as completed however no value is assigned from the generation sequence.
func (*Generation) AssignAllUnits ¶
func (g *Generation) AssignAllUnits(appName string) error
AssignAllUnits ensures that all units of the input application are designated as tracking the branch, by adding the unit names to the generation.
func (*Generation) AssignApplication ¶
func (g *Generation) AssignApplication(appName string) error
AssignApplication indicates that the application with the input name has had changes in this generation.
func (*Generation) AssignUnit ¶
func (g *Generation) AssignUnit(unitName string) error
AssignUnit indicates that the unit with the input name is tracking this branch, by adding the name to the generation.
func (*Generation) AssignUnits ¶
func (g *Generation) AssignUnits(appName string, numUnits int) error
func (*Generation) AssignedUnits ¶
func (g *Generation) AssignedUnits() map[string][]string
AssignedUnits returns the unit names, keyed by application name that have been assigned to this generation.
func (*Generation) BranchName ¶
func (g *Generation) BranchName() string
func (*Generation) CheckNotComplete ¶
func (g *Generation) CheckNotComplete() error
CheckNotComplete returns an error if this generation was committed or aborted.
func (*Generation) Commit ¶
func (g *Generation) Commit(userName string) (int, error)
Commit marks the generation as completed and assigns it the next value from the generation sequence. The new generation ID is returned.
func (*Generation) Completed ¶
func (g *Generation) Completed() int64
Completed returns the Unix timestamp at generation completion.
func (*Generation) CompletedBy ¶
func (g *Generation) CompletedBy() string
CompletedBy returns the user who committed the generation.
func (*Generation) Config ¶
func (g *Generation) Config() map[string]settings.ItemChanges
Config returns all changed charm configuration for the generation. The persisted objects are converted to core changes.
func (*Generation) Created ¶
func (g *Generation) Created() int64
Created returns the Unix timestamp at generation creation.
func (*Generation) CreatedBy ¶
func (g *Generation) CreatedBy() string
CreatedBy returns the user who created the generation.
func (*Generation) GenerationId ¶
func (g *Generation) GenerationId() int
GenerationId indicates the relative order that this branch was committed and had its changes applied to the whole model.
func (*Generation) HasChangesFor ¶
func (g *Generation) HasChangesFor(appName string) bool
HasChangesFor returns true when the generation has config changes for the provided application.
func (*Generation) IsCompleted ¶
func (g *Generation) IsCompleted() bool
IsCompleted returns true if the generation has been completed; i.e it has a completion time-stamp.
func (*Generation) IsTracking ¶
func (g *Generation) IsTracking(unitName string) bool
IsTracking returns true if the generation is tracking the provided unit.
func (*Generation) ModelUUID ¶
func (g *Generation) ModelUUID() string
ModelUUID returns the ID of the model to which this generation applies.
func (*Generation) Refresh ¶
func (g *Generation) Refresh() error
Refresh refreshes the contents of the generation from the underlying state.
func (*Generation) UpdateCharmConfig ¶
func (g *Generation) UpdateCharmConfig(appName string, master *Settings, validChanges charm.Settings) error
UpdateCharmConfig applies the input changes to the input application's charm configuration under this branch. the incoming charm settings are assumed to have been validated.
type GlobalEntity ¶
type GlobalEntity interface { Tag() names.Tag // contains filtered or unexported methods }
GlobalEntity specifies entity.
type HistoryGetter ¶
type HistoryGetter struct {
// contains filtered or unexported fields
}
HistoryGetter allows getting the status history based on some identifying key.
func (*HistoryGetter) StatusHistory ¶
func (g *HistoryGetter) StatusHistory(filter status.StatusHistoryFilter) ([]status.StatusInfo, error)
StatusHistory implements status.StatusHistoryGetter.
type HostFilesystemParams ¶
type HostFilesystemParams struct { Filesystem FilesystemParams Attachment FilesystemAttachmentParams }
HostFilesystemParams holds the parameters for creating a filesystem and attaching it to a new host.
type HostVolumeParams ¶
type HostVolumeParams struct { Volume VolumeParams Attachment VolumeAttachmentParams }
HostVolumeParams holds the parameters for creating a volume and attaching it to a new host.
type ImportApplicationOffer ¶
type ImportApplicationOffer struct { }
ImportApplicationOffer describes a way to import application offers from a description.
func (ImportApplicationOffer) Execute ¶
func (i ImportApplicationOffer) Execute(src ApplicationOfferInput, runner TransactionRunner, ) error
Execute the import on the application offer description, carefully modelling the dependencies we have.
type ImportExternalControllers ¶
type ImportExternalControllers struct{}
ImportExternalControllers describes a way to import external controllers from a description.
func (ImportExternalControllers) Execute ¶
func (ImportExternalControllers) Execute(src ExternalControllersInput, runner TransactionRunner) error
Execute the import on the external controllers description, carefully modelling the dependencies we have.
type ImportFirewallRules ¶
type ImportFirewallRules struct{}
ImportFirewallRules describes a way to import firewallRules from a description.
func (ImportFirewallRules) Execute ¶
func (rules ImportFirewallRules) Execute(src FirewallRulesInput, runner TransactionRunner) error
Execute the import on the firewall rules description, carefully modelling the dependencies we have.
type ImportRelationNetworks ¶
type ImportRelationNetworks struct{}
ImportRelationNetworks describes a way to import relation networks from a description.
func (ImportRelationNetworks) Execute ¶
func (ImportRelationNetworks) Execute(src RelationNetworksInput, runner TransactionRunner) error
Execute the import on the relation networks description, carefully modelling the dependencies we have.
type ImportRemoteApplications ¶
type ImportRemoteApplications struct{}
ImportRemoteApplications describes a way to import remote applications from a description.
func (ImportRemoteApplications) Execute ¶
func (i ImportRemoteApplications) Execute(src RemoteApplicationsInput, runner TransactionRunner) error
Execute the import on the remote entities description, carefully modelling the dependencies we have.
type ImportRemoteEntities ¶
type ImportRemoteEntities struct{}
ImportRemoteEntities describes a way to import remote entities from a description.
func (ImportRemoteEntities) Execute ¶
func (ImportRemoteEntities) Execute(src RemoteEntitiesInput, runner TransactionRunner) error
Execute the import on the remote entities description, carefully modelling the dependencies we have.
type ImportStateMigration ¶
type ImportStateMigration struct {
// contains filtered or unexported fields
}
ImportStateMigration defines a migration for importing various entities from a source description model to the destination state. It accumulates a series of migrations to Run at a later time. Running the state migration visits all the migrations and exits upon seeing the first error from the migration.
func (*ImportStateMigration) Add ¶
func (m *ImportStateMigration) Add(f func() error)
Add adds a migration to execute at a later time Return error from the addition will cause the Run to terminate early.
func (*ImportStateMigration) Run ¶
func (m *ImportStateMigration) Run() error
Run executes all the migrations required to be run.
type InitDatabaseFunc ¶
type InitDatabaseFunc func(*mgo.Session, string, *controller.Config) error
InitDatabaseFunc defines a function used to create the collections and indices in a Juju database.
type InitializeParams ¶
type InitializeParams struct { // Clock wraps all calls time. Real uses use clock.WallClock, // tests may override with a testing clock. Clock clock.Clock // ControllerModelArgs contains the arguments for creating // the controller model. ControllerModelArgs ModelArgs // StoragePools is one or more named storage pools to create // in the controller model. StoragePools map[string]storage.Attrs // Cloud contains the properties of the cloud that the // controller runs in. Cloud cloud.Cloud // CloudCredentials contains the credentials for the owner of // the controller model to store in the controller. CloudCredentials map[names.CloudCredentialTag]cloud.Credential // ControllerConfig contains config attributes for // the controller. ControllerConfig controller.Config // ControllerInheritedConfig contains default config attributes for // models on the specified cloud. ControllerInheritedConfig map[string]interface{} // RegionInheritedConfig contains region specific configuration for // models running on specific cloud regions. RegionInheritedConfig cloud.RegionConfig // NewPolicy is a function that returns the set of state policies // to apply. NewPolicy NewPolicyFunc // MongoSession is the mgo.Session to use for storing and // accessing state data. The caller remains responsible // for closing this session; Initialize will copy it. MongoSession *mgo.Session // AdminPassword holds the password for the initial user. AdminPassword string }
InitializeParams contains the parameters for initializing the state database.
func (InitializeParams) Validate ¶
func (p InitializeParams) Validate() error
Validate checks that the state initialization parameters are valid.
type InstanceIdGetter ¶
InstanceIdGetter defines a single method - InstanceId.
type LXDProfile ¶
type LXDProfile struct { Config map[string]string `bson:"config"` Description string `bson:"description"` Devices map[string]map[string]string `bson:"devices"` }
LXDProfile is the same as ProfilePut defined in github.com/lxc/lxd/shared/api/profile.go
func (*LXDProfile) Empty ¶
func (profile *LXDProfile) Empty() bool
Empty returns true if neither devices nor config have been defined in the profile.
func (*LXDProfile) ValidateConfigDevices ¶
func (profile *LXDProfile) ValidateConfigDevices() error
ValidateConfigDevices validates the Config and Devices properties of the LXDProfile. WhiteList devices: unix-char, unix-block, gpu, usb. BlackList config: boot*, limits* and migration*. An empty profile will not return an error. TODO (stickupkid): Remove this by moving this up into the API server layer.
type LastSentLogTracker ¶
type LastSentLogTracker struct {
// contains filtered or unexported fields
}
LastSentLogTracker records and retrieves timestamps of the most recent log records forwarded to a log sink for a model.
func NewLastSentLogTracker ¶
func NewLastSentLogTracker(st ModelSessioner, modelUUID, sink string) *LastSentLogTracker
NewLastSentLogTracker returns a new tracker that records and retrieves the timestamps of the most recent log records forwarded to the identified log sink for the current model.
func (*LastSentLogTracker) Close ¶
func (logger *LastSentLogTracker) Close() error
Close implements io.Closer
func (*LastSentLogTracker) Get ¶
func (logger *LastSentLogTracker) Get() (int64, int64, error)
Get retrieves the id and timestamp.
func (*LastSentLogTracker) Set ¶
func (logger *LastSentLogTracker) Set(recID, recTimestamp int64) error
Set records the timestamp.
type LeaveScopeOperation ¶
type LeaveScopeOperation struct { // ForcedOperation stores needed information to force this operation. ForcedOperation // contains filtered or unexported fields }
LeaveScopeOperation is a model operation for relation to leave scope.
func (*LeaveScopeOperation) Build ¶
func (op *LeaveScopeOperation) Build(attempt int) ([]txn.Op, error)
Build is part of the ModelOperation interface.
func (*LeaveScopeOperation) Description ¶
func (op *LeaveScopeOperation) Description() string
func (*LeaveScopeOperation) Done ¶
func (op *LeaveScopeOperation) Done(err error) error
Done is part of the ModelOperation interface.
type Life ¶
type Life int8
Life represents the lifecycle state of the entities Relation, Unit, Application and Machine.
type LinkLayerDevice ¶
type LinkLayerDevice struct {
// contains filtered or unexported fields
}
LinkLayerDevice represents the state of a link-layer network device for a machine.
func (*LinkLayerDevice) AddAddressOps ¶
func (dev *LinkLayerDevice) AddAddressOps(args LinkLayerDeviceAddress) ([]txn.Op, error)
AddAddressOps returns transaction operations required to add the input address to the device. TODO (manadart 2020-07-22): This method is currently used only for adding machine sourced addresses. If it is used in future to set provider addresses, the provider ID args must be included and the global ID collection must be maintained and verified.
func (*LinkLayerDevice) Addresses ¶
func (dev *LinkLayerDevice) Addresses() ([]*Address, error)
Addresses returns all IP addresses assigned to the device.
func (*LinkLayerDevice) DocID ¶
func (dev *LinkLayerDevice) DocID() string
DocID returns the globally unique ID of the link-layer device, including the model UUID as prefix.
func (*LinkLayerDevice) EthernetDeviceForBridge ¶
func (dev *LinkLayerDevice) EthernetDeviceForBridge( name string, askProviderForAddress bool, ) (network.InterfaceInfo, error)
EthernetDeviceForBridge returns an InterfaceInfo representing an ethernet device with the input name and this device as its parent. The detail supplied reflects whether the provider is expected to supply the interface's eventual address. If the device is not a bridge, an error is returned.
func (*LinkLayerDevice) ID ¶
func (dev *LinkLayerDevice) ID() string
ID returns the unique ID of this device within the model.
func (*LinkLayerDevice) IsAutoStart ¶
func (dev *LinkLayerDevice) IsAutoStart() bool
IsAutoStart returns whether the device is set to automatically start on boot.
func (*LinkLayerDevice) IsLoopbackDevice ¶
func (dev *LinkLayerDevice) IsLoopbackDevice() bool
IsLoopbackDevice returns whether this is a loopback device.
func (*LinkLayerDevice) IsUp ¶
func (dev *LinkLayerDevice) IsUp() bool
IsUp returns whether the device is currently up.
func (*LinkLayerDevice) MACAddress ¶
func (dev *LinkLayerDevice) MACAddress() string
MACAddress returns the media access control (MAC) address of the device.
func (*LinkLayerDevice) MTU ¶
func (dev *LinkLayerDevice) MTU() uint
MTU returns the maximum transmission unit the device can handle.
func (*LinkLayerDevice) Machine ¶
func (dev *LinkLayerDevice) Machine() (*Machine, error)
Machine returns the Machine this device belongs to.
func (*LinkLayerDevice) MachineID ¶
func (dev *LinkLayerDevice) MachineID() string
MachineID returns the ID of the machine this device belongs to.
func (*LinkLayerDevice) Name ¶
func (dev *LinkLayerDevice) Name() string
Name returns the name of the device, as it appears on the machine.
func (*LinkLayerDevice) ParentDevice ¶
func (dev *LinkLayerDevice) ParentDevice() (*LinkLayerDevice, error)
ParentDevice returns the LinkLayerDevice corresponding to the parent device of this device, if set. When no parent device name is set, it returns nil and no error.
func (*LinkLayerDevice) ParentID ¶
func (dev *LinkLayerDevice) ParentID() string
ParentID uses the rules for ParentName (above) to return the ID of this device's parent if it has one.
func (*LinkLayerDevice) ParentName ¶
func (dev *LinkLayerDevice) ParentName() string
ParentName returns the name of this device's parent device if set. The parent device is almost always on the same machine as the child device, but as a special case a child device on a container machine can have a parent bridge device on the container's host machine. In this case the global key of the parent device is returned.
func (*LinkLayerDevice) ProviderID ¶
func (dev *LinkLayerDevice) ProviderID() network.Id
ProviderID returns the provider-specific device ID, if set.
func (*LinkLayerDevice) Remove ¶
func (dev *LinkLayerDevice) Remove() (err error)
Remove removes the device, if it exists. No error is returned when the device was already removed. ErrParentDeviceHasChildren is returned if this device is a parent to one or more existing devices and therefore cannot be removed.
func (*LinkLayerDevice) RemoveAddresses ¶
func (dev *LinkLayerDevice) RemoveAddresses() error
RemoveAddresses removes all IP addresses assigned to the device.
func (*LinkLayerDevice) RemoveOps ¶
func (dev *LinkLayerDevice) RemoveOps() []txn.Op
RemoveOps returns transaction operations that will ensure that the device is not present in the collection and that if set, its provider ID is removed from the global register. Note that this method eschews responsibility for removing device addresses and for ensuring that this device has no children. That responsibility lies with the caller.
func (*LinkLayerDevice) SetProviderIDOps ¶
SetProviderIDOps returns the operations required to set the input provider ID for the link-layer device.
func (*LinkLayerDevice) String ¶
func (dev *LinkLayerDevice) String() string
String returns a human-readable representation of the device.
func (*LinkLayerDevice) Type ¶
func (dev *LinkLayerDevice) Type() network.LinkLayerDeviceType
Type returns this device's underlying type.
func (*LinkLayerDevice) UpdateOps ¶
func (dev *LinkLayerDevice) UpdateOps(args LinkLayerDeviceArgs) []txn.Op
UpdateOps returns the transaction operations required to update the device so that it reflects the incoming arguments. This method is intended for updating a device based on args gleaned from the host/container directly. As such it does not update provider IDs. There are separate methods for generating those operations.
func (*LinkLayerDevice) VirtualPortType ¶
func (dev *LinkLayerDevice) VirtualPortType() network.VirtualPortType
VirtualPortType returns the type of virtual port for the device if managed by a virtual switch.
type LinkLayerDeviceAddress ¶
type LinkLayerDeviceAddress struct { // DeviceName is the name of the link-layer device that has this address. DeviceName string // ConfigMethod is the method used to configure this address. ConfigMethod corenetwork.AddressConfigMethod // ProviderID is the provider-specific ID of the address. Empty when not // supported. Cannot be changed once set to non-empty. ProviderID corenetwork.Id // ProviderNetworkID is the provider-specific network ID of the address. // It can be left empty if not supported or known. ProviderNetworkID corenetwork.Id // ProviderSubnetID is the provider-specific subnet ID to which the // device is attached. ProviderSubnetID corenetwork.Id // CIDRAddress is the IP address assigned to the device, in CIDR format // (e.g. 10.20.30.5/24 or fc00:1234::/64). CIDRAddress string // DNSServers contains a list of DNS nameservers to use, which can be empty. DNSServers []string // DNSSearchDomains contains a list of DNS domain names to qualify // hostnames, and can be empty. DNSSearchDomains []string // GatewayAddress is the address of the gateway to use, which can be empty. GatewayAddress string // IsDefaultGateway is set to true if this address on this device is the // default gw on a machine. IsDefaultGateway bool // Origin represents the authoritative source of the address. // 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. Origin corenetwork.Origin }
LinkLayerDeviceAddress contains an IP address assigned to a link-layer device.
type LinkLayerDeviceArgs ¶
type LinkLayerDeviceArgs struct { // Name is the name of the device as it appears on the machine. Name string // MTU is the maximum transmission unit the device can handle. MTU uint // ProviderID is a provider-specific ID of the device. Empty when not // supported by the provider. Cannot be cleared once set. ProviderID corenetwork.Id // Type is the type of the underlying link-layer device. Type corenetwork.LinkLayerDeviceType // MACAddress is the media access control address for the device. MACAddress string // IsAutoStart is true if the device should be activated on boot. IsAutoStart bool // IsUp is true when the device is up (enabled). IsUp bool // ParentName is the name of the parent device, which may be empty. If set, // it needs to be an existing device on the same machine, unless the current // device is inside a container, in which case ParentName can be a global // key of a BridgeDevice on the host machine of the container. Traffic // originating from a device egresses from its parent device. ParentName string // If this is device is part of a virtual switch, this field indicates // the type of switch (e.g. an OVS bridge ) this port belongs to. VirtualPortType corenetwork.VirtualPortType }
LinkLayerDeviceArgs contains the arguments accepted by Machine.SetLinkLayerDevices().
type LogRecord ¶
type LogRecord struct { // universal fields ID int64 Time time.Time // origin fields ModelUUID string Entity string Version version.Number // logging-specific fields Level loggo.Level Module string Location string Message string }
LogRecord defines a single Juju log message as returned by LogTailer.
type LogTailer ¶
type LogTailer interface { // Logs returns the channel through which the LogTailer returns // Juju logs. It will be closed when the tailer stops. Logs() <-chan *LogRecord // Dying returns a channel which will be closed as the LogTailer // stops. Dying() <-chan struct{} // Stop is used to request that the LogTailer stops. It blocks // unil the LogTailer has stopped. Stop() error // Err returns the error that caused the LogTailer to stopped. If // it hasn't stopped or stopped without error nil will be // returned. Err() error }
LogTailer allows for retrieval of Juju's logs from MongoDB. It first returns any matching already recorded logs and then waits for additional matching logs as they appear.
func NewLogTailer ¶
func NewLogTailer(st LogTailerState, params LogTailerParams) (LogTailer, error)
NewLogTailer returns a LogTailer which filters according to the parameters given.
type LogTailerParams ¶
type LogTailerParams struct { StartID int64 StartTime time.Time MinLevel loggo.Level InitialLines int NoTail bool IncludeEntity []string ExcludeEntity []string IncludeModule []string ExcludeModule []string Oplog *mgo.Collection // For testing only }
LogTailerParams specifies the filtering a LogTailer should apply to logs in order to decide which to return.
type LogTailerState ¶
type LogTailerState interface { ModelSessioner // IsController indicates whether or not the model is the admin model. IsController() bool }
LogTailerState describes the methods on State required for logging to the database.
type MacaroonCache ¶
type MacaroonCache struct {
MacaroonCacheState
}
MacaroonCache is a type that wraps State and implements charmstore.MacaroonCache.
func (MacaroonCache) Get ¶
func (m MacaroonCache) Get(u *charm.URL) (macaroon.Slice, error)
Get retrieves the macaroon for the charm (if any).
func (MacaroonCache) Set ¶
func (m MacaroonCache) Set(u *charm.URL, ms macaroon.Slice) error
Set stores the macaroon on the charm.
type MacaroonCacheState ¶
type Machine ¶
type Machine struct {
// contains filtered or unexported fields
}
Machine represents the state of a machine.
func (*Machine) AddAction ¶
func (m *Machine) AddAction(operationID, name string, payload map[string]interface{}, parallel *bool, executionGroup *string) (Action, error)
AddAction is part of the ActionReceiver interface.
func (*Machine) AddLinkLayerDeviceOps ¶
func (m *Machine) AddLinkLayerDeviceOps( devArgs LinkLayerDeviceArgs, addrArgs ...LinkLayerDeviceAddress, ) ([]txn.Op, error)
AddLinkLayerDeviceOps returns transaction operations for adding the input link-layer device and the supplied addresses to the machine. TODO (manadart 2020-07-22): This method is currently used only for adding machine sourced devices and addresses. If it is used in future to set provider devices, the provider ID args must be included and the global ID collection must be maintained and verified.
func (*Machine) Addresses ¶
func (m *Machine) Addresses() (addresses network.SpaceAddresses)
Addresses returns any hostnames and ips associated with a machine, determined both by the machine itself, and by asking the provider.
The addresses returned by the provider shadow any of the addresses that the machine reported with the same address value. Provider-reported addresses always come before machine-reported addresses. Duplicates are removed.
func (*Machine) AddressesBySpaceID ¶
func (m *Machine) AddressesBySpaceID() (map[string][]network.SpaceAddress, error)
AddressesBySpaceID groups the machine addresses by space id and returns the result as a map where the space id is used a the key. Loopback addresses are skipped.
func (*Machine) AgentStartTime ¶
AgentStartTime returns the last recorded timestamp when the machine agent was started.
func (*Machine) AgentTools ¶
AgentTools returns the tools that the agent is currently running. It returns an error that satisfies errors.IsNotFound if the tools have not yet been set.
func (*Machine) AllAddresses ¶
AllAddresses returns the all addresses assigned to all devices of the machine.
func (*Machine) AllLinkLayerDevices ¶
func (m *Machine) AllLinkLayerDevices() ([]*LinkLayerDevice, error)
AllLinkLayerDevices returns all exiting link-layer devices of the machine.
func (*Machine) AllNetworkAddresses ¶
func (m *Machine) AllNetworkAddresses() (corenetwork.SpaceAddresses, error)
AllNetworkAddresses returns the result of AllAddresses(), but transformed to []network.Address.
func (*Machine) AllProviderInterfaceInfos ¶
func (m *Machine) AllProviderInterfaceInfos() ([]corenetwork.ProviderInterfaceInfo, error)
AllProviderInterfaceInfos returns the provider details for all of the link layer devices belonging to this machine. These can be used to identify the devices when interacting with the provider directly (for example, releasing container addresses).
func (*Machine) AllSpaces ¶
AllSpaces returns the set of spaceIDs that this machine is actively connected to.
func (*Machine) ApplicationNames ¶
ApplicationNames returns the names of applications represented by units running on the machine.
func (*Machine) AssertAliveOp ¶
AssertAliveOp returns an assert-only transaction operation that ensures the machine is alive.
func (*Machine) AvailabilityZone ¶
AvailabilityZone returns the provider-specific instance availability zone in which the machine was provisioned.
func (*Machine) CancelAction ¶
CancelAction is part of the ActionReceiver interface.
func (*Machine) CharmProfiles ¶
CharmProfiles returns the names of any LXD profiles used by the machine, which were defined in the charm deployed to that machine.
func (*Machine) CheckProvisioned ¶
CheckProvisioned returns true if the machine was provisioned with the given nonce.
func (*Machine) Clean ¶
Clean returns true if the machine does not have any deployed units or containers.
func (*Machine) CompleteUpgradeSeries ¶
CompleteUpgradeSeries notifies units and machines that an upgrade series is ready for its "completion" phase.
func (*Machine) CompletedActions ¶
CompletedActions is part of the ActionReceiver interface.
func (*Machine) Constraints ¶
func (m *Machine) Constraints() (constraints.Value, error)
Constraints returns the exact constraints that should apply when provisioning an instance for the machine.
func (*Machine) ContainerType ¶
func (m *Machine) ContainerType() instance.ContainerType
ContainerType returns the type of container hosting this machine.
func (*Machine) Containers ¶
Containers returns the container ids belonging to a parent machine. TODO(wallyworld): move this method to a service
func (*Machine) CreateUpgradeSeriesLock ¶
CreateUpgradeSeriesLock create a prepare lock for series upgrade. If this item exists in the database for a given machine it indicates that a machine's operating system is being upgraded from one series to another; for example, from xenial to bionic.
func (*Machine) Destroy ¶
Destroy sets the machine lifecycle to Dying if it is Alive. It does nothing otherwise. Destroy will fail if the machine has principal units assigned, or if the machine has JobManageModel. If the machine has assigned units, Destroy will return a HasAssignedUnitsError. If the machine has containers, Destroy will return HasContainersError.
func (*Machine) DestroyWithContainers ¶
DestroyWithContainers sets the machine lifecycle to Dying if it is Alive. It does nothing otherwise. DestroyWithContainers will fail if the machine has principal units assigned, or if the machine has JobManageModel. If the machine has assigned units, DestroyWithContainers will return a HasAssignedUnitsError. The machine is allowed to have containers. Use with caution. Intended for model tear down.
func (*Machine) EnsureDead ¶
EnsureDead sets the machine lifecycle to Dead if it is Alive or Dying. It does nothing otherwise. EnsureDead will fail if the machine has principal units assigned, or if the machine has JobManageModel. If the machine has assigned units, EnsureDead will return a HasAssignedUnitsError.
func (*Machine) ForceDestroy ¶
ForceDestroy queues the machine for complete removal, including the destruction of all units and containers on the machine.
func (*Machine) ForceDestroyed ¶
ForceDestroyed returns whether the destruction of a dying/dead machine was forced. It's always false for a machine that's alive.
func (*Machine) GetRebootFlag ¶
GetRebootFlag returns the reboot flag for this machine.
func (*Machine) GetUpgradeSeriesMessages ¶
GetUpgradeSeriesMessages returns all 'unseen' upgrade series notifications sorted by timestamp.
func (*Machine) HardwareCharacteristics ¶
func (m *Machine) HardwareCharacteristics() (*instance.HardwareCharacteristics, error)
TODO(wallyworld): move this method to a service.
func (*Machine) InstanceId ¶
InstanceId returns the provider specific instance id for this machine, or a NotProvisionedError, if not set.
func (*Machine) InstanceNames ¶
InstanceNames returns both the provider's instance id and a user-friendly display name. The display name is intended used for human input and is ignored internally.
func (*Machine) InstanceStatus ¶
func (m *Machine) InstanceStatus() (status.StatusInfo, error)
InstanceStatus returns the provider specific instance status for this machine, or a NotProvisionedError if instance is not yet provisioned.
func (*Machine) InstanceStatusHistory ¶
func (m *Machine) InstanceStatusHistory(filter status.StatusHistoryFilter) ([]status.StatusInfo, error)
InstanceStatusHistory 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 machine instance. Instance represents the provider underlying [v]hardware or container where this juju machine is deployed.
func (*Machine) IsContainer ¶
IsContainer returns true if the machine is a container.
func (*Machine) IsLockedForSeriesUpgrade ¶
IsLockedForSeriesUpgrade determines if a machine is locked for upgrade series.
func (*Machine) IsParentLockedForSeriesUpgrade ¶
IsParentLockedForSeriesUpgrade determines if a machine is a container who's parent is locked for series upgrade.
func (*Machine) Jobs ¶
func (m *Machine) Jobs() []MachineJob
Jobs returns the responsibilities that must be fulfilled by m's agent.
func (*Machine) KeepInstance ¶
KeepInstance reports whether a machine, when removed from Juju, will cause the corresponding cloud instance to be stopped.
func (*Machine) LinkLayerDevice ¶
func (m *Machine) LinkLayerDevice(name string) (*LinkLayerDevice, error)
LinkLayerDevice returns the link-layer device matching the given name. An error satisfying errors.IsNotFound() is returned when no such device exists on the machine.
func (*Machine) MachineAddresses ¶
func (m *Machine) MachineAddresses() (addresses network.SpaceAddresses)
MachineAddresses returns any hostnames and ips associated with a machine, determined by asking the machine itself.
func (*Machine) MachineTag ¶
func (m *Machine) MachineTag() names.MachineTag
MachineTag returns the more specific MachineTag type as opposed to the more generic Tag type.
func (*Machine) MarkForRemoval ¶
MarkForRemoval requests that this machine be removed after any needed provider-level cleanup is done.
func (*Machine) ModificationStatus ¶
func (m *Machine) ModificationStatus() (status.StatusInfo, error)
ModificationStatus returns the provider specific modification status for this machine or NotProvisionedError if instance is not yet provisioned.
func (*Machine) OpenedPortRanges ¶
func (m *Machine) OpenedPortRanges() (MachinePortRanges, error)
OpenedPortRanges returns the set of opened port ranges for this machine.
func (*Machine) ParentId ¶
ParentId returns the Id of the host machine if this machine is a container.
func (*Machine) PasswordValid ¶
PasswordValid returns whether the given password is valid for the given machine.
func (*Machine) PendingActions ¶
PendingActions is part of the ActionReceiver interface.
func (*Machine) Placement ¶
Placement returns the machine's Placement structure that should be used when provisioning an instance for the machine.
func (*Machine) Principals ¶
Principals returns the principals for the machine.
func (*Machine) PrivateAddress ¶
func (m *Machine) PrivateAddress() (network.SpaceAddress, error)
PrivateAddress returns a private address for the machine. If no address is available it returns an error that satisfies network.IsNoAddressError().
func (*Machine) ProviderAddresses ¶
func (m *Machine) ProviderAddresses() (addresses network.SpaceAddresses)
ProviderAddresses returns any hostnames and ips associated with a machine, as determined by asking the provider.
func (*Machine) PublicAddress ¶
func (m *Machine) PublicAddress() (network.SpaceAddress, error)
PublicAddress returns a public address for the machine. If no address is available it returns an error that satisfies network.IsNoAddressError().
func (*Machine) RecordAgentStartInformation ¶
RecordAgentStartInformation updates the host name (if non-empty) reported by the machine agent and sets the agent start time to the current time.
func (*Machine) Refresh ¶
Refresh refreshes the contents of the machine from the underlying state. It returns an error that satisfies errors.IsNotFound if the machine has been removed.
func (*Machine) Remove ¶
Remove removes the machine from state. It will fail if the machine is not Dead.
func (*Machine) RemoveAllAddresses ¶
RemoveAllAddresses removes all assigned addresses to all devices of the machine, in a single transaction. No error is returned when some or all of the addresses were already removed.
func (*Machine) RemoveAllLinkLayerDevices ¶
RemoveAllLinkLayerDevices removes all existing link-layer devices of the machine in a single transaction. No error is returned when some or all of the devices were already removed.
func (*Machine) RemoveUpgradeSeriesLock ¶
func (*Machine) RunningActions ¶
RunningActions is part of the ActionReceiver interface.
func (*Machine) SetAgentVersion ¶
SetAgentVersion sets the version of juju that the agent is currently running.
func (*Machine) SetCharmProfiles ¶
SetCharmProfiles sets the names of the charm profiles used on a machine in its instanceData.
func (*Machine) SetConstraints ¶
func (m *Machine) SetConstraints(cons constraints.Value) (err error)
SetConstraints sets the exact constraints to apply when provisioning an instance for the machine. It will fail if the machine is Dead, or if it is already provisioned.
func (*Machine) SetDevicesAddresses ¶
func (m *Machine) SetDevicesAddresses(devicesAddresses ...LinkLayerDeviceAddress) (err error)
SetDevicesAddresses sets the addresses of all devices in devicesAddresses, adding new or updating existing assignments as needed, in a single transaction. ProviderID field can be empty if not supported by the provider, but when set must be unique within the model. Errors are returned in the following cases:
- Machine is no longer alive or is missing;
- Subnet inferred from any CIDRAddress field in args is known but no longer alive (no error reported if the CIDRAddress does not match a known subnet);
- Model no longer alive;
- errors.NotValidError, when any of the fields in args contain invalid values;
- errors.NotFoundError, when any DeviceName in args refers to unknown device;
- ErrProviderIDNotUnique, when one or more specified ProviderIDs are not unique.
func (*Machine) SetInstanceInfo ¶
func (m *Machine) SetInstanceInfo( id instance.Id, displayName string, nonce string, characteristics *instance.HardwareCharacteristics, devicesArgs []LinkLayerDeviceArgs, devicesAddrs []LinkLayerDeviceAddress, volumes map[names.VolumeTag]VolumeInfo, volumeAttachments map[names.VolumeTag]VolumeAttachmentInfo, charmProfiles []string, ) error
SetInstanceInfo is used to provision a machine and in one step sets its instance ID, nonce, hardware characteristics, add link-layer devices and set their addresses as needed. After, set charm profiles if needed.
func (*Machine) SetInstanceStatus ¶
func (m *Machine) SetInstanceStatus(sInfo status.StatusInfo) (err error)
SetInstanceStatus sets the provider specific instance status for a machine.
func (*Machine) SetKeepInstance ¶
SetKeepInstance sets whether the cloud machine instance will be retained when the machine is removed from Juju. This is only relevant if an instance exists.
func (*Machine) SetLinkLayerDevices
deprecated
func (m *Machine) SetLinkLayerDevices(devicesArgs ...LinkLayerDeviceArgs) (err error)
SetLinkLayerDevices sets link-layer devices on the machine, adding or updating existing devices as needed, in a single transaction. ProviderID field can be empty if not supported by the provider, but when set must be unique within the model, and cannot be unset once set. Errors are returned in the following cases: - Machine is no longer alive or is missing; - Model no longer alive; - errors.NotValidError, when any of the fields in args contain invalid values;
Deprecated: (manadart 2020-10-12) This method is only used by tests and is in the process of removal. Do not add new usages of it.
func (*Machine) SetMachineAddresses ¶
func (m *Machine) SetMachineAddresses(addresses ...network.SpaceAddress) error
SetMachineAddresses records any addresses related to the machine, sourced by asking the machine.
func (*Machine) SetMachineBlockDevices ¶
func (m *Machine) SetMachineBlockDevices(info ...BlockDeviceInfo) error
SetMachineBlockDevices sets the block devices visible on the machine.
func (*Machine) SetModificationStatus ¶
func (m *Machine) SetModificationStatus(sInfo status.StatusInfo) (err error)
SetModificationStatus sets the provider specific modification status for a machine. Allowing the propagation of status messages to the operator.
func (*Machine) SetMongoPassword ¶
SetMongoPassword sets the password the agent responsible for the machine should use to communicate with the controllers. Previous passwords are invalidated.
func (*Machine) SetPassword ¶
SetPassword sets the password for the machine's agent.
func (*Machine) SetProviderAddresses ¶
func (m *Machine) SetProviderAddresses(addresses ...network.SpaceAddress) error
SetProviderAddresses records any addresses related to the machine, sourced by asking the provider.
func (*Machine) SetProvisioned ¶
func (m *Machine) SetProvisioned( id instance.Id, displayName string, nonce string, characteristics *instance.HardwareCharacteristics, ) (err error)
SetProvisioned stores the machine's provider-specific details in the database. These details are used to infer that the machine has been provisioned.
When provisioning an instance, a nonce should be created and passed when starting it, before adding the machine to the state. This means that if the provisioner crashes (or its connection to the state is lost) after starting the instance, we can be sure that only a single instance will be able to act for that machine.
Once set, the instance id cannot be changed. A non-empty instance id will be detected as a provisioned machine.
func (*Machine) SetRebootFlag ¶
SetRebootFlag sets the reboot flag of a machine to a boolean value. It will also do a lazy create of a reboot document if needed; i.e. If a document does not exist yet for this machine, it will create it.
func (*Machine) SetStatus ¶
func (m *Machine) SetStatus(statusInfo status.StatusInfo) error
SetStatus sets the status of the machine.
func (*Machine) SetSupportedContainers ¶
func (m *Machine) SetSupportedContainers(containers []instance.ContainerType) (err error)
SetSupportedContainers sets the list of containers supported by this machine.
func (*Machine) SetUpgradeSeriesMessagesAsSeen ¶
func (m *Machine) SetUpgradeSeriesMessagesAsSeen(messages []UpgradeSeriesMessage) error
SetUpgradeSeriesMessagesAsSeen marks a given upgrade series messages as having been seen by a client of the API.
func (*Machine) SetUpgradeSeriesStatus ¶
func (m *Machine) SetUpgradeSeriesStatus(status model.UpgradeSeriesStatus, message string) error
SetUpgradeSeriesStatus sets the status of the machine in the upgrade-series lock.
func (*Machine) SetUpgradeSeriesUnitStatus ¶
func (m *Machine) SetUpgradeSeriesUnitStatus(unitName string, status model.UpgradeSeriesStatus, message string) error
SetUpgradeSeriesUnitStatus sets the status of a series upgrade for a unit.
func (*Machine) ShouldRebootOrShutdown ¶
func (m *Machine) ShouldRebootOrShutdown() (RebootAction, error)
ShouldRebootOrShutdown check if the current node should reboot or shutdown If we are a container, and our parent needs to reboot, this should return: ShouldShutdown
func (*Machine) StartUpgradeSeriesUnitCompletion ¶
StartUpgradeSeriesUnitCompletion notifies units that an upgrade-series workflow is ready for its "completion" phase.
func (*Machine) Status ¶
func (m *Machine) Status() (status.StatusInfo, error)
Status returns the status of the machine.
func (*Machine) StatusHistory ¶
func (m *Machine) 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 machine.
func (*Machine) SupportedContainers ¶
func (m *Machine) SupportedContainers() ([]instance.ContainerType, bool)
SupportedContainers returns any containers this machine is capable of hosting, and a bool indicating if the supported containers have been determined or not.
func (*Machine) SupportsNoContainers ¶
SupportsNoContainers records the fact that this machine doesn't support any containers.
func (*Machine) Tag ¶
func (m *Machine) Tag() names.Tag
Tag returns a tag identifying the machine. The String method provides a string representation that is safe to use as a file name. The returned name will be different from other Tag values returned by any other entities from the same state.
func (*Machine) UpdateMachineSeries ¶
UpdateMachineSeries updates the series for the Machine.
func (*Machine) UpdateOperation ¶
func (m *Machine) UpdateOperation() *UpdateMachineOperation
UpdateOperation returns a model operation that will update the machine.
func (*Machine) UpgradeSeriesStatus ¶
func (m *Machine) UpgradeSeriesStatus() (model.UpgradeSeriesStatus, error)
func (*Machine) UpgradeSeriesTarget ¶
UpgradeSeriesTarget returns the series that the machine is being upgraded to.
func (*Machine) UpgradeSeriesUnitStatus ¶
func (m *Machine) UpgradeSeriesUnitStatus(unitName string) (model.UpgradeSeriesStatus, error)
UnitStatus returns the series upgrade status for the input unit.
func (*Machine) UpgradeSeriesUnitStatuses ¶
func (m *Machine) UpgradeSeriesUnitStatuses() (map[string]UpgradeSeriesUnitStatus, error)
UnitStatus returns the unit statuses from the upgrade-series lock for this machine.
func (*Machine) VolumeAttachments ¶
func (m *Machine) VolumeAttachments() ([]VolumeAttachment, error)
VolumeAttachments returns the machine's volume attachments.
func (*Machine) Watch ¶
func (m *Machine) Watch() NotifyWatcher
Watch returns a watcher for observing changes to a machine.
func (*Machine) WatchActionNotifications ¶
func (m *Machine) WatchActionNotifications() StringsWatcher
WatchActionNotifications is part of the ActionReceiver interface.
func (*Machine) WatchAddresses ¶
func (m *Machine) WatchAddresses() NotifyWatcher
WatchAddresses returns a new NotifyWatcher watching m's addresses.
func (*Machine) WatchAllContainers ¶
func (m *Machine) WatchAllContainers() StringsWatcher
WatchAllContainers returns a StringsWatcher that notifies of changes to the lifecycles of all containers on a machine.
func (*Machine) WatchContainers ¶
func (m *Machine) WatchContainers(ctype instance.ContainerType) StringsWatcher
WatchContainers returns a StringsWatcher that notifies of changes to the lifecycles of containers of the specified type on a machine.
func (*Machine) WatchForRebootEvent ¶
func (m *Machine) WatchForRebootEvent() NotifyWatcher
WatchForRebootEvent returns a notify watcher that will trigger an event when the reboot flag is set on our machine agent, our parent machine agent or grandparent machine agent
func (*Machine) WatchInstanceData ¶
func (m *Machine) WatchInstanceData() NotifyWatcher
WatchInstanceData returns a watcher for observing changes to a machine's instance data.
func (*Machine) WatchLXDProfileUpgradeNotifications ¶
func (m *Machine) WatchLXDProfileUpgradeNotifications(applicationName string) (StringsWatcher, error)
WatchLXDProfileUpgradeNotifications returns a watcher that observes the status of a lxd profile upgrade by monitoring changes on the unit machine's lxd profile upgrade completed field that is specific to an application name. Used by UniterAPI v9.
func (*Machine) WatchPendingActionNotifications ¶
func (m *Machine) WatchPendingActionNotifications() StringsWatcher
WatchPendingActionNotifications is part of the ActionReceiver interface.
func (*Machine) WatchPrincipalUnits ¶
func (m *Machine) WatchPrincipalUnits() StringsWatcher
WatchPrincipalUnits returns a StringsWatcher tracking the machine's principal units.
func (*Machine) WatchUnits ¶
func (m *Machine) WatchUnits() StringsWatcher
WatchUnits returns a new StringsWatcher watching m's units.
func (*Machine) WatchUpgradeSeriesNotifications ¶
func (m *Machine) WatchUpgradeSeriesNotifications() (NotifyWatcher, error)
WatchUpgradeSeriesNotifications returns a watcher that observes the status of a series upgrade by monitoring changes to its parent machine's upgrade series lock.
type MachineJob ¶
type MachineJob int
MachineJob values define responsibilities that machines may be expected to fulfil.
const ( JobHostUnits MachineJob JobManageModel )
func (MachineJob) MigrationValue ¶
func (job MachineJob) MigrationValue() string
MigrationValue converts the state job into a useful human readable string for model migration.
func (MachineJob) String ¶
func (job MachineJob) String() string
func (MachineJob) ToParams ¶
func (job MachineJob) ToParams() model.MachineJob
ToParams returns the job as model.MachineJob.
type MachineModelInfo ¶
type MachineModelInfo struct { Id string Hardware *instance.HardwareCharacteristics InstanceId string Status string }
MachineModelInfo contains the summary information about a machine for a given model.
type MachinePortRanges ¶
type MachinePortRanges interface { // MachineID returns the ID of the machine that this set of port ranges // applies to. MachineID() string // ByUnit returns the set of port ranges opened by each unit in a // particular machine subnet grouped by unit name. ByUnit() map[string]UnitPortRanges // ForUnit returns the set of port ranges opened by the specified unit // in a particular machine subnet. ForUnit(unitName string) UnitPortRanges // Changes returns a ModelOperation for applying any changes that were // made to this port range instance for all machine units. Changes() ModelOperation // UniquePortRanges returns a slice of unique open PortRanges for // all units on this machine. UniquePortRanges() []network.PortRange }
MachinePortRanges is implemented by types that can query and/or manipulate the set of port ranges opened by one or more units in a machine.
type MachineTemplate ¶
type MachineTemplate struct { // Series is the series to be associated with the new machine. Series string // Constraints are the constraints to be used when finding // an instance for the machine. Constraints constraints.Value // Jobs holds the jobs to run on the machine's instance. // A machine must have at least one job to do. // JobManageModel can only be part of the jobs // when the first (bootstrap) machine is added. Jobs []MachineJob // Addresses holds the addresses to be associated with the // new machine. // // TODO(dimitern): This should be removed once all addresses // come from link-layer device addresses. Addresses network.SpaceAddresses // InstanceId holds the instance id to associate with the machine. // If this is empty, the provisioner will try to provision the machine. // If this is non-empty, the HardwareCharacteristics and Nonce // fields must be set appropriately. InstanceId instance.Id // HardwareCharacteristics holds the h/w characteristics to // be associated with the machine. HardwareCharacteristics instance.HardwareCharacteristics // LinkLayerDevices holds a list of arguments for setting link-layer devices // on the machine. LinkLayerDevices []LinkLayerDeviceArgs // Volumes holds the parameters for volumes that are to be created // and attached to the machine. Volumes []HostVolumeParams // VolumeAttachments holds the parameters for attaching existing // volumes to the machine. VolumeAttachments map[names.VolumeTag]VolumeAttachmentParams // Filesystems holds the parameters for filesystems that are to be // created and attached to the machine. Filesystems []HostFilesystemParams // FilesystemAttachments holds the parameters for attaching existing // filesystems to the machine. FilesystemAttachments map[names.FilesystemTag]FilesystemAttachmentParams // Nonce holds a unique value that can be used to check // if a new instance was really started for this machine. // See Machine.SetProvisioned. This must be set if InstanceId is set. Nonce string // Dirty signifies whether the new machine will be treated // as unclean for unit-assignment purposes. Dirty bool // Placement holds the placement directive that will be associated // with the machine. Placement string // contains filtered or unexported fields }
MachineTemplate holds attributes that are to be associated with a newly created machine.
type MeterStatus ¶
type MeterStatus struct { Code MeterStatusCode Info string }
MeterStatus represents the metering status of a unit.
func (*MeterStatus) Severity ¶
func (m *MeterStatus) Severity() int
Severity returns relative severity of the meter status.
type MeterStatusCode ¶
type MeterStatusCode int
MeterStatusCode represents the meter status code of a unit. The int value represents its relative severity when compared to other MeterStatusCodes.
const ( MeterNotAvailable MeterStatusCode = iota MeterRed MeterAmber MeterNotSet MeterGreen )
This const block defines the relative severities of the valid MeterStatusCodes in ascending order.
func MeterStatusFromString ¶
func MeterStatusFromString(str string) MeterStatusCode
MeterStatusFromString returns a valid MeterStatusCode given a string representation.
func (MeterStatusCode) Severity ¶
func (m MeterStatusCode) Severity() int
Severity returns the relative severity.
func (MeterStatusCode) String ¶
func (m MeterStatusCode) String() string
String returns a human readable string representation of the meter status.
type Metric ¶
type Metric struct { Key string `bson:"key"` Value string `bson:"value"` Time time.Time `bson:"time"` Labels map[string]string `bson:"labels,omitempty"` }
Metric represents a single Metric.
type MetricBatch ¶
type MetricBatch struct {
// contains filtered or unexported fields
}
MetricBatch represents a batch of metrics reported from a unit. These will be received from the unit in batches. The main contents of the metric (key, value) is defined by the charm author and sent from the unit via a call to add-metric
func (*MetricBatch) CharmURL ¶
func (m *MetricBatch) CharmURL() string
CharmURL returns the charm url for the charm this metric was generated in.
func (*MetricBatch) Created ¶
func (m *MetricBatch) Created() time.Time
Created returns the time this metric batch was created.
func (*MetricBatch) Credentials ¶
func (m *MetricBatch) Credentials() []byte
Credentials returns any credentials associated with the metric batch.
func (*MetricBatch) MarshalJSON ¶
func (m *MetricBatch) MarshalJSON() ([]byte, error)
MarshalJSON defines how the MetricBatch type should be converted to json.
func (*MetricBatch) Metrics ¶
func (m *MetricBatch) Metrics() []Metric
Metrics returns the metrics in this batch.
func (*MetricBatch) ModelUUID ¶
func (m *MetricBatch) ModelUUID() string
ModelUUID returns the model UUID this metric applies to.
func (*MetricBatch) SLACredentials ¶
func (m *MetricBatch) SLACredentials() []byte
SLACredentials returns any sla credentials associated with the metric batch.
func (*MetricBatch) Sent ¶
func (m *MetricBatch) Sent() bool
Sent returns a flag to tell us if this metric has been sent to the metric collection service
func (*MetricBatch) SetSent ¶
func (m *MetricBatch) SetSent(t time.Time) error
SetSent marks the metric has having been sent at the specified time.
func (*MetricBatch) UniqueMetrics ¶
func (m *MetricBatch) UniqueMetrics() []Metric
UniqueMetrics returns only the last value for each metric key in this batch.
func (*MetricBatch) Unit ¶
func (m *MetricBatch) Unit() string
Unit returns the name of the unit this metric was generated in.
type MetricsManager ¶
type MetricsManager struct {
// contains filtered or unexported fields
}
MetricsManager stores data about the state of the metrics manager
func (*MetricsManager) ConsecutiveErrors ¶
func (m *MetricsManager) ConsecutiveErrors() int
ConsecutiveErrors returns the number of consecutive failures.
func (*MetricsManager) GracePeriod ¶
func (m *MetricsManager) GracePeriod() time.Duration
GracePeriod returns the current grace period.
func (*MetricsManager) IncrementConsecutiveErrors ¶
func (m *MetricsManager) IncrementConsecutiveErrors() error
IncrementConsecutiveErrors adds 1 to the consecutive errors count.
func (*MetricsManager) LastSuccessfulSend ¶
func (m *MetricsManager) LastSuccessfulSend() time.Time
LastSuccessfulSend returns the time of the last successful send.
func (*MetricsManager) MeterStatus ¶
func (m *MetricsManager) MeterStatus() MeterStatus
MeterStatus returns the overall state of the MetricsManager as a meter status summary.
func (*MetricsManager) ModelStatus ¶
func (m *MetricsManager) ModelStatus() MeterStatus
func (*MetricsManager) SetGracePeriod ¶
func (m *MetricsManager) SetGracePeriod(t time.Duration) error
func (*MetricsManager) SetLastSuccessfulSend ¶
func (m *MetricsManager) SetLastSuccessfulSend(t time.Time) error
SetLastSuccessfulSend sets the last successful send time to the input time.
type MigrationMode ¶
type MigrationMode string
MigrationMode specifies where the Model is with respect to migration.
type MigrationSpec ¶
type MigrationSpec struct { InitiatedBy names.UserTag TargetInfo migration.TargetInfo }
MigrationSpec holds the information required to create a ModelMigration instance.
func (*MigrationSpec) Validate ¶
func (spec *MigrationSpec) Validate() error
Validate returns an error if the MigrationSpec contains bad data. Nil is returned otherwise.
type MinionReports ¶
type MinionReports struct { Succeeded []names.Tag Failed []names.Tag Unknown []names.Tag }
MinionReports indicates the sets of agents whose migration minion workers have completed the current migration phase, have failed to complete the current migration phase, or are yet to report regarding the current migration phase.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model represents the state of a model.
func (*Model) ActionByTag ¶
ActionByTag returns an Action given an ActionTag.
func (*Model) AddUser ¶
func (m *Model) AddUser(spec UserAccessSpec) (permission.UserAccess, error)
AddUser adds a new user for the model to the database.
func (*Model) AgentVersion ¶
AgentVersion returns the agent version for the model config. If no agent version is found, it returns NotFound error.
func (*Model) AllActions ¶
AllActions returns all Actions.
func (*Model) AllConstraints ¶
func (m *Model) AllConstraints() (*ModelConstraints, error)
AllConstraints retrieves all the constraints in the model and provides a way to query based on machine or application.
func (*Model) AllEndpointBindings ¶
AllEndpointBindings returns all endpoint->space bindings keyed by application name.
func (*Model) AllInstanceData ¶
func (m *Model) AllInstanceData() (*ModelInstanceData, error)
AllInstanceData retrieves all instance data in the model and provides a way to query hardware characteristics and charm profiles by machine.
func (*Model) AllOperations ¶
AllOperations returns all Operations.
func (*Model) Annotation ¶
func (m *Model) Annotation(entity GlobalEntity, key string) (string, error)
Annotation returns the annotation value corresponding to the given key. If the requested annotation is not found, an empty string is returned.
func (*Model) Annotations ¶
func (m *Model) Annotations(entity GlobalEntity) (map[string]string, error)
Annotations returns all the annotations corresponding to an entity.
func (*Model) AutoConfigureContainerNetworking ¶
func (m *Model) AutoConfigureContainerNetworking(environ environs.BootstrapEnviron) error
AutoConfigureContainerNetworking tries to set up best container networking available for the specific model if user hasn't set anything.
func (*Model) Branch ¶
func (m *Model) Branch(name string) (*Generation, error)
Branch retrieves the generation with the the input branch name from the collection of not-yet-completed generations.
func (*Model) Branches ¶
func (m *Model) Branches() ([]*Generation, error)
Branches returns all "in-flight" branches for the model.
func (*Model) CloudCredential ¶
func (m *Model) CloudCredential() (Credential, bool, error)
CloudCredential returns the cloud credential used for managing the model's cloud resources, and a boolean indicating whether a credential is set.
func (*Model) CloudCredentialTag ¶
CloudCredentialTag returns the tag of the cloud credential used for managing the model's cloud resources, and a boolean indicating whether a credential is set.
func (*Model) CloudRegion ¶
CloudRegion returns the name of the cloud region to which the model is deployed.
func (*Model) ControllerTag ¶
func (m *Model) ControllerTag() names.ControllerTag
ControllerTag is the tag for the controller that the model is running within.
func (*Model) ControllerUUID ¶
ControllerUUID returns the universally unique identifier of the controller in which the model is running.
func (*Model) Destroy ¶
func (m *Model) Destroy(args DestroyModelParams) (err error)
Destroy sets the models's lifecycle to Dying, preventing addition of applications or machines to state. If called on an empty hosted model, the lifecycle will be advanced straight to Dead.
func (*Model) EnqueueAction ¶
func (m *Model) EnqueueAction(operationID string, receiver names.Tag, actionName string, payload map[string]interface{}, parallel bool, executionGroup string) (Action, error)
EnqueueAction caches the action doc to the database.
func (*Model) EnqueueOperation ¶
EnqueueOperation records the start of an operation.
func (*Model) EnvironVersion ¶
EnvironVersion is the version of the model's environ -- the related cloud provider resources. The environ version is used by the controller to identify environ/provider upgrade steps to run for a model's environ after the controller is upgraded, or the model is migrated to another controller.
func (*Model) FindActionsByName ¶
FindActionsByName finds Actions with the given name.
func (*Model) ForceDestroyed ¶
ForceDestroyed returns whether the destruction of a dying/dead model was forced. It's always false for a model that's alive.
func (*Model) Generation ¶
func (m *Model) Generation(id int) (*Generation, error)
Generation retrieves the generation with the the input generation_id from the collection of completed generations.
func (*Model) Generations ¶
func (m *Model) Generations() ([]*Generation, error)
Generations returns all committed branches.
func (*Model) IsControllerModel ¶
IsControllerModel returns a boolean indicating whether this model is responsible for running a controller.
func (*Model) LastModelConnection ¶
LastModelConnection returns when this User last connected through the API in UTC. The resulting time will be nil if the user has never logged in.
func (*Model) LatestToolsVersion ¶
func (m *Model) LatestToolsVersion() version.Number
LatestToolsVersion returns the newest version found in the last check in the streams. Bear in mind that the check was performed filtering only new patches for the current major.minor. (major.minor.patch)
func (*Model) ListOperations ¶
func (m *Model) ListOperations( actionNames []string, actionReceivers []names.Tag, operationStatus []ActionStatus, offset, limit int, ) ([]OperationInfo, bool, error)
ListOperations returns operations that match the specified criteria.
func (*Model) LoadModelStatus ¶
func (m *Model) LoadModelStatus() (*ModelStatus, error)
LoadModelStatus retrieves all the status documents for the model at once. Used to primarily speed up status.
func (*Model) MeterStatus ¶
func (m *Model) MeterStatus() MeterStatus
MeterStatus returns the current meter status for this model.
func (*Model) MigrationMode ¶
func (m *Model) MigrationMode() MigrationMode
MigrationMode returns whether the model is active or being migrated.
func (*Model) ModelConfig ¶
ModelConfig returns the complete config for the model
func (*Model) ModelConfigValues ¶
func (model *Model) ModelConfigValues() (config.ConfigValues, error)
ModelConfigValues returns the config values for the model represented by this state.
func (*Model) ModelTag ¶
func (m *Model) ModelTag() names.ModelTag
ModelTag is the concrete model tag for this model.
func (*Model) OpenedPortRangesForAllMachines ¶
func (m *Model) OpenedPortRangesForAllMachines() ([]MachinePortRanges, error)
OpenedPortRangesForAllMachines returns a slice of opened port ranges for all machines managed by this model.
func (*Model) OpenedPortRangesForMachine ¶
func (m *Model) OpenedPortRangesForMachine(machineID string) (MachinePortRanges, error)
OpenedPortRangesForMachine returns the set of opened port ranges for one of the model's machines.
func (*Model) OperationWithActions ¶
func (m *Model) OperationWithActions(id string) (*OperationInfo, error)
OperationWithActions returns an OperationInfo by Id.
func (*Model) Owner ¶
func (m *Model) Owner() names.UserTag
Owner returns tag representing the owner of the model. The owner is the user that created the model.
func (*Model) PasswordHash ¶
PasswordHash returns the password hash set on the model document
func (*Model) PasswordValid ¶
PasswordValid returns whether the given password is valid for the given application.
func (*Model) SLACredential ¶
SLACredential returns the SLA credential.
func (*Model) SLAOwner ¶
SLAOwner returns the SLA owner as a string. Note that this may differ from the model owner.
func (*Model) SetAnnotations ¶
func (m *Model) SetAnnotations(entity GlobalEntity, annotations map[string]string) (err error)
SetAnnotations adds key/value pairs to annotations in MongoDB.
func (*Model) SetCloudCredential ¶
SetCloudCredential sets new cloud credential for this model. Returned bool indicates if model credential was set.
func (*Model) SetEnvironVersion ¶
SetEnvironVersion sets the model's current environ version. The value must be monotonically increasing.
func (*Model) SetMeterStatus ¶
SetMeterStatus sets the current meter status for this model.
func (*Model) SetMigrationMode ¶
func (m *Model) SetMigrationMode(mode MigrationMode) error
SetMigrationMode updates the migration mode of the model.
func (*Model) SetPassword ¶
SetPassword sets the password for the model's agent.
func (*Model) SetStatus ¶
func (m *Model) SetStatus(sInfo status.StatusInfo) error
SetStatus sets the status of the model.
func (*Model) State ¶
(TODO) externalreality: Temporary method to access state from model while factoring Model concerns out from state.
func (*Model) Status ¶
func (m *Model) Status() (status.StatusInfo, error)
Status returns the status of the model.
func (*Model) StatusHistory ¶
func (m *Model) 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 (*Model) Tag ¶
func (m *Model) Tag() names.Tag
Tag returns a name identifying the model. The returned name will be different from other Tag values returned by any other entities from the same state.
func (*Model) UpdateLastModelConnection ¶
UpdateLastModelConnection updates the last connection time of the model user.
func (*Model) UpdateLatestToolsVersion ¶
UpdateLatestToolsVersion looks up for the latest available version of juju tools and updates modelDoc with it.
func (*Model) UpdateModelConfig ¶
func (m *Model) UpdateModelConfig(updateAttrs map[string]interface{}, removeAttrs []string, additionalValidation ...ValidateConfigFunc) error
UpdateModelConfig adds, updates or removes attributes in the current configuration of the model with the provided updateAttrs and removeAttrs.
func (*Model) Users ¶
func (m *Model) Users() ([]permission.UserAccess, error)
Users returns a slice of all users for this model.
func (*Model) ValidateCloudCredential ¶
func (m *Model) ValidateCloudCredential(tag names.CloudCredentialTag, credential cloud.Credential) error
ValidateCloudCredential validates new cloud credential for this model.
func (*Model) Watch ¶
func (m *Model) Watch() NotifyWatcher
Watch returns a watcher for observing changes to a model.
func (*Model) WatchActionResults ¶
func (m *Model) WatchActionResults() StringsWatcher
WatchActionResults starts and returns a StringsWatcher that notifies on new ActionResults being added.
func (*Model) WatchActionResultsFilteredBy ¶
func (m *Model) WatchActionResultsFilteredBy(receivers ...ActionReceiver) StringsWatcher
WatchActionResultsFilteredBy starts and returns a StringsWatcher that notifies on new ActionResults being added for the ActionRecevers being watched.
func (*Model) WatchCloudSpecChanges ¶
func (model *Model) WatchCloudSpecChanges() NotifyWatcher
WatchCloudSpecChanges returns a NotifyWatcher waiting for the cloud to change for the model.
func (*Model) WatchForModelConfigChanges ¶
func (model *Model) WatchForModelConfigChanges() NotifyWatcher
WatchForModelConfigChanges returns a NotifyWatcher waiting for the Model Config to change.
func (*Model) WatchModelCredential ¶
func (m *Model) WatchModelCredential() NotifyWatcher
WatchModelCredential returns a new NotifyWatcher that watches a model reference to a cloud credential.
type ModelAccessInfo ¶
type ModelAccessor ¶
type ModelAccessor interface { WatchForModelConfigChanges() NotifyWatcher ModelConfig() (*config.Config, error) }
ModelAccessor defines the methods needed to watch for model config changes, and read the model config.
type ModelArgs ¶
type ModelArgs struct { // Type specifies the general type of the model (IAAS or CAAS). Type ModelType // CloudName is the name of the cloud to which the model is deployed. CloudName string // CloudRegion is the name of the cloud region to which the model is // deployed. This will be empty for clouds that do not support regions. CloudRegion string // CloudCredential is the tag of the cloud credential that will be // used for managing cloud resources for this model. This will be // empty for clouds that do not require credentials. CloudCredential names.CloudCredentialTag // Config is the model config. Config *config.Config // Constraints contains the initial constraints for the model. Constraints constraints.Value // StorageProviderRegistry is used to determine and store the // details of the default storage pools. StorageProviderRegistry storage.ProviderRegistry // Owner is the user that owns the model. Owner names.UserTag // MigrationMode is the initial migration mode of the model. MigrationMode MigrationMode // EnvironVersion is the initial version of the Environ for the model. EnvironVersion int // PasswordHash is used by the caas model operator. PasswordHash string }
ModelArgs is a params struct for creating a new model.
type ModelBatchParam ¶
ModelBatchParam contains the properties of a metric batch for a model The model uuid will be attenuated in the call to AddModelMetrics.
type ModelConstraints ¶
type ModelConstraints struct {
// contains filtered or unexported fields
}
ModelConstraints represents all the contraints in a model keyed on global key.
func (*ModelConstraints) Machine ¶
func (c *ModelConstraints) Machine(machineID string) constraints.Value
Machine returns the constraints for the specified machine.
type ModelInstanceData ¶
type ModelInstanceData struct {
// contains filtered or unexported fields
}
ModelInstanceData represents all the instance data for a model keyed on machine ID.
func (*ModelInstanceData) CharmProfiles ¶
func (d *ModelInstanceData) CharmProfiles(machineID string) []string
CharmProfiles returns the names of the profiles that are defined for the machine. If the machine isn't found in the map, a nil is returned.
func (*ModelInstanceData) HardwareCharacteristics ¶
func (d *ModelInstanceData) HardwareCharacteristics(machineID string) *instance.HardwareCharacteristics
HardwareCharacteristics returns the hardware characteristics of the machine. If it isn't found in the map, a nil is returned.
func (*ModelInstanceData) InstanceNames ¶
func (d *ModelInstanceData) InstanceNames(machineID string) (instance.Id, string)
InstanceNames returns both the provider instance id and the user friendly name. If the machine isn't found, empty strings are returned.
type ModelMachinesWatcher ¶
type ModelMachinesWatcher interface { WatchModelMachines() StringsWatcher WatchModelMachineStartTimes(quiesceInterval time.Duration) StringsWatcher }
ModelMachinesWatcher defines a the methods required for listening to machine lifecycle events or a combination of lifecycle events and changes to the agent start time field. WatchModelMachines.
type ModelMigration ¶
type ModelMigration interface { // Id returns a unique identifier for the model migration. Id() string // ModelUUID returns the UUID for the model being migrated. ModelUUID() string // Attempt returns the migration attempt identifier. This // increments for each migration attempt for the model. Attempt() int // StartTime returns the time when the migration was started. StartTime() time.Time // SuccessTime returns the time when the migration reached // SUCCESS. SuccessTime() time.Time // EndTime returns the time when the migration reached DONE or // REAPFAILED. EndTime() time.Time // Phase returns the migration's phase. Phase() (migration.Phase, error) // PhaseChangedTime returns the time when the migration's phase // last changed. PhaseChangedTime() time.Time // StatusMessage returns human readable text about the current // progress of the migration. StatusMessage() string // InitiatedBy returns username the initiated the migration. InitiatedBy() string // TargetInfo returns the details required to connect to the // migration's target controller. TargetInfo() (*migration.TargetInfo, error) // SetPhase sets the phase of the migration. An error will be // returned if the new phase does not follow the current phase or // if the migration is no longer active. SetPhase(nextPhase migration.Phase) error // SetStatusMessage sets some human readable text about the // current progress of the migration. SetStatusMessage(text string) error // SubmitMinionReport records a report from a migration minion // worker about the success or failure to complete its actions for // a given migration phase. SubmitMinionReport(tag names.Tag, phase migration.Phase, success bool) error // MinionReports returns details of the minions that have reported // success or failure for the current migration phase, as well as // those which are yet to report. MinionReports() (*MinionReports, error) // WatchMinionReports returns a notify watcher which triggers when // a migration minion has reported back about the success or failure // of its actions for the current migration phase. WatchMinionReports() (NotifyWatcher, error) // Refresh updates the contents of the ModelMigration from the // underlying state. Refresh() error // ModelUserAccess returns the type of access that the given tag had to // the model prior to it being migrated. ModelUserAccess(names.Tag) permission.Access }
ModelMigration represents the state of an migration attempt for a model.
type ModelOperation ¶
type ModelOperation interface { // Build builds the low-level database transaction operations required // to apply the change. If the transaction operations fail (e.g. due // to concurrent changes), then Build may be called again. The attempt // number, starting at zero, is passed in. // // Build is treated as a jujutxn.TransactionSource, so the errors // in the jujutxn package may be returned by Build to influence // transaction execution. Build(attempt int) ([]txn.Op, error) // Done is called after the operation is run, whether it succeeds or // not. The result of running the operation is passed in, and the Done // method may annotate the error; or run additional, non-transactional // logic depending on the outcome. Done(error) error }
ModelOperation is a high-level model operation, encapsulating the logic required to apply a change to a model.
func ComposeModelOperations ¶
func ComposeModelOperations(modelOps ...ModelOperation) ModelOperation
ComposeModelOperations returns a ModelOperation which composes multiple ModelOperations and executes them in a single transaction. If any of the provided ModelOperations are nil, they will be automatically ignored.
type ModelPayloads ¶
type ModelPayloads struct {
// contains filtered or unexported fields
}
ModelPayloads lets you read all unit payloads in a model.
func (ModelPayloads) ListAll ¶
func (mp ModelPayloads) ListAll() ([]payload.FullPayloadInfo, error)
ListAll builds the list of payload information that is registered in state.
type ModelSessioner ¶
type ModelSessioner interface { MongoSessioner // ModelUUID returns the ID of the current model. ModelUUID() string }
ModelSessioner supports creating new mongo sessions for a model.
type ModelStatus ¶
type ModelStatus struct {
// contains filtered or unexported fields
}
ModelStatus holds all the current status values for a given model and offers accessors for the various parts of a model.
func (*ModelStatus) FullUnitWorkloadVersion ¶
func (m *ModelStatus) FullUnitWorkloadVersion(unitName string) (status.StatusInfo, error)
FullUnitWorkloadVersion returns the full status info for the workload version of a unit. This is used for selecting the workload version for an application.
func (*ModelStatus) MachineAgent ¶
func (m *ModelStatus) MachineAgent(machineID string) (status.StatusInfo, error)
MachineAgent returns the status of the machine agent.
func (*ModelStatus) MachineInstance ¶
func (m *ModelStatus) MachineInstance(machineID string) (status.StatusInfo, error)
MachineInstance returns the status of the machine instance.
func (*ModelStatus) MachineModification ¶
func (m *ModelStatus) MachineModification(machineID string) (status.StatusInfo, error)
MachineModification returns the status of the machine modification
func (*ModelStatus) Model ¶
func (m *ModelStatus) Model() (status.StatusInfo, error)
Model returns the status of the model.
func (*ModelStatus) UnitAgent ¶
func (m *ModelStatus) UnitAgent(unitName string) (status.StatusInfo, error)
UnitAgent returns the status of the Unit's agent.
func (*ModelStatus) UnitWorkload ¶
func (m *ModelStatus) UnitWorkload(unitName string, expectWorkload bool) (status.StatusInfo, error)
UnitWorkload returns the status of the unit's workload.
func (*ModelStatus) UnitWorkloadVersion ¶
func (m *ModelStatus) UnitWorkloadVersion(unitName string) (string, error)
UnitWorkloadVersion returns workload version for the unit
type ModelSummary ¶
type ModelSummary struct { Name string UUID string Type ModelType Owner string ControllerUUID string IsController bool Life Life CloudTag string CloudRegion string CloudCredentialTag string // SLA contains the information about the SLA for the model, if set. SLALevel string SLAOwner string // Needs Config() ProviderType string DefaultSeries string AgentVersion *version.Number // Needs Statuses collection Status status.StatusInfo // Access is the access level the supplied user has on this model Access permission.Access // UserLastConnection is the last time this user has accessed this model UserLastConnection *time.Time MachineCount int64 CoreCount int64 UnitCount int64 // Needs Migration collection // Do we need all the Migration fields? // Migration needs to be a pointer as we may not always have one. Migration ModelMigration }
ModelSummary describe interesting information for a given model. This is meant to match the values that a user wants to see as part of either show-model or list-models.
type ModelType ¶
type ModelType string
ModelType signals the type of a model - IAAS or CAAS
func ParseModelType ¶
ParseModelType turns a valid model type string into a ModelType constant.
type MongoSessioner ¶
type MongoSessioner interface {
// MongoSession creates a new Mongo session.
MongoSession() *mgo.Session
}
MongoSessioner supports creating new mongo sessions.
type NewPolicyFunc ¶
NewPolicyFunc is the type of a function that, given a *State, returns a Policy for that State.
type NotifyWatcher ¶
type NotifyWatcher interface { Watcher Changes() <-chan struct{} }
NotifyWatcher generates signals when something changes, but it does not return any content for those changes
type NotifyWatcherFactory ¶
type NotifyWatcherFactory interface {
Watch() NotifyWatcher
}
NotifyWatcherFactory represents an entity that can be watched.
type OfferConnection ¶
type OfferConnection struct {
// contains filtered or unexported fields
}
OfferConnection represents the state of a relation to an offer hosted in this model.
func (*OfferConnection) OfferUUID ¶
func (oc *OfferConnection) OfferUUID() string
OfferUUID returns the offer UUID.
func (*OfferConnection) RelationId ¶
func (oc *OfferConnection) RelationId() int
RelationId is the id of the relation to which this connection pertains.
func (*OfferConnection) RelationKey ¶
func (oc *OfferConnection) RelationKey() string
RelationKey is the key of the relation to which this connection pertains.
func (*OfferConnection) SourceModelUUID ¶
func (oc *OfferConnection) SourceModelUUID() string
SourceModelUUID is the uuid of the consuming model.
func (*OfferConnection) String ¶
func (oc *OfferConnection) String() string
String returns the details of the connection.
func (*OfferConnection) UserName ¶
func (oc *OfferConnection) UserName() string
UserName returns the name of the user who created this connection.
type OpenParams ¶
type OpenParams struct { // Clock is the clock used for time-related operations. Clock clock.Clock // ControllerTag is the tag of the controller. ControllerTag names.ControllerTag // ControllerModelTag is the tag of the controller model. ControllerModelTag names.ModelTag // MongoSession is the mgo.Session to use for storing and // accessing state data. The caller remains responsible // for closing this session; Open will copy it. MongoSession *mgo.Session // NewPolicy, if non-nil, returns a policy which will be used to // validate and modify behaviour of certain operations in state. NewPolicy NewPolicyFunc // RunTransactionObserver, if non-nil, is a function that will // be called after mgo/txn transactions are run, successfully // or not. RunTransactionObserver RunTransactionObserverFunc // InitDatabaseFunc, if non-nil, is a function that will be called // just after the state database is opened. InitDatabaseFunc InitDatabaseFunc }
OpenParams contains the parameters for opening the state database.
func (OpenParams) Validate ¶
func (p OpenParams) Validate() error
Validate validates the OpenParams.
type Operation ¶
type Operation interface { Entity // Id returns the local id of the Operation. Id() string // Enqueued returns the time the operation was added to state. Enqueued() time.Time // Started returns the time that the first Action execution began. Started() time.Time // Completed returns the completion time of the last Action. Completed() time.Time // Summary is the reason for running the operation. Summary() string // Status returns the final state of the operation. Status() ActionStatus // OperationTag returns the operation's tag. OperationTag() names.OperationTag // Refresh refreshes the contents of the operation. Refresh() error }
Operation represents a number of tasks resulting from running an action. The Operation provides both the justification for individual tasks to be performed and the grouping of them.
As an example, if an action is run targeted to several units, the operation would reflect the request to run the actions, while the individual tasks would track the running of the individual actions on each unit.
type OperationInfo ¶
OperationInfo encapsulates an operation and summary information about some of its actions.
type Persistence ¶
type Persistence interface { // One populates doc with the document corresponding to the given // ID. Missing documents result in errors.NotFound. One(collName, id string, doc interface{}) error // All populates docs with the list of the documents corresponding // to the provided query. All(collName string, query, docs interface{}) error // Run runs the transaction generated by the provided factory // function. It may be retried several times. Run(transactions jujutxn.TransactionSource) error // NewStorage returns a new blob storage for the model. NewStorage() storage.Storage // ApplicationExistsOps returns the operations that verify that the // identified application exists. ApplicationExistsOps(applicationID string) []txn.Op // IncCharmModifiedVersionOps returns the operations necessary to increment // the CharmModifiedVersion field for the given application. IncCharmModifiedVersionOps(applicationID string) []txn.Op }
Persistence exposes persistence-layer functionality of State.
type Platform ¶
type Platform struct { Architecture string `bson:"architecture,omitempty"` OS string `bson:"os,omitempty"` Series string `bson:"series,omitempty"` }
Platform identifies the platform the charm was installed on.
type Policy ¶
type Policy interface { // Prechecker returns a Prechecker or an error. Prechecker() (environs.InstancePrechecker, error) // ProviderConfigSchemaSource returns a config.ConfigSchemaSource // for the cloud, or an error. ProviderConfigSchemaSource(cloudName string) (config.ConfigSchemaSource, error) // ConfigValidator returns a config.Validator or an error. ConfigValidator() (config.Validator, error) // ConstraintsValidator returns a constraints.Validator or an error. ConstraintsValidator(context.ProviderCallContext) (constraints.Validator, error) // InstanceDistributor returns an context.Distributor or an error. InstanceDistributor() (context.Distributor, error) // StorageProviderRegistry returns a storage.ProviderRegistry or an error. StorageProviderRegistry() (storage.ProviderRegistry, error) }
Policy is an interface provided to State that may be consulted by State to validate or modify the behaviour of certain operations.
If a Policy implementation does not implement one of the methods, it must return an error that satisfies errors.IsNotImplemented, and will thus be ignored. Any other error will cause an error in the use of the policy.
type PoolHelper ¶
PoolHelper describes methods for working with a pool-supplied state.
type PoolItem ¶
type PoolItem struct {
// contains filtered or unexported fields
}
PoolItem tracks the usage of a State instance unique to a model. It associates context information about state usage for each reference holder by associating it with a unique key. It tracks whether the state has been marked for removal from the pool.
type PooledState ¶
type PooledState struct { *State // contains filtered or unexported fields }
PooledState is a wrapper for a State reference, indicating that it is managed by a pool.
func (*PooledState) Annotate ¶
func (ps *PooledState) Annotate(context string)
Annotate writes the supplied context information back to the pool item. The information is stored against the unique ID for the referer, indicated by the itemKey member.
func (*PooledState) Release ¶
func (ps *PooledState) Release() bool
Release indicates that the pooled state is no longer required and can be removed from the pool if there are no other references to it. The return indicates whether the released state was actually removed from the pool - items marked for removal are only removed when released by all other reference holders.
type QueryDetails ¶
type QueryDetails struct { Type string // read or write CollectionName string Query interface{} Traceback string }
QueryDetails is a POD type recording the database query and who made it.
type QueryTracker ¶
type QueryTracker interface { Reset() ListQueries() []QueryDetails ReadCount() int }
QueryTracker provides a way for tests to determine how many database queries have been made, and who made them.
type RebootAction ¶
type RebootAction string
RebootAction defines the action a machine should take when a hook needs to reboot
const ( // ShouldDoNothing instructs a machine agent that no action // is required on its part ShouldDoNothing RebootAction = "noop" // ShouldReboot instructs a machine to reboot // this happens when a hook running on a machine, requests // a reboot ShouldReboot RebootAction = "reboot" // ShouldShutdown instructs a machine to shut down. This usually // happens when running inside a container, and a hook on the parent // machine requests a reboot ShouldShutdown RebootAction = "shutdown" )
type RebootActionGetter ¶
type RebootActionGetter interface {
ShouldRebootOrShutdown() (RebootAction, error)
}
type RebootFlagSetter ¶
type Relation ¶
type Relation struct {
// contains filtered or unexported fields
}
Relation represents a relation between one or two application endpoints.
func (*Relation) AllRemoteUnits ¶
func (r *Relation) AllRemoteUnits(appName string) ([]*RelationUnit, error)
AllRemoteUnits returns all the RelationUnits for the remote application units for a given application.
func (*Relation) ApplicationSettings ¶
ApplicationSettings returns the application-level settings for the specified application in this relation.
func (*Relation) Destroy ¶
Destroy ensures that the relation will be removed at some point; if no units are currently in scope, it will be removed immediately.
func (*Relation) DestroyOperation ¶
func (r *Relation) DestroyOperation(force bool) *DestroyRelationOperation
DestroyOperation returns a model operation that will allow relation to leave scope.
func (*Relation) DestroyWithForce ¶
DestroyWithForce may force the destruction of the relation. In addition, this function also returns all non-fatal operational errors encountered.
func (*Relation) Endpoint ¶
Endpoint returns the endpoint of the relation for the named application. If the application is not part of the relation, an error will be returned.
func (*Relation) Id ¶
Id returns the integer internal relation key. This is exposed because the unit agent needs to expose a value derived from this (as JUJU_RELATION_ID) to allow relation hooks to differentiate between relations with different applications.
func (*Relation) Refresh ¶
Refresh refreshes the contents of the relation from the underlying state. It returns an error that satisfies errors.IsNotFound if the relation has been removed.
func (*Relation) RelatedEndpoints ¶
RelatedEndpoints returns the endpoints of the relation r with which units of the named application will establish relations. If the application is not part of the relation r, an error will be returned.
func (*Relation) RemoteApplication ¶
func (r *Relation) RemoteApplication() (*RemoteApplication, bool, error)
RemoteApplication returns the remote application if this relation is a cross-model relation, and a bool indicating if it cross-model or not.
func (*Relation) RemoteUnit ¶
func (r *Relation) RemoteUnit(unitName string) (*RelationUnit, error)
RemoteUnit returns a RelationUnit for the supplied unit of a remote application.
func (*Relation) SetStatus ¶
func (r *Relation) SetStatus(statusInfo status.StatusInfo) error
SetStatus sets the status of the relation.
func (*Relation) SetSuspended ¶
SetSuspended sets whether the relation is suspended.
func (*Relation) Status ¶
func (r *Relation) Status() (status.StatusInfo, error)
Status returns the relation's current status data.
func (*Relation) SuspendedReason ¶
SuspendedReason returns the reason why the relation is suspended.
func (*Relation) Tag ¶
func (r *Relation) Tag() names.Tag
Tag returns a name identifying the relation.
func (*Relation) Unit ¶
func (r *Relation) Unit(u *Unit) (*RelationUnit, error)
Unit returns a RelationUnit for the supplied unit.
func (*Relation) UpdateApplicationSettings ¶
func (r *Relation) UpdateApplicationSettings(appName string, token leadership.Token, updates map[string]interface{}) error
UpdateApplicationSettings updates the given application's settings in this relation. It requires a current leadership token.
func (*Relation) UpdateApplicationSettingsOperation ¶
func (r *Relation) UpdateApplicationSettingsOperation(appName string, token leadership.Token, updates map[string]interface{}) (ModelOperation, error)
UpdateApplicationSettingsOperation returns a ModelOperation for updating the given application's settings in this relation. It requires a current leadership token.
func (*Relation) WatchApplicationSettings ¶
func (r *Relation) WatchApplicationSettings(app *Application) (NotifyWatcher, error)
WatchApplicationSettings returns a notify watcher that will signal whenever the specified application's relation settings are changed.
func (*Relation) WatchLifeSuspendedStatus ¶
func (r *Relation) WatchLifeSuspendedStatus() StringsWatcher
WatchLifeSuspendedStatus returns a watcher that notifies of changes to the life or suspended status of the relation.
func (*Relation) WatchRelationEgressNetworks ¶
func (r *Relation) WatchRelationEgressNetworks() StringsWatcher
WatchRelationEgressNetworks starts and returns a StringsWatcher notifying of egress changes to the relationNetworks collection for the relation.
func (*Relation) WatchRelationIngressNetworks ¶
func (r *Relation) WatchRelationIngressNetworks() StringsWatcher
WatchRelationIngressNetworks starts and returns a StringsWatcher notifying of ingress changes to the relationNetworks collection for the relation.
func (*Relation) WatchUnits ¶
func (r *Relation) WatchUnits(appName string) (RelationUnitsWatcher, error)
WatchUnits returns a watcher that notifies of changes to the units of the specified application endpoint in the relation. This method will return an error if the endpoint is not globally scoped.
type RelationNetworkDirection ¶
type RelationNetworkDirection string
RelationNetworkDirection represents a type that describes the direction of the network, either ingress or egress.
const ( // IngressDirection for a ingress relation network direction IngressDirection RelationNetworkDirection = "ingress" // EgressDirection for a egress relation network direction EgressDirection RelationNetworkDirection = "egress" )
func (RelationNetworkDirection) String ¶
func (r RelationNetworkDirection) String() string
type RelationNetworker ¶
type RelationNetworker interface { Save(relationKey string, adminOverride bool, cidrs []string) (RelationNetworks, error) Networks(relationKey string) (RelationNetworks, error) }
RelationNetworker instances provide access to relation networks in state.
type RelationNetworks ¶
RelationNetworks instances describe the ingress or egress networks required for a cross model relation.
type RelationNetworksDescription ¶
type RelationNetworksDescription interface {
RelationNetworks() []description.RelationNetwork
}
RelationNetworksDescription defines an in-place usage for reading relation networks.
type RelationNetworksInput ¶
type RelationNetworksInput interface { DocModelNamespace RelationNetworksDescription }
RelationNetworksInput describes the input used for migrating relation networks.
type RelationScopeChange ¶
RelationScopeChange contains information about units that have entered or left a particular scope.
type RelationScopeWatcher ¶
type RelationScopeWatcher struct {
// contains filtered or unexported fields
}
RelationScopeWatcher observes changes to the set of units in a particular relation scope.
func (*RelationScopeWatcher) Changes ¶
func (w *RelationScopeWatcher) Changes() <-chan *RelationScopeChange
Changes returns a channel that will receive changes when units enter and leave a relation scope. The Entered field in the first event on the channel holds the initial state.
func (*RelationScopeWatcher) Err ¶
func (w *RelationScopeWatcher) Err() error
Err returns any error encountered while running or shutting down, or tomb.ErrStillAlive if the watcher is still running.
func (*RelationScopeWatcher) Kill ¶
func (w *RelationScopeWatcher) Kill()
Kill kills the watcher without waiting for it to shut down.
type RelationUnit ¶
type RelationUnit struct {
// contains filtered or unexported fields
}
RelationUnit holds information about a single unit in a relation, and allows clients to conveniently access unit-specific functionality.
func (*RelationUnit) CounterpartApplications ¶
func (ru *RelationUnit) CounterpartApplications() []string
CounterpartApplications returns the slice of application names that are the counterpart of this unit. (So for Peer relations, app is returned, for a Provider the apps on Requirer side is returned
func (*RelationUnit) Endpoint ¶
func (ru *RelationUnit) Endpoint() Endpoint
Endpoint returns the relation endpoint that defines the unit's participation in the relation.
func (*RelationUnit) EnterScope ¶
func (ru *RelationUnit) EnterScope(settings map[string]interface{}) error
EnterScope ensures that the unit has entered its scope in the relation. When the unit has already entered its relation scope, EnterScope will report success but make no changes to state.
Otherwise, assuming both the relation and the unit are alive, it will enter scope and create or overwrite the unit's settings in the relation according to the supplied map.
If the unit is a principal and the relation has container scope, EnterScope will also create the required subordinate unit, if it does not already exist; this is because there's no point having a principal in scope if there is no corresponding subordinate to join it.
Once a unit has entered a scope, it stays in scope without further intervention; the relation will not be able to become Dead until all units have departed its scopes.
func (*RelationUnit) InScope ¶
func (ru *RelationUnit) InScope() (bool, error)
InScope returns whether the relation unit has entered scope and not left it.
func (*RelationUnit) Joined ¶
func (ru *RelationUnit) Joined() (bool, error)
Joined returns whether the relation unit has entered scope and neither left it nor prepared to leave it.
func (*RelationUnit) LeaveScope ¶
func (ru *RelationUnit) LeaveScope() error
LeaveScope signals that the unit has left its scope in the relation. After the unit has left its relation scope, it is no longer a member of the relation; if the relation is dying when its last member unit leaves, it is removed immediately. It is not an error to leave a scope that the unit is not, or never was, a member of.
func (*RelationUnit) LeaveScopeOperation ¶
func (ru *RelationUnit) LeaveScopeOperation(force bool) *LeaveScopeOperation
LeaveScopeOperation returns a model operation that will allow relation to leave scope.
func (*RelationUnit) LeaveScopeWithForce ¶
LeaveScopeWithForce in addition to doing what LeaveScope() does, when force is passed in as 'true', forces relation unit to leave scope, ignoring errors.
func (*RelationUnit) PrepareLeaveScope ¶
func (ru *RelationUnit) PrepareLeaveScope() error
PrepareLeaveScope causes the unit to be reported as departed by watchers, but does not *actually* leave the scope, to avoid triggering relation cleanup.
func (*RelationUnit) ReadSettings ¶
func (ru *RelationUnit) ReadSettings(uname string) (m map[string]interface{}, err error)
ReadSettings returns a map holding the settings of the unit with the supplied name within this relation. An error will be returned if the relation no longer exists, or if the unit's application is not part of the relation, or the settings are invalid; but mere non-existence of the unit is not grounds for an error, because the unit settings are guaranteed to persist for the lifetime of the relation, regardless of the lifetime of the unit.
func (*RelationUnit) Relation ¶
func (ru *RelationUnit) Relation() *Relation
Relation returns the relation associated with the unit.
func (*RelationUnit) Settings ¶
func (ru *RelationUnit) Settings() (*Settings, error)
Settings returns a Settings which allows access to the unit's settings within the relation.
func (*RelationUnit) UnitName ¶
func (ru *RelationUnit) UnitName() string
UnitName returns the name of the unit in the relation.
func (*RelationUnit) Valid ¶
func (ru *RelationUnit) Valid() (bool, error)
Valid returns whether this RelationUnit is one that can actually exist in the relation. For container-scoped relations, RUs can be created for subordinate units whose principal unit isn't a member of the relation. There are too many places that rely on being able to construct a nonsensical RU to query InScope or Joined, so we allow them to be constructed but they will always return false for Valid. TODO(babbageclunk): unpick the reliance on creating invalid RUs.
func (*RelationUnit) Watch ¶
func (ru *RelationUnit) Watch() RelationUnitsWatcher
Watch returns a watcher that notifies of changes to counterpart units in the relation.
func (*RelationUnit) WatchScope ¶
func (ru *RelationUnit) WatchScope() *RelationScopeWatcher
WatchScope returns a watcher which notifies of counterpart units entering and leaving the unit's scope.
type RelationUnitsWatcher ¶
type RelationUnitsWatcher interface { Watcher Changes() corewatcher.RelationUnitsChannel }
RelationUnitsWatcher generates signals when units enter or leave the scope of a RelationUnit, and changes to the settings of those units known to have entered.
type RemoteApplication ¶
type RemoteApplication struct {
// contains filtered or unexported fields
}
RemoteApplication represents the state of an application hosted in an external (remote) model.
func (*RemoteApplication) AddEndpoints ¶
func (s *RemoteApplication) AddEndpoints(eps []charm.Relation) error
AddEndpoints adds the specified endpoints to the remote application. If an endpoint with the same name already exists, an error is returned. If the endpoints change during the update, the operation is retried.
func (*RemoteApplication) Bindings ¶
func (s *RemoteApplication) Bindings() map[string]string
Bindings returns the endpoint->space bindings for the application.
func (*RemoteApplication) Destroy ¶
func (s *RemoteApplication) Destroy() error
Destroy ensures that this remote application reference and all its relations will be removed at some point; if no relation involving the application has any units in scope, they are all removed immediately.
func (*RemoteApplication) DestroyOperation ¶
func (s *RemoteApplication) DestroyOperation(force bool) *DestroyRemoteApplicationOperation
DestroyOperation returns a model operation to destroy remote application.
func (*RemoteApplication) DestroyWithForce ¶
func (s *RemoteApplication) DestroyWithForce(force bool, maxWait time.Duration) (opErrs []error, err error)
DestroyWithForce in addition to doing what Destroy() does, when force is passed in as 'true', forces th destruction of remote application, ignoring errors.
func (*RemoteApplication) Endpoint ¶
func (s *RemoteApplication) Endpoint(relationName string) (Endpoint, error)
Endpoint returns the relation endpoint with the supplied name, if it exists.
func (*RemoteApplication) Endpoints ¶
func (s *RemoteApplication) Endpoints() ([]Endpoint, error)
Endpoints returns the application's currently available relation endpoints.
func (*RemoteApplication) IsConsumerProxy ¶
func (s *RemoteApplication) IsConsumerProxy() bool
IsConsumerProxy returns the application is created from a registration operation by a consuming model.
func (*RemoteApplication) IsRemote ¶
func (s *RemoteApplication) IsRemote() bool
IsRemote returns true for a remote application.
func (*RemoteApplication) Life ¶
func (s *RemoteApplication) Life() Life
Life returns whether the application is Alive, Dying or Dead.
func (*RemoteApplication) Macaroon ¶
func (s *RemoteApplication) Macaroon() (*macaroon.Macaroon, error)
func (*RemoteApplication) Name ¶
func (s *RemoteApplication) Name() string
Name returns the application name.
func (*RemoteApplication) OfferUUID ¶
func (s *RemoteApplication) OfferUUID() string
OfferUUID returns the offer UUID.
func (*RemoteApplication) Refresh ¶
func (s *RemoteApplication) Refresh() error
Refresh refreshes the contents of the RemoteApplication from the underlying state. It returns an error that satisfies errors.IsNotFound if the application has been removed.
func (*RemoteApplication) Relations ¶
func (s *RemoteApplication) Relations() (relations []*Relation, err error)
Relations returns a Relation for every relation the application is in.
func (*RemoteApplication) SetStatus ¶
func (s *RemoteApplication) SetStatus(info status.StatusInfo) error
SetStatus sets the status for the application.
func (*RemoteApplication) SourceModel ¶
func (s *RemoteApplication) SourceModel() names.ModelTag
SourceModel returns the tag of the model to which the application belongs.
func (*RemoteApplication) SpaceForEndpoint ¶
func (s *RemoteApplication) SpaceForEndpoint(endpointName string) (RemoteSpace, bool)
SpaceForEndpoint returns the remote space an endpoint is bound to, if one is found.
func (*RemoteApplication) Spaces ¶
func (s *RemoteApplication) Spaces() []RemoteSpace
Spaces returns the remote spaces this application is connected to.
func (*RemoteApplication) Status ¶
func (s *RemoteApplication) Status() (status.StatusInfo, error)
Status returns the status of the remote application.
func (*RemoteApplication) String ¶
func (s *RemoteApplication) String() string
String returns the application name.
func (*RemoteApplication) Tag ¶
func (s *RemoteApplication) Tag() names.Tag
Tag returns a name identifying the application.
func (*RemoteApplication) TerminateOperation ¶
func (s *RemoteApplication) TerminateOperation(message string) ModelOperation
TerminateOperation returns a ModelOperation that will terminate this remote application when applied, ensuring that all units have left scope as well.
func (*RemoteApplication) Token ¶
func (s *RemoteApplication) Token() (string, error)
Token returns the token for the remote application, provided by the remote model to identify the application in future communications.
func (*RemoteApplication) URL ¶
func (s *RemoteApplication) URL() (string, bool)
URL returns the remote application URL, and a boolean indicating whether or not a URL is known for the remote application. A URL will only be available for the consumer of an offered application.
func (*RemoteApplication) WatchRelations ¶
func (s *RemoteApplication) WatchRelations() StringsWatcher
WatchRelations returns a StringsWatcher that notifies of changes to the lifecycles of relations involving a.
type RemoteApplicationsDescription ¶
type RemoteApplicationsDescription interface {
RemoteApplications() []description.RemoteApplication
}
RemoteApplicationsDescription defines an in-place usage for reading remote applications.
type RemoteApplicationsInput ¶
type RemoteApplicationsInput interface { DocModelNamespace StateDocumentFactory RemoteApplicationsDescription }
RemoteApplicationsInput describes the input used for migrating remote applications.
type RemoteConnectionStatus ¶
type RemoteConnectionStatus struct {
// contains filtered or unexported fields
}
RemoteConnectionStatus holds summary information about connections to an application offer.
func (*RemoteConnectionStatus) ActiveConnectionCount ¶
func (r *RemoteConnectionStatus) ActiveConnectionCount() int
ActiveConnectionCount returns the number of active remote applications related to an offer.
func (*RemoteConnectionStatus) TotalConnectionCount ¶
func (r *RemoteConnectionStatus) TotalConnectionCount() int
TotalConnectionCount returns the number of remote applications related to an offer.
type RemoteEntities ¶
type RemoteEntities struct {
// contains filtered or unexported fields
}
RemoteEntities wraps State to provide access to the remote entities collection.
func (*RemoteEntities) ExportLocalEntity ¶
func (r *RemoteEntities) ExportLocalEntity(entity names.Tag) (string, error)
ExportLocalEntity adds an entity to the remote entities collection, returning an opaque token that uniquely identifies the entity within the model.
If an entity is exported twice, we return an error satisfying errors.IsAlreadyExists(); we also still return the token so that a second api call is not required by the caller to get the token.
func (*RemoteEntities) GetMacaroon ¶
func (r *RemoteEntities) GetMacaroon(entity names.Tag) (*macaroon.Macaroon, error)
GetMacaroon returns the macaroon associated with the entity with the given tag and model.
func (*RemoteEntities) GetRemoteEntity ¶
func (r *RemoteEntities) GetRemoteEntity(token string) (names.Tag, error)
GetRemoteEntity returns the tag of the entity associated with the given token.
func (*RemoteEntities) GetToken ¶
func (r *RemoteEntities) GetToken(entity names.Tag) (string, error)
GetToken returns the token associated with the entity with the given tag and model.
func (*RemoteEntities) ImportRemoteEntity ¶
func (r *RemoteEntities) ImportRemoteEntity(entity names.Tag, token string) error
ImportRemoteEntity adds an entity to the remote entities collection with the specified opaque token. If the entity already exists, its token will be overwritten. This method assumes that the provided token is unique within the source model, and does not perform any uniqueness checks on it.
func (*RemoteEntities) RemoveRemoteEntity ¶
func (r *RemoteEntities) RemoveRemoteEntity(entity names.Tag) error
RemoveRemoteEntity removes the entity from the remote entities collection, and releases the token if the entity belongs to the local model.
func (*RemoteEntities) SaveMacaroon ¶
func (r *RemoteEntities) SaveMacaroon(entity names.Tag, mac *macaroon.Macaroon) error
SaveMacaroon saves the given macaroon for the specified entity.
type RemoteEntitiesDescription ¶
type RemoteEntitiesDescription interface {
RemoteEntities() []description.RemoteEntity
}
RemoteEntitiesDescription defines an in-place usage for reading remote entities.
type RemoteEntitiesInput ¶
type RemoteEntitiesInput interface { DocModelNamespace RemoteEntitiesDescription }
RemoteEntitiesInput describes the input used for migrating remote entities.
type RemoteEntity ¶
type RemoteEntity struct {
// contains filtered or unexported fields
}
RemoteEntity defines a remote entity that has a unique opaque token that identifies the entity within the model.
func (RemoteEntity) Macaroon ¶
func (e RemoteEntity) Macaroon() string
Macaroon returns the RemoteEntity Macaroon associated with the Token.
func (RemoteEntity) Token ¶
func (e RemoteEntity) Token() string
Token returns the RemoteEntity Token.
type RemoteSpace ¶
type RemoteSpace struct { CloudType string Name string ProviderId string ProviderAttributes attributeMap Subnets []RemoteSubnet }
RemoteSpace represents a space in another model that endpoints are bound to.
type RemoteSubnet ¶
type RemoteSubnet struct { CIDR string ProviderId string VLANTag int AvailabilityZones []string ProviderSpaceId string ProviderNetworkId string }
RemoteSubnet represents a subnet in another model.
type RemoveOfferOperation ¶
type RemoveOfferOperation struct { // ForcedOperation stores needed information to force this operation. ForcedOperation // contains filtered or unexported fields }
RemoveOfferOperation is a model operation to remove application offer.
func (*RemoveOfferOperation) Build ¶
func (op *RemoveOfferOperation) Build(attempt int) ([]txn.Op, error)
Build is part of the ModelOperation interface.
func (*RemoveOfferOperation) Done ¶
func (op *RemoveOfferOperation) Done(err error) error
Done is part of the ModelOperation interface.
type RemoveUnitOperation ¶
type RemoveUnitOperation struct { // ForcedOperation stores needed information to force this operation. ForcedOperation // contains filtered or unexported fields }
RemoveUnitOperation is a model operation for removing a unit.
func (*RemoveUnitOperation) Build ¶
func (op *RemoveUnitOperation) Build(attempt int) ([]txn.Op, error)
Build is part of the ModelOperation interface.
func (*RemoveUnitOperation) Done ¶
func (op *RemoveUnitOperation) Done(err error) error
Done is part of the ModelOperation interface.
type Remover ¶
type Remover interface {
Remove() error
}
Remover represents entities with a Remove method.
type ResolvedMode ¶
type ResolvedMode string
ResolvedMode describes the way state transition errors are resolved.
const ( ResolvedNone ResolvedMode = "" ResolvedRetryHooks ResolvedMode = "retry-hooks" ResolvedNoHooks ResolvedMode = "no-hooks" )
These are available ResolvedMode values.
type ResourcePersistence ¶
type ResourcePersistence struct {
// contains filtered or unexported fields
}
ResourcePersistence provides the persistence functionality for the Juju model as a whole.
func NewResourcePersistence ¶
func NewResourcePersistence(base ResourcePersistenceBase) *ResourcePersistence
NewResourcePersistence wraps the base in a new ResourcePersistence.
func (ResourcePersistence) GetResource ¶
func (p ResourcePersistence) GetResource(id string) (res resource.Resource, storagePath string, _ error)
GetResource returns the extended, model-related info for the non-pending resource.
func (ResourcePersistence) ListPendingResources ¶
func (p ResourcePersistence) ListPendingResources(applicationID string) ([]resource.Resource, error)
ListPendingResources returns the extended, model-related info for each pending resource of the identifies application.
func (ResourcePersistence) ListResources ¶
func (p ResourcePersistence) ListResources(applicationID string) (resource.ApplicationResources, error)
ListResources returns the info for each non-pending resource of the identified application.
func (ResourcePersistence) NewRemovePendingAppResourcesOps ¶
func (p ResourcePersistence) NewRemovePendingAppResourcesOps(applicationID string, pendingIDs map[string]string) ([]txn.Op, error)
NewRemovePendingResourcesOps returns mgo transaction operations to clean up pending resources for the application from state. We pass in the pending IDs to avoid removing the wrong resources if there's a race to deploy the same application.
func (ResourcePersistence) NewRemoveResourcesOps ¶
func (p ResourcePersistence) NewRemoveResourcesOps(applicationID string) ([]txn.Op, error)
NewRemoveResourcesOps returns mgo transaction operations that remove all the applications's resources from state.
func (ResourcePersistence) NewRemoveUnitResourcesOps ¶
func (p ResourcePersistence) NewRemoveUnitResourcesOps(unitID string) ([]txn.Op, error)
NewRemoveUnitResourcesOps returns mgo transaction operations that remove resource information specific to the unit from state.
func (ResourcePersistence) NewResolvePendingResourceOps ¶
func (p ResourcePersistence) NewResolvePendingResourceOps(resID, pendingID string) ([]txn.Op, error)
NewResolvePendingResourceOps generates mongo transaction operations to set the identified resource as active.
Leaking mongo details (transaction ops) is a necessary evil since we do not have any machinery to facilitate transactions between different components.
func (ResourcePersistence) RemovePendingAppResources ¶
func (p ResourcePersistence) RemovePendingAppResources(applicationID string, pendingIDs map[string]string) error
RemovePendingResources removes the pending application-level resources for a specific application, normally in the case that the application couln't be deployed.
func (ResourcePersistence) SetCharmStoreResource ¶
func (p ResourcePersistence) SetCharmStoreResource(id, applicationID string, res charmresource.Resource, lastPolled time.Time) error
SetCharmStoreResource stores the resource info that was retrieved from the charm store.
func (ResourcePersistence) SetResource ¶
func (p ResourcePersistence) SetResource(res resource.Resource) error
SetResource sets the info for the resource.
func (ResourcePersistence) SetUnitResource ¶
func (p ResourcePersistence) SetUnitResource(unitID string, res resource.Resource) error
SetUnitResource stores the resource info for a particular unit. The resource must already be set for the application.
func (ResourcePersistence) SetUnitResourceProgress ¶
func (p ResourcePersistence) SetUnitResourceProgress(unitID string, res resource.Resource, progress int64) error
SetUnitResource stores the resource info for a particular unit. The resource must already be set for the application. The provided progress is stored in the DB.
func (ResourcePersistence) StageResource ¶
func (p ResourcePersistence) StageResource(res resource.Resource, storagePath string) (*StagedResource, error)
StageResource adds the resource in a separate staging area if the resource isn't already staged. If it is then errors.AlreadyExists is returned. A wrapper around the staged resource is returned which supports both finalizing and removing the staged resource.
type ResourcePersistenceBase ¶
type ResourcePersistenceBase interface { // One populates doc with the document corresponding to the given // ID. Missing documents result in errors.NotFound. One(collName, id string, doc interface{}) error // All populates docs with the list of the documents corresponding // to the provided query. All(collName string, query, docs interface{}) error // Run runs the transaction generated by the provided factory // function. It may be retried several times. Run(transactions jujutxn.TransactionSource) error // ApplicationExistsOps returns the operations that verify that the // identified application exists. ApplicationExistsOps(applicationID string) []txn.Op // IncCharmModifiedVersionOps returns the operations necessary to increment // the CharmModifiedVersion field for the given application. IncCharmModifiedVersionOps(applicationID string) []txn.Op }
ResourcePersistenceBase exposes the core persistence functionality needed for resources.
type Resources ¶
type Resources interface { // ListResources returns the list of resources for the given application. ListResources(applicationID string) (resource.ApplicationResources, error) // ListPendingResources returns the list of pending resources for // the given application. ListPendingResources(applicationID string) ([]resource.Resource, error) // AddPendingResource adds the resource to the data store in a // "pending" state. It will stay pending (and unavailable) until // it is resolved. The returned ID is used to identify the pending // resources when resolving it. AddPendingResource(applicationID, userID string, chRes charmresource.Resource) (string, error) // GetResource returns the identified resource. GetResource(applicationID, name string) (resource.Resource, error) // GetPendingResource returns the identified resource. GetPendingResource(applicationID, name, pendingID string) (resource.Resource, error) // SetResource adds the resource to blob storage and updates the metadata. SetResource(applicationID, userID string, res charmresource.Resource, r io.Reader) (resource.Resource, error) // SetUnitResource sets the resource metadata for a specific unit. SetUnitResource(unitName, userID string, res charmresource.Resource) (resource.Resource, error) // UpdatePendingResource adds the resource to blob storage and updates the metadata. UpdatePendingResource(applicationID, pendingID, userID string, res charmresource.Resource, r io.Reader) (resource.Resource, error) // OpenResource returns the metadata for a resource and a reader for the resource. OpenResource(applicationID, name string) (resource.Resource, io.ReadCloser, error) // OpenResourceForUniter returns the metadata for a resource and a reader for the resource. OpenResourceForUniter(unit resource.Unit, name string) (resource.Resource, io.ReadCloser, error) // SetCharmStoreResources sets the "polled" resources for the // application to the provided values. SetCharmStoreResources(applicationID string, info []charmresource.Resource, lastPolled time.Time) error // RemovePendingAppResources removes any pending application-level // resources for the named application. This is used to clean up // resources for a failed application deployment. RemovePendingAppResources(applicationID string, pendingIDs map[string]string) error // NewResolvePendingResourcesOps generates mongo transaction operations // to set the identified resources as active. NewResolvePendingResourcesOps(applicationID string, pendingIDs map[string]string) ([]txn.Op, error) }
Resources describes the state functionality for resources.
func NewResourceState ¶
func NewResourceState(persist Persistence, base *State) Resources
NewResourceState is a function that may be passed to state.SetResourcesComponent().
type ResourcesPersistence ¶
type ResourcesPersistence interface { // NewRemoveUnitResourcesOps returns mgo transaction operations // that remove resource information specific to the unit from state. NewRemoveUnitResourcesOps(unitID string) ([]txn.Op, error) // NewRemoveResourcesOps returns mgo transaction operations that // remove all the application's resources from state. NewRemoveResourcesOps(applicationID string) ([]txn.Op, error) }
ResourcesPersistence exposes the resources persistence functionality needed by state.
type RunTransactionObserverFunc ¶
RunTransactionObserverFunc is the type of a function to be called after an mgo/txn transaction is run.
type SSHHostKeys ¶
type SSHHostKeys []string
SSHHostKeys holds the public SSH host keys for an entity (almost certainly a machine).
The host keys are one line each and are stored in the same format as the SSH authorized_keys and ssh_host_key*.pub files.
type SaveCloudServiceArgs ¶
type SaveCloudServiceArgs struct { // Id will be the application Name if it's a part of application, // and will be controller UUID for k8s a controller(controller does not have an application), // then is wrapped with applicationGlobalKey. Id string ProviderId string Addresses network.SpaceAddresses Generation int64 DesiredScaleProtected bool }
SaveCloudServiceArgs defines the arguments for SaveCloudService method.
type SessionCloser ¶
type SessionCloser func()
type SetCharmConfig ¶
type SetCharmConfig struct { // Charm is the new charm to use for the application. New units // will be started with this charm, and existing units will be // upgraded to use it. Charm *Charm // CharmOrigin is the data for where the charm comes from. Eventually // Channel should be move there. CharmOrigin *CharmOrigin // Channel is the charm store channel from which charm was pulled. Channel csparams.Channel // ConfigSettings is the charm config settings to apply when upgrading // the charm. ConfigSettings charm.Settings // ForceUnits forces the upgrade on units in an error state. ForceUnits bool // ForceSeries forces the use of the charm even if it is not one of // the charm's supported series. ForceSeries bool // Force forces the overriding of the lxd profile validation even if the // profile doesn't validate. Force bool // ResourceIDs is a map of resource names to resource IDs to activate during // the upgrade. ResourceIDs map[string]string // StorageConstraints contains the storage constraints to add or update when // upgrading the charm. // // Any existing storage instances for the named stores will be // unaffected; the storage constraints will only be used for // provisioning new storage instances. StorageConstraints map[string]StorageConstraints // EndpointBindings is an operator-defined map of endpoint names to // space names that should be merged with any existing bindings. EndpointBindings map[string]string }
SetCharmConfig contains the parameters for Application.SetCharm.
type Settings ¶
type Settings struct {
// contains filtered or unexported fields
}
A Settings manages changes to settings as a delta in memory and merges them back in the database when explicitly requested.
func (*Settings) Write ¶
func (s *Settings) Write() (settings.ItemChanges, error)
Write writes changes made to c back onto its node. Changes are written as a delta applied on top of the latest version of the node, to prevent overwriting unrelated changes made to the node since it was last read.
func (*Settings) WriteOperation ¶
func (s *Settings) WriteOperation() ModelOperation
WriteOperation returns a ModelOperation to persist all mutations to a Settings instance.
type Space ¶
type Space struct {
// contains filtered or unexported fields
}
Space represents the state of a juju network space.
func (*Space) EnsureDead ¶
EnsureDead sets the Life of the space to Dead, if it's Alive. If the space is already Dead, no error is returned. When the space is no longer Alive or already removed, errNotAlive is returned.
func (*Space) NetworkSpace ¶
NetworkSpace maps the space fields into a network.SpaceInfo. This method materialises subnets for each call. If calling multiple times, consider using AllSpaceInfos and filtering in-place.
func (*Space) ProviderId ¶
ProviderId returns the provider id of the space. This will be the empty string except on substrates that directly support spaces.
func (*Space) Refresh ¶
Refresh refreshes the contents of the Space from the underlying state. It returns an error that satisfies errors.IsNotFound if the Space has been removed.
func (*Space) Remove ¶
Remove removes a Dead space. If the space is not Dead or it is already removed, an error is returned.
func (*Space) RemoveSpaceOps ¶
RemoveSpaceOps returns txn.Ops to remove the space
func (*Space) RenameSpaceOps ¶
RenameSpaceOps returns the database transaction operations required to rename the input space `fromName` to input `toName`.
type StagedResource ¶
type StagedResource struct {
// contains filtered or unexported fields
}
StagedResource represents resource info that has been added to the "staging" area of the underlying data store. It remains unavailable until finalized, at which point it moves out of the staging area and replaces the current active resource info.
func (StagedResource) Activate ¶
func (staged StagedResource) Activate() error
Activate makes the staged resource the active resource.
func (StagedResource) Unstage ¶
func (staged StagedResource) Unstage() error
Unstage ensures that the resource is removed from the staging area. If it isn't in the staging area then this is a noop.
type State ¶
type State struct { // TODO(anastasiamac 2015-07-16) As state gets broken up, remove this. CloudImageMetadataStorage cloudimagemetadata.Storage // contains filtered or unexported fields }
State represents the state of an model managed by juju.
func (*State) APIHostPortsForAgents ¶
func (st *State) APIHostPortsForAgents() ([]network.SpaceHostPorts, error)
APIHostPortsForAgents returns the collection of API addresses that should be used by agents. If the controller model is CAAS type, the return will be the controller k8s service addresses in cloud service. If there is no management network space configured for the controller, or if the space is misconfigured, the return will be the same as APIHostPortsForClients. Otherwise the returned addresses will correspond with the management net space. If there is no document at all, we simply fall back to APIHostPortsForClients.
func (*State) APIHostPortsForClients ¶
func (st *State) APIHostPortsForClients() ([]network.SpaceHostPorts, error)
APIHostPortsForClients returns the collection of *all* known API addresses.
func (*State) AbortCurrentUpgrade ¶
AbortCurrentUpgrade archives any current UpgradeInfo and sets its status to UpgradeAborted. Nothing happens if there's no current UpgradeInfo.
func (*State) AddApplication ¶
func (st *State) AddApplication(args AddApplicationArgs) (_ *Application, err error)
AddApplication creates a new application, running the supplied charm, with the supplied name (which must be unique). If the charm defines peer relations, they will be created automatically.
func (*State) AddBranch ¶
AddBranch creates a new branch in the current model. A branch cannot be created with the same name as another "in-flight" branch. The input user indicates the operator who invoked the creation.
func (*State) AddCharm ¶
AddCharm adds the ch charm with curl to the state. On success the newly added charm state is returned.
func (*State) AddCharmPlaceholder ¶
AddCharmPlaceholder creates a charm document in state for the given charm URL, which must reference a charm from the given store. The charm document is marked as a placeholder which means that if the charm is to be deployed, it will need to first be uploaded to model storage.
func (*State) AddCloud ¶
AddCloud creates a cloud with the given name and details. Note that the Config is deliberately ignored - it's only relevant when bootstrapping.
func (*State) AddControllerNode ¶
AddControllerNode creates a new controller node.
func (*State) AddControllerUser ¶
func (st *State) AddControllerUser(spec UserAccessSpec) (permission.UserAccess, error)
AddControllerUser adds a new user for the current controller to the database.
func (*State) AddMachine ¶
func (st *State) AddMachine(series string, jobs ...MachineJob) (*Machine, error)
AddMachine adds a machine with the given series and jobs. It is deprecated and around for testing purposes only.
func (*State) AddMachineInsideMachine ¶
func (st *State) AddMachineInsideMachine(template MachineTemplate, parentId string, containerType instance.ContainerType) (*Machine, error)
AddMachineInsideMachine adds a machine inside a container of the given type on the existing machine with id=parentId.
func (*State) AddMachineInsideNewMachine ¶
func (st *State) AddMachineInsideNewMachine(template, parentTemplate MachineTemplate, containerType instance.ContainerType) (*Machine, error)
AddMachineInsideNewMachine creates a new machine within a container of the given type inside another new machine. The two given templates specify the form of the child and parent respectively.
func (*State) AddMachines ¶
func (st *State) AddMachines(templates ...MachineTemplate) (_ []*Machine, err error)
AddMachines adds new machines configured according to the given templates.
func (*State) AddMetrics ¶
func (st *State) AddMetrics(batch BatchParam) (*MetricBatch, error)
AddMetrics adds a new batch of metrics to the database.
func (*State) AddModelMetrics ¶
func (st *State) AddModelMetrics(batch ModelBatchParam) (*MetricBatch, error)
AddModelMetrics adds a new model-centric batch of metrics to the database.
func (*State) AddOfferConnection ¶
func (st *State) AddOfferConnection(args AddOfferConnectionParams) (_ *OfferConnection, err error)
AddOfferConnection creates a new offer connection record, which records details about a relation made from a remote model to an offer in the local model.
func (*State) AddOneMachine ¶
func (st *State) AddOneMachine(template MachineTemplate) (*Machine, error)
AddOneMachine machine adds a new machine configured according to the given template.
func (*State) AddRelation ¶
AddRelation creates a new relation with the given endpoints.
func (*State) AddRemoteApplication ¶
func (st *State) AddRemoteApplication(args AddRemoteApplicationParams) (_ *RemoteApplication, err error)
AddRemoteApplication creates a new remote application record, having the supplied relation endpoints, with the supplied name, which must be unique across all applications, local and remote.
func (*State) AddSpace ¶
func (st *State) AddSpace( name string, providerId network.Id, subnetIDs []string, isPublic bool) (newSpace *Space, err error, )
AddSpace creates and returns a new space.
func (*State) AddSubnet ¶
func (st *State) AddSubnet(args network.SubnetInfo) (subnet *Subnet, err error)
AddSubnet creates and returns a new subnet.
func (*State) AddSubnetOps ¶
AddSubnetOps returns transaction operations required to ensure that the input subnet is added to state.
func (*State) AddUserWithSecretKey ¶
AddUserWithSecretKey adds the user with the specified name, and assigns it a randomly generated secret key. This secret key may be used for the user and controller to mutually authenticate one another, without without relying on TLS certificates.
The new user will not have a password. A password must be set, clearing the secret key in the process, before the user can login normally.
func (*State) Addresses ¶
Addresses returns the list of cloud-internal addresses that can be used to connect to the state.
func (*State) AllApplications ¶
func (st *State) AllApplications() (applications []*Application, err error)
AllApplications returns all deployed applications in the model.
func (*State) AllBlocksForController ¶
AllBlocksForController returns all blocks in any models on the controller.
func (*State) AllCloudCredentials ¶
func (st *State) AllCloudCredentials(user names.UserTag) ([]Credential, error)
AllCloudCredentials returns all cloud credentials stored on the controller for a given user.
func (*State) AllConstraints ¶
func (st *State) AllConstraints() ([]*Constraints, error)
AllConstraints returns all constraints in the collection.
func (*State) AllEndpointBindingsSpaceNames ¶
AllEndpointBindingsSpaceNames returns a set of spaces names for all the endpoint bindings.
func (*State) AllIPAddresses ¶
AllIPAddresses returns all ip addresses in the model.
func (*State) AllLinkLayerDevices ¶
func (st *State) AllLinkLayerDevices() (devices []*LinkLayerDevice, err error)
AllLinkLayerDevices returns all link layer devices in the model.
func (*State) AllMachineRemovals ¶
AllMachineRemovals returns (the ids of) all of the machines that need to be removed but need provider-level cleanup.
func (*State) AllMachines ¶
AllMachines returns all machines in the model ordered by id.
func (*State) AllMetricBatches ¶
func (st *State) AllMetricBatches() ([]MetricBatch, error)
AllMetricBatches returns all metric batches currently stored in state. TODO (tasdomas): this method is currently only used in the uniter worker test -
it needs to be modified to restrict the scope of the values it returns if it is to be used outside of tests.
func (*State) AllModelUUIDs ¶
AllModelUUIDs returns the UUIDs for all non-dead models in the controller. Results are sorted by (name, owner).
func (*State) AllModelUUIDsIncludingDead ¶
AllModelUUIDsIncludingDead returns the UUIDs for all models in the controller. Results are sorted by (name, owner).
func (*State) AllOfferConnections ¶
func (st *State) AllOfferConnections() ([]*OfferConnection, error)
AllOfferConnections returns all offer connections in the model.
func (*State) AllRelations ¶
AllRelations returns all relations in the model ordered by id.
func (*State) AllRemoteApplications ¶
func (st *State) AllRemoteApplications() (applications []*RemoteApplication, err error)
AllRemoteApplications returns all the remote applications used by the model.
func (*State) AllRemoteEntities ¶
func (st *State) AllRemoteEntities() ([]RemoteEntity, error)
AllRemoteEntities returns all the remote entities for the model.
func (*State) AllSpaceInfos ¶
func (st *State) AllSpaceInfos() (network.SpaceInfos, error)
AllSpaceInfos returns SpaceInfos for all spaces in the model.
func (*State) AllSubnetInfos ¶
func (st *State) AllSubnetInfos() (network.SubnetInfos, error)
AllSubnetInfos returns SubnetInfos for all subnets in the model.
func (*State) AllSubnets ¶
AllSubnets returns all known subnets in the model.
func (*State) AllUnitAssignments ¶
func (st *State) AllUnitAssignments() ([]UnitAssignment, error)
UnitAssignments returns all staged unit assignments in the model.
func (*State) AllUsers ¶
AllUsers returns a slice of state.User. This includes all active users. If includeDeactivated is true it also returns inactive users. At this point it never returns deleted users.
func (*State) Application ¶
func (st *State) Application(name string) (_ *Application, err error)
Application returns a application state by name.
func (*State) ApplicationLeaders ¶
ApplicationLeaders returns a map of the application name to the unit name that is the current leader.
func (*State) ApplyOperation ¶
func (st *State) ApplyOperation(op ModelOperation) error
ApplyOperation applies a given ModelOperation to the model.
NOTE(axw) when all model-specific types and methods are moved to Model, then this should move also.
func (*State) AssignStagedUnits ¶
func (st *State) AssignStagedUnits(ids []string) ([]UnitAssignmentResult, error)
AssignStagedUnits gets called by the UnitAssigner worker, and runs the given assignments.
func (*State) AssignUnit ¶
func (st *State) AssignUnit(u *Unit, policy AssignmentPolicy) (err error)
AssignUnit places the unit on a machine. Depending on the policy, and the state of the model, this may lead to new instances being launched within the model.
func (*State) AssignUnitWithPlacement ¶
AssignUnitWithPlacement chooses a machine using the given placement directive and then assigns the unit to it.
func (*State) AutocertCache ¶
AutocertCache returns an implementation of autocert.Cache backed by the state.
func (*State) Branch ¶
func (st *State) Branch(name string) (*Generation, error)
Branch retrieves the generation with the the input branch name from the collection of not-yet-completed generations.
func (*State) Branches ¶
func (st *State) Branches() ([]*Generation, error)
Branches returns all "in-flight" branches.
func (*State) Charm ¶
Charm returns the charm with the given URL. Charms pending upload to storage and placeholders are never returned.
func (*State) Cleanup ¶
Cleanup removes all documents that were previously marked for removal, if any such exist. It should be called periodically by at least one element of the system.
func (*State) CleanupOldMetrics ¶
CleanupOldMetrics looks for metrics that are 24 hours old (or older) and have been sent. Any metrics it finds are deleted.
func (*State) ClearUpgradeInfo ¶
ClearUpgradeInfo clears information about an upgrade in progress. It returns an error if no upgrade is current.
func (*State) CloudCredential ¶
func (st *State) CloudCredential(tag names.CloudCredentialTag) (Credential, error)
CloudCredential returns the cloud credential for the given tag.
func (*State) CloudCredentials ¶
func (st *State) CloudCredentials(user names.UserTag, cloudName string) (map[string]Credential, error)
CloudCredentials returns the user's cloud credentials for a given cloud, keyed by credential name.
func (*State) CloudService ¶
func (st *State) CloudService(id string) (*CloudService, error)
CloudService returns a cloud service state by Id.
func (*State) CloudsForUser ¶
CloudsForUser returns details including access level of clouds which can be seen by the specified user, or all users if the caller is a superuser.
func (*State) CommittedBranch ¶
func (st *State) CommittedBranch(id int) (*Generation, error)
Generation retrieves the generation with the the input id from the collection of completed generations.
func (*State) CommittedBranches ¶
func (st *State) CommittedBranches() ([]*Generation, error)
Generations returns all committed branches.
func (*State) CompleteMachineRemovals ¶
CompleteMachineRemovals finishes the removal of the specified machines. The machines must have been marked for removal previously. Valid-looking-but-unknown machine ids are ignored so that this is idempotent.
func (*State) CompletedMigration ¶
func (st *State) CompletedMigration() (ModelMigration, error)
CompletedMigration returns the most recent migration for this state's model if it reached the DONE phase and caused the model to be relocated.
func (*State) CompletedMigrationForModel ¶
func (st *State) CompletedMigrationForModel(modelUUID string) (ModelMigration, error)
CompletedMigration returns the most recent migration for the input model UUID if it reached the DONE phase and caused the model to be relocated.
func (*State) ComposeNewModelConfig ¶
func (st *State) ComposeNewModelConfig(modelAttr map[string]interface{}, regionSpec *environscloudspec.CloudRegionSpec) (map[string]interface{}, error)
ComposeNewModelConfig returns a complete map of config attributes suitable for creating a new model, by combining user specified values with system defaults.
func (*State) ConstraintsBySpaceName ¶
func (st *State) ConstraintsBySpaceName(spaceName string) ([]*Constraints, error)
ConstraintsBySpaceName returns all Constraints that include a positive or negative space constraint for the input space name.
func (*State) ControllerConfig ¶
func (st *State) ControllerConfig() (jujucontroller.Config, error)
ControllerConfig returns the config values for the controller.
func (*State) ControllerIds ¶
ControllerIds returns the ids of the controller nodes.
func (*State) ControllerInfo ¶
func (st *State) ControllerInfo() (*ControllerInfo, error)
ControllerInfo returns information about the currently configured controller machines.
func (*State) ControllerModelTag ¶
func (st *State) ControllerModelTag() names.ModelTag
ControllerModelTag returns the tag form the return value of ControllerModelUUID.
func (*State) ControllerModelUUID ¶
ControllerModelUUID returns the UUID of the model that was bootstrapped. This is the only model that can have controller machines. The owner of this model is also considered "special", in that they are the only user that is able to create other users (until we have more fine grained permissions), and they cannot be disabled.
func (*State) ControllerNode ¶
func (st *State) ControllerNode(id string) (ControllerNode, error)
ControllerNode returns the controller node with the given id.
func (*State) ControllerNodes ¶
ControllerNodes returns all the controller nodes.
func (*State) ControllerOwner ¶
ControllerOwner returns the owner of the controller model.
func (*State) ControllerTag ¶
func (st *State) ControllerTag() names.ControllerTag
ControllerTag returns the tag form of the the return value of ControllerUUID.
func (*State) ControllerTimestamp ¶
ControllerTimestamp returns the current timestamp of the backend controller.
func (*State) ControllerUUID ¶
ControllerUUID returns the UUID for the controller of this state instance.
func (*State) ConvertSpaceHostPort ¶
func (st *State) ConvertSpaceHostPort(sHP network.SpaceHostPort) (network.ProviderHostPort, error)
func (*State) ConvertSpaceHostPorts ¶
func (st *State) ConvertSpaceHostPorts(sHPs network.SpaceHostPorts) (network.ProviderHostPorts, error)
func (*State) CountOfSentMetrics ¶
CountOfSentMetrics returns the number of metrics that have been sent to the collection service and have not been removed by the cleanup worker.
func (*State) CountOfUnsentMetrics ¶
CountOfUnsentMetrics returns the number of metrics that haven't been sent to the collection service.
func (*State) CreateCloudAccess ¶
func (st *State) CreateCloudAccess(cloud string, user names.UserTag, access permission.Access) error
CreateCloudAccess creates a new access permission for a user on a cloud.
func (*State) CreateMigration ¶
func (st *State) CreateMigration(spec MigrationSpec) (ModelMigration, error)
CreateMigration initialises state that tracks a model migration. It will return an error if there is already a model migration in progress.
func (*State) CreateOfferAccess ¶
func (st *State) CreateOfferAccess(offer names.ApplicationOfferTag, user names.UserTag, access permission.Access) error
CreateOfferAccess creates a new access permission for a user on an offer.
func (*State) CredentialModels ¶
CredentialModels returns all models that use given cloud credential.
func (*State) CredentialModelsAndOwnerAccess ¶
func (st *State) CredentialModelsAndOwnerAccess(tag names.CloudCredentialTag) ([]CredentialOwnerModelAccess, error)
CredentialModelsAndOwnerAccess returns all models that use given cloud credential as well as what access the credential owner has on these models.
func (*State) DashboardSetVersion ¶
DashboardSetVersion sets the Juju Dashboard version that the controller must serve.
func (*State) DashboardStorage ¶
func (st *State) DashboardStorage() (binarystorage.StorageCloser, error)
DashboardStorage returns a new binarystorage.StorageCloser that stores Dashboard archive metadata in the "juju" database "guimetadata" collection.
func (*State) DashboardVersion ¶
DashboardVersion returns the Juju Dashboard version currently served by the controller.
func (*State) DefaultEndpointBindingSpace ¶
DefaultEndpointBindingSpace returns the current space ID to be used for the default endpoint binding.
func (*State) DumpAll ¶
DumpAll returns a map of collection names to a slice of documents in that collection. Every document that is related to the current model is returned in the map.
func (*State) EnableHA ¶
func (st *State) EnableHA( numControllers int, cons constraints.Value, series string, placement []string, ) (ControllersChanges, error)
EnableHA adds controller machines as necessary to make the number of live controllers equal to numControllers. The given constraints and series will be attached to any new machines. If placement is not empty, any new machines which may be required are started according to the specified placement directives until the placement list is exhausted; thereafter any new machines are started according to the constraints and series. MachineID is the id of the machine where the apiserver is running.
func (*State) EndpointsRelation ¶
EndpointsRelation returns the existing relation with the given endpoints.
func (*State) EnsureModelRemoved ¶
EnsureModelRemoved returns an error if any multi-model documents for this model are found. It is intended only to be used in tests and exported so it can be used in the tests of other packages.
func (*State) EnsureUpgradeInfo ¶
func (st *State) EnsureUpgradeInfo(controllerId string, previousVersion, targetVersion version.Number) (*UpgradeInfo, error)
EnsureUpgradeInfo returns an UpgradeInfo describing a current upgrade between the supplied versions. If a matching upgrade is in progress, that upgrade is returned; if there's a mismatch, an error is returned.
func (*State) ExportPartial ¶
func (st *State) ExportPartial(cfg ExportConfig) (description.Model, error)
ExportPartial the current model for the State optionally skipping aspects as defined by the ExportConfig.
func (*State) ExternalControllerForModel ¶
ExternalControllerForModel retrieves an ExternalController with a given model UUID. This is very similar to externalControllers.ControllerForModel, except the return type is a lot less strict, one that we can access the ModelUUIDs from the controller.
func (*State) FindEntity ¶
FindEntity returns the entity with the given tag.
The returned value can be of type *Machine, *Unit, *User, *Application, *Model, or *Action, depending on the tag.
func (*State) GetBlockForType ¶
GetBlockForType returns the Block of the specified type for the current model where
not found -> nil, false, nil found -> block, true, nil error -> nil, false, err
func (*State) GetCloudAccess ¶
func (st *State) GetCloudAccess(cloud string, user names.UserTag) (permission.Access, error)
GetCloudAccess gets the access permission for the specified user on a cloud.
func (*State) GetCloudUsers ¶
GetCloudUsers gets the access permissions on a cloud.
func (*State) GetOfferAccess ¶
func (st *State) GetOfferAccess(offerUUID string, user names.UserTag) (permission.Access, error)
GetOfferAccess gets the access permission for the specified user on an offer.
func (*State) GetOfferUsers ¶
GetOfferUsers gets the access permissions on an offer.
func (*State) GetSSHHostKeys ¶
func (st *State) GetSSHHostKeys(tag names.MachineTag) (SSHHostKeys, error)
GetSSHHostKeys retrieves the SSH host keys stored for an entity. / NOTE: Currently only machines are supported. This can be generalised to take other tag types later, if and when we need it.
func (*State) HAPrimaryMachine ¶
HAPrimaryMachine returns machine tag for a controller machine that has a mongo instance that is primary in replicaset.
func (*State) HasUpgradeSeriesLocks ¶
HasUpgradeSeriesLocks returns true if there are any upgrade machine locks.
func (*State) ImageStorage ¶
func (st *State) ImageStorage() imagestorage.Storage
ImageStorage returns a new imagestorage.Storage that stores image metadata.
func (*State) InferEndpoints ¶
InferEndpoints returns the endpoints corresponding to the supplied names. There must be 1 or 2 supplied names, of the form <application>[:<relation>]. If the supplied names uniquely specify a possible relation, or if they uniquely specify a possible relation once all implicit relations have been filtered, the endpoints corresponding to that relation will be returned.
func (*State) InvalidateCloudCredential ¶
InvalidateCloudCredential marks a cloud credential with the given tag as invalid.
func (*State) InvalidateModelCredential ¶
InvalidateModelCredential invalidate cloud credential for the model of the given state.
func (*State) IsController ¶
IsController returns true if this state instance has the bootstrap model UUID.
func (*State) IsControllerAdmin ¶
IsControllerAdmin returns true if the user specified has Super User Access.
func (*State) IsMigrationActive ¶
IsMigrationActive returns true if a migration is in progress for the model associated with the State.
func (*State) IsUpgrading ¶
IsUpgrading returns true if an upgrade is currently in progress.
func (*State) KeyRelation ¶
KeyRelation returns the existing relation with the given key (which can be derived unambiguously from the relation's endpoints).
func (*State) LatestMigration ¶
func (st *State) LatestMigration() (ModelMigration, error)
LatestMigration returns the most recent ModelMigration (if any) for a model that has not been removed from the state. Callers interested in ModelMigrations for models that have been removed after a successful migration to another controller should use CompletedMigration instead.
func (*State) LatestPlaceholderCharm ¶
LatestPlaceholderCharm returns the latest charm described by the given URL but which is not yet deployed.
func (*State) LeaseNotifyTarget ¶
func (st *State) LeaseNotifyTarget(logDest io.Writer, errorLogger raftleasestore.Logger) raftlease.NotifyTarget
LeaseNotifyTarget returns a raftlease.NotifyTarget for storing lease changes in the database.
func (*State) LeaseTrapdoorFunc ¶
func (st *State) LeaseTrapdoorFunc() raftlease.TrapdoorFunc
LeaseTrapdoorFunc returns a raftlease.TrapdoorFunc for checking lease state in a database.
func (*State) LinkLayerDevice ¶
func (st *State) LinkLayerDevice(id string) (*LinkLayerDevice, error)
func (*State) MaybePruneTransactions ¶
MaybePruneTransactions removes data for completed transactions.
func (*State) MetricBatch ¶
func (st *State) MetricBatch(id string) (*MetricBatch, error)
MetricBatch returns the metric batch with the given id.
func (*State) MetricBatchesForApplication ¶
func (st *State) MetricBatchesForApplication(application string) ([]MetricBatch, error)
MetricBatchesForApplication returns metric batches for the given application.
func (*State) MetricBatchesForModel ¶
func (st *State) MetricBatchesForModel() ([]MetricBatch, error)
MetricBatchesForModel returns metric batches for all the units in the model.
func (*State) MetricBatchesForUnit ¶
func (st *State) MetricBatchesForUnit(unit string) ([]MetricBatch, error)
MetricBatchesForUnit returns metric batches for the given unit.
func (*State) MetricsManager ¶
func (st *State) MetricsManager() (*MetricsManager, error)
MetricsManager returns an existing metricsmanager, or a new one if non exists.
func (*State) MetricsToSend ¶
func (st *State) MetricsToSend(batchSize int) ([]*MetricBatch, error)
MetricsToSend returns batchSize metrics that need to be sent to the collector
func (*State) Migration ¶
func (st *State) Migration(id string) (ModelMigration, error)
Migration retrieves a specific ModelMigration by its id. See also LatestMigration and LatestCompletedMigration.
func (*State) ModelBasicInfoForUser ¶
func (st *State) ModelBasicInfoForUser(user names.UserTag) ([]ModelAccessInfo, error)
ModelBasicInfoForUser gives you the information about all models that a user has access to. This includes the name and UUID, as well as the last time the user connected to that model.
func (*State) ModelConfigDefaultValues ¶
func (st *State) ModelConfigDefaultValues(cloudName string) (config.ModelDefaultAttributes, error)
ModelConfigDefaultValues returns the default config values to be used when creating a new model, and the origin of those values.
func (*State) ModelConstraints ¶
func (st *State) ModelConstraints() (constraints.Value, error)
ModelConstraints returns the current model constraints.
func (*State) ModelExists ¶
ModelExists returns true if a model with the supplied UUID exists.
func (*State) ModelMeterStatus ¶
func (st *State) ModelMeterStatus() (MeterStatus, error)
ModelMeterStatus returns the meter status for the current connected model.
func (*State) ModelPayloads ¶
func (st *State) ModelPayloads() (ModelPayloads, error)
ModelPayloads returns a ModelPayloads for the state's model.
func (*State) ModelSummariesForUser ¶
func (st *State) ModelSummariesForUser(user names.UserTag, all bool) ([]ModelSummary, error)
func (*State) ModelUUID ¶
ModelUUID returns the model UUID for the model controlled by this state instance.
func (*State) ModelUUIDsForUser ¶
ModelUUIDsForUser returns a list of models that the user is able to access. Results are sorted by (name, owner).
func (*State) MongoSession ¶
func (st *State) MongoSession() *mgo.Session
MongoSession returns the underlying mongodb session used by the state. It is exposed so that external code can maintain the mongo replica set and should not otherwise be used.
func (*State) MongoVersion ¶
MongoVersion return the string repre
func (*State) NeedsCleanup ¶
NeedsCleanup returns true if documents previously marked for removal exist.
func (*State) NewBakeryConfig ¶
func (st *State) NewBakeryConfig() bakerystorage.BakeryConfig
NewBakeryConfig returns a new bakerystorage.BakeryConfig instance.
func (*State) NewBakeryStorage ¶
func (st *State) NewBakeryStorage() (bakerystorage.ExpirableStorage, error)
NewBakeryStorage returns a new bakery.Storage. By default, items added to the store are retained until deleted explicitly. The store's ExpireAfter method can be called to derive a new store that will expire items at the specified time.
func (*State) NewControllerSettings ¶
func (st *State) NewControllerSettings() *StateSettings
NewControllerSettings returns a new StateSettings reference for working with controller settings in the current database.
func (*State) NewSettings ¶
func (st *State) NewSettings() *StateSettings
NewSettings returns a new StateSettings reference for working with settings in the current database.
func (*State) OfferConnectionForRelation ¶
func (st *State) OfferConnectionForRelation(relationKey string) (*OfferConnection, error)
OfferConnectionForRelation returns the offer connection for the specified relation.
func (*State) OfferConnections ¶
func (st *State) OfferConnections(offerUUID string) ([]*OfferConnection, error)
OfferConnections returns the offer connections for an offer.
func (*State) OfferConnectionsForUser ¶
func (st *State) OfferConnectionsForUser(username string) ([]*OfferConnection, error)
OfferConnectionsForUser returns the offer connections for the specified user.
func (*State) PrepareCharmUpload ¶
PrepareCharmUpload must be called before a charm store charm is uploaded to the provider storage in order to create a charm document in state. If a charm with the same URL is already in state, it will be returned as a *state.Charm (it can be still pending or already uploaded). Otherwise, a new charm document is added in state with just the given charm URL and PendingUpload=true, which is then returned as a *state.Charm.
The url's schema must be charmstore ("cs") or a charmhub ("ch") and it must include a revision that isn't a negative value.
func (*State) PrepareLocalCharmUpload ¶
PrepareLocalCharmUpload must be called before a local charm is uploaded to the provider storage in order to create a charm document in state. It returns the chosen unique charm URL reserved in state for the charm.
The url's schema must be "local" and it must include a revision.
func (*State) ProcessDyingModel ¶
ProcessDyingModel checks if the model is Dying and empty, and if so, transitions the model to Dead.
If the model is non-empty because it is the controller model and still contains hosted models, an error satisfying IsHasHostedModelsError will be returned. If the model is otherwise non-empty, an error satisfying IsNonEmptyModelError will be returned.
func (*State) ReadSettings ¶
ReadSettings returns the settings for the given key.
func (*State) RemoteApplication ¶
func (st *State) RemoteApplication(name string) (_ *RemoteApplication, err error)
RemoteApplication returns a remote application state by name.
func (*State) RemoteApplicationByToken ¶
func (st *State) RemoteApplicationByToken(token string) (_ *RemoteApplication, err error)
RemoteApplicationByToken returns a remote application state by token.
func (*State) RemoteConnectionStatus ¶
func (st *State) RemoteConnectionStatus(offerUUID string) (*RemoteConnectionStatus, error)
RemoteConnectionStatus returns summary information about connections to the specified offer.
func (*State) RemoteEntities ¶
func (st *State) RemoteEntities() *RemoteEntities
RemoteEntities returns a wrapped state instance providing access to the remote entities collection.
func (*State) RemoveAllBlocksForController ¶
RemoveAllBlocksForController removes all the blocks for the controller. It does not prevent new blocks from being added during / after removal.
func (*State) RemoveCloud ¶
RemoveCloud removes a cloud and any credentials for that cloud. If the cloud is in use, ie has models deployed to it, the operation fails.
func (*State) RemoveCloudAccess ¶
RemoveCloudAccess removes the access permission for a user on a cloud.
func (*State) RemoveCloudCredential ¶
RemoveCloudCredential removes a cloud credential with the given tag.
func (*State) RemoveControllerReference ¶
RemoveControllerReference will unregister Controller from being part of the set of Controllers. It must not have or want to vote, and it must not be the last controller.
func (*State) RemoveDyingModel ¶
RemoveDyingModel sets current model to dead then removes all documents from multi-model collections.
func (*State) RemoveExportingModelDocs ¶
RemoveExportingModelDocs removes all documents from multi-model collections for the current model. This method asserts that the model's migration mode is "exporting".
func (*State) RemoveImportingModelDocs ¶
RemoveImportingModelDocs removes all documents from multi-model collections for the current model. This method asserts that the model's migration mode is "importing".
func (*State) RemoveModelsCredential ¶
RemoveModelsCredential clears out given credential reference from all models that have it.
func (*State) RemoveOfferAccess ¶
RemoveOfferAccess removes the access permission for a user on an offer.
func (*State) RemoveUser ¶
RemoveUser marks the user as deleted. This obviates the ability of a user to function, but keeps the userDoc retaining provenance, i.e. auditing.
func (*State) RemoveUserAccess ¶
RemoveUserAccess removes access for subject to the passed tag.
func (*State) Report ¶
Report conforms to the Dependency Engine Report() interface, giving an opportunity to introspect what is going on at runtime.
func (*State) ResolveConstraints ¶
func (st *State) ResolveConstraints(cons constraints.Value) (constraints.Value, error)
ResolveConstraints combines the given constraints with the environ constraints to get a constraints which will be used to create a new instance.
func (*State) ResourcesPersistence ¶
func (st *State) ResourcesPersistence() (ResourcesPersistence, error)
ResourcesPersistence returns the resources persistence functionality for the current state.
func (*State) ResumeTransactions ¶
ResumeTransactions resumes all pending transactions.
func (*State) SLACredential ¶
SLACredential returns the SLA credential of the current connected model.
func (*State) SafeControllerIds ¶
SafeControllerIds returns the ids of the controller nodes by looking for the newer "controller-ids" attribute but falling back to the legacy "machineids" if needed. This method is only used when preparing for upgrades since 2.6 or earlier used "machineids".
func (*State) SaveCloudService ¶
func (st *State) SaveCloudService(args SaveCloudServiceArgs) (_ *CloudService, err error)
SaveCloudService creates a cloud service.
func (*State) SaveProviderSubnets ¶
func (st *State) SaveProviderSubnets(subnets []network.SubnetInfo, spaceID string) error
SaveProviderSubnets loads subnets into state. Currently it does not delete removed subnets.
func (*State) SetAPIHostPorts ¶
func (st *State) SetAPIHostPorts(newHostPorts []network.SpaceHostPorts) error
SetAPIHostPorts sets the addresses, if changed, of two collections:
- The list of *all* addresses at which the API is accessible.
- The list of addresses at which the API can be accessed by agents according to the controller management space configuration.
Each server is represented by one element in the top level slice.
func (*State) SetAdminMongoPassword ¶
SetAdminMongoPassword sets the administrative password to access the state. If the password is non-empty, all subsequent attempts to access the state must be authorized; otherwise no authorization is required.
func (*State) SetMetricBatchesSent ¶
SetMetricBatchesSent sets sent on each MetricBatch corresponding to the uuids provided.
func (*State) SetModelAgentVersion ¶
func (st *State) SetModelAgentVersion(newVersion version.Number, ignoreAgentVersions bool) (err error)
SetModelAgentVersion changes the agent version for the model to the given version, only if the model is in a stable state (all agents are running the current version). If this is a hosted model, newVersion cannot be higher than the controller version.
func (*State) SetModelConstraints ¶
func (st *State) SetModelConstraints(cons constraints.Value) error
SetModelConstraints replaces the current model constraints.
func (*State) SetModelMeterStatus ¶
SetModelMeterStatus sets the meter status for the current connected model.
func (*State) SetSSHHostKeys ¶
func (st *State) SetSSHHostKeys(tag names.MachineTag, keys SSHHostKeys) error
SetSSHHostKeys updates the stored SSH host keys for an entity.
See the note for GetSSHHostKeys regarding supported entities.
func (*State) SetStateServingInfo ¶
func (st *State) SetStateServingInfo(info jujucontroller.StateServingInfo) error
SetStateServingInfo stores information needed for running a controller
func (*State) SetUserAccess ¶
func (st *State) SetUserAccess(subject names.UserTag, target names.Tag, access permission.Access) (permission.UserAccess, error)
SetUserAccess sets <access> level on <target> to <subject>.
func (*State) Space ¶
Space returns a space from state that matches the input ID. An error is returned if the space does not exist or if there was a problem accessing its information.
func (*State) SpaceByName ¶
SpaceByName returns a space from state that matches the input name. An error is returned if the space does not exist or if there was a problem accessing its information.
func (*State) StartSync ¶
func (st *State) StartSync()
StartSync forces watchers to resynchronize their state with the database immediately. This will happen periodically automatically. This method is called only from tests.
func (*State) StateServingInfo ¶
func (st *State) StateServingInfo() (jujucontroller.StateServingInfo, error)
StateServingInfo returns information for running a controller machine
func (*State) Subnet ¶
Subnet returns the subnet identified by the input ID, or an error if it is not found.
func (*State) SubnetByCIDR ¶
SubnetByCIDR returns a unique subnet matching the input CIDR. If no unique match is achieved, an error is returned. TODO (manadart 2020-03-11): As of this date, CIDR remains a unique identifier for a subnet due to how we constrain provider networking implementations. When this changes, callers relying on this method to return a unique match will need attention. Usage of this method should probably be phased out.
func (*State) SubnetUpdate ¶
func (st *State) SubnetUpdate(args network.SubnetInfo) error
SubnetUpdate adds new info to the subnet based on provided info.
func (*State) SubnetsByCIDR ¶
SubnetsByCIDR returns the subnets matching the input CIDR.
func (*State) SwitchBlockOff ¶
SwitchBlockOff disables block of specified type for the current model.
func (*State) SwitchBlockOn ¶
SwitchBlockOn enables block of specified type for the current model.
func (*State) ToolsStorage ¶
func (st *State) ToolsStorage() (binarystorage.StorageCloser, error)
ToolsStorage returns a new binarystorage.StorageCloser that stores tools metadata in the "juju" database "toolsmetadata" collection.
func (*State) TrackQueries ¶
func (s *State) TrackQueries(method string) QueryTracker
TrackQueries allows tests to turn on a mechanism to count and track the database queries made. The query is counted if the method specified is found in the traceback. It is currently just using a string.Contains check. We may want to extend this functionality at some state to use regex, or support multiple matches.
func (*State) UnitPayloads ¶
func (st *State) UnitPayloads(unit *Unit) (UnitPayloads, error)
UnitPayloads returns a UnitPayloads for the supplied unit.
func (*State) UnitsInError ¶
UnitsInError returns the units which have an agent status of Error.
func (*State) UpdateCloud ¶
UpdateCloud updates an existing cloud with the given name and details. Note that the Config is deliberately ignored - it's only relevant when bootstrapping.
func (*State) UpdateCloudAccess ¶
func (st *State) UpdateCloudAccess(cloud string, user names.UserTag, access permission.Access) error
UpdateCloudAccess changes the user's access permissions on a cloud.
func (*State) UpdateCloudCredential ¶
func (st *State) UpdateCloudCredential(tag names.CloudCredentialTag, credential cloud.Credential) error
UpdateCloudCredential adds or updates a cloud credential with the given tag.
func (*State) UpdateControllerConfig ¶
func (st *State) UpdateControllerConfig(updateAttrs map[string]interface{}, removeAttrs []string) error
UpdateControllerConfig allows changing some of the configuration for the controller. Changes passed in updateAttrs will be applied to the current config, and keys in removeAttrs will be unset (and so revert to their defaults). Only a subset of keys can be changed after bootstrapping.
func (*State) UpdateModelConfigDefaultValues ¶
func (st *State) UpdateModelConfigDefaultValues(updateAttrs map[string]interface{}, removeAttrs []string, regionSpec *environscloudspec.CloudRegionSpec) error
UpdateModelConfigDefaultValues updates the inherited settings used when creating a new model.
func (*State) UpdateOfferAccess ¶
func (st *State) UpdateOfferAccess(offer names.ApplicationOfferTag, user names.UserTag, access permission.Access) error
UpdateOfferAccess changes the user's access permissions on an offer.
func (*State) UpdateUploadedCharm ¶
UpdateUploadedCharm marks the given charm URL as uploaded and updates the rest of its data, returning it as *state.Charm.
func (*State) UserAccess ¶
func (st *State) UserAccess(subject names.UserTag, target names.Tag) (permission.UserAccess, error)
UserAccess returns a new permission.UserAccess for the passed subject and target.
func (*State) UserPermission ¶
func (st *State) UserPermission(subject names.UserTag, target names.Tag) (permission.Access, error)
UserPermission returns the access permission for the passed subject and target.
func (*State) WatchAPIHostPortsForAgents ¶
func (st *State) WatchAPIHostPortsForAgents() NotifyWatcher
WatchAPIHostPortsForAgents returns a NotifyWatcher that notifies when the set of API addresses usable by agents changes.
func (*State) WatchAPIHostPortsForClients ¶
func (st *State) WatchAPIHostPortsForClients() NotifyWatcher
WatchAPIHostPortsForClients returns a NotifyWatcher that notifies when the set of API addresses changes.
func (*State) WatchActionLogs ¶
func (st *State) WatchActionLogs(actionId string) StringsWatcher
WatchActionLogs starts and returns a StringsWatcher that notifies on new log messages for a specified action being added. The strings are json encoded action messages.
func (*State) WatchApplications ¶
func (st *State) WatchApplications() StringsWatcher
WatchApplications returns a StringsWatcher that notifies of changes to the lifecycles of the applications in the model.
func (*State) WatchCleanups ¶
func (st *State) WatchCleanups() NotifyWatcher
WatchCleanups starts and returns a CleanupWatcher.
func (*State) WatchControllerConfig ¶
func (st *State) WatchControllerConfig() NotifyWatcher
WatchControllerConfig returns a NotifyWatcher for controller settings.
func (*State) WatchControllerInfo ¶
func (st *State) WatchControllerInfo() StringsWatcher
WatchControllerInfo returns a NotifyWatcher for the controllers collection
func (*State) WatchControllerStatusChanges ¶
func (st *State) WatchControllerStatusChanges() StringsWatcher
WatchControllerStatusChanges starts and returns a StringsWatcher that notifies when the status of a controller node changes. TODO(cherylj) Add unit tests for this, as per bug 1543408.
func (*State) WatchCredential ¶
func (st *State) WatchCredential(cred names.CloudCredentialTag) NotifyWatcher
WatchCredential returns a new NotifyWatcher watching for changes to the specified credential.
func (*State) WatchForMigration ¶
func (st *State) WatchForMigration() NotifyWatcher
WatchForMigration returns a notify watcher which reports when a migration is in progress for the model associated with the State.
func (*State) WatchForUnitAssignment ¶
func (st *State) WatchForUnitAssignment() StringsWatcher
WatchForUnitAssignment watches for new applications that request units to be assigned to machines.
func (*State) WatchMachineRemovals ¶
func (st *State) WatchMachineRemovals() NotifyWatcher
WatchMachineRemovals returns a NotifyWatcher which triggers whenever machine removal records are added or removed.
func (*State) WatchMigrationStatus ¶
func (st *State) WatchMigrationStatus() NotifyWatcher
WatchMigrationStatus returns a NotifyWatcher which triggers whenever the status of latest migration for the State's model changes. One instance can be used across migrations. The watcher will report changes when one migration finishes and another one begins.
Note that this watcher does not produce an initial event if there's never been a migration attempt for the model.
func (*State) WatchMinUnits ¶
func (st *State) WatchMinUnits() StringsWatcher
WatchMinUnits returns a StringsWatcher for the minUnits collection
func (*State) WatchModelEntityReferences ¶
func (st *State) WatchModelEntityReferences(mUUID string) NotifyWatcher
WatchModelEntityReferences returns a NotifyWatcher waiting for the Model Entity references to change for specified model.
func (*State) WatchModelLives ¶
func (st *State) WatchModelLives() StringsWatcher
WatchModelLives returns a StringsWatcher that notifies of changes to any model life values. The watcher will not send any more events for a model after it has been observed to be Dead.
func (*State) WatchModelMachineStartTimes ¶
func (st *State) WatchModelMachineStartTimes(quiesceInterval time.Duration) StringsWatcher
WatchModelMachineStartTimes watches the non-container machines in the model for changes to the Life or AgentStartTime fields and reports them as a batch after the specified quiesceInterval time has passed without seeing any new change events.
func (*State) WatchModelMachines ¶
func (st *State) WatchModelMachines() StringsWatcher
WatchModelMachines returns a StringsWatcher that notifies of changes to the lifecycles of the machines (but not containers) in the model.
func (*State) WatchModels ¶
func (st *State) WatchModels() StringsWatcher
WatchModels returns a StringsWatcher that notifies of changes to any models. If a model is removed this *won't* signal that the model has gone away - it's based on a collectionWatcher which omits these events.
func (*State) WatchOffer ¶
func (st *State) WatchOffer(offerName string) NotifyWatcher
WatchOffer returns a new NotifyWatcher watching for changes to the specified offer.
func (*State) WatchOfferStatus ¶
func (st *State) WatchOfferStatus(offerUUID string) (NotifyWatcher, error)
WatchOfferStatus returns a NotifyWatcher that notifies of changes to the offer's status.
func (*State) WatchOpenedPorts ¶
func (st *State) WatchOpenedPorts() StringsWatcher
WatchOpenedPorts starts and returns a StringsWatcher notifying of changes to the openedPorts collection. Reported changes have the following format: "<machine-id>:[<subnet-CIDR>]", i.e. "0:10.20.0.0/16" or "1:" (empty subnet ID is allowed for backwards-compatibility).
func (*State) WatchRemoteApplications ¶
func (st *State) WatchRemoteApplications() StringsWatcher
WatchRemoteApplications returns a StringsWatcher that notifies of changes to the lifecycles of the remote applications in the model.
func (*State) WatchRemoteRelations ¶
func (st *State) WatchRemoteRelations() StringsWatcher
WatchRemoteRelations returns a StringsWatcher that notifies of changes to the lifecycles of the remote relations in the model.
func (*State) WatchSubnets ¶
func (st *State) WatchSubnets(subnetFilter func(id interface{}) bool) StringsWatcher
WatchSubnets returns a StringsWatcher that notifies of changes to the subnets in the model.
func (*State) WatchUpgradeInfo ¶
func (st *State) WatchUpgradeInfo() NotifyWatcher
WatchUpgradeInfo returns a watcher for observing changes to upgrade synchronisation state.
type StateDocumentFactory ¶
type StateDocumentFactory interface { NewRemoteApplication(*remoteApplicationDoc) *RemoteApplication MakeRemoteApplicationDoc(description.RemoteApplication) *remoteApplicationDoc MakeStatusDoc(description.Status) statusDoc MakeStatusOp(string, statusDoc) txn.Op }
StateDocumentFactory 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 StatePool ¶
type StatePool struct {
// contains filtered or unexported fields
}
StatePool is a cache of State instances for multiple models. Clients should call Release when they have finished with any state.
func OpenStatePool ¶
func OpenStatePool(args OpenParams) (_ *StatePool, err error)
OpenStatePool returns a new StatePool instance.
func (*StatePool) Get ¶
func (p *StatePool) Get(modelUUID string) (*PooledState, error)
Get returns a PooledState for a given model, creating a new State instance if required. If the State has been marked for removal, an error is returned.
func (*StatePool) GetModel ¶
func (p *StatePool) GetModel(modelUUID string) (*Model, PoolHelper, error)
GetModel is a convenience method for getting a Model for a State.
func (*StatePool) IntrospectionReport ¶
IntrospectionReport produces the output for the introspection worker in order to look inside the state pool.
func (*StatePool) Remove ¶
Remove takes the state out of the pool and closes it, or marks it for removal if it's currently being used (indicated by Gets without corresponding Releases). The boolean result indicates whether or not the state was removed.
func (*StatePool) Report ¶
Report conforms to the Dependency Engine Report() interface, giving an opportunity to introspect what is going on at runtime.
func (*StatePool) StartWorkers ¶
StartWorkers is used by factory.NewModel in tests. TODO(wallyworld) refactor to remove this dependency.
func (*StatePool) SystemState ¶
SystemState returns the State passed in to NewStatePool.
func (*StatePool) TxnWatcherStarted ¶
func (p *StatePool) TxnWatcherStarted() <-chan struct{}
TxnWatcherStarted returns a channel that is closed when the pool's TxnWatcher has fully started.
type StateSettings ¶
type StateSettings struct {
// contains filtered or unexported fields
}
StateSettings is used to expose various settings APIs outside of the state package.
func NewStateSettings ¶
func NewStateSettings(backend modelBackend) *StateSettings
NewStateSettings creates a StateSettings from a modelBackend (e.g. State). TODO (manadart 2020-01-21): Usage of this method should be phased out in favour of NewSettings, above. That method facilitates state mocks and shims for testing in external packages in a way that this method can not, because the package-private modelBackend is inaccessible to them.
func (*StateSettings) CreateSettings ¶
func (s *StateSettings) CreateSettings(key string, settings map[string]interface{}) error
CreateSettings exposes createSettings on state for use outside the state package.
func (*StateSettings) DeltaOps ¶
func (s *StateSettings) DeltaOps(key string, delta settings.ItemChanges) ([]txn.Op, error)
DeltaOps returns the operations required to modify the settings document identified by the input key, with the the input settings changes.
func (*StateSettings) ListSettings ¶
func (s *StateSettings) ListSettings(keyPrefix string) (map[string]map[string]interface{}, error)
ListSettings exposes listSettings on state for use outside the state package.
func (*StateSettings) ReadSettings ¶
func (s *StateSettings) ReadSettings(key string) (map[string]interface{}, error)
ReadSettings exposes readSettings on state for use outside the state package.
func (*StateSettings) RemoveSettings ¶
func (s *StateSettings) RemoveSettings(key string) error
RemoveSettings exposes removeSettings on state for use outside the state package.
func (*StateSettings) ReplaceSettings ¶
func (s *StateSettings) ReplaceSettings(key string, settings map[string]interface{}) error
ReplaceSettings exposes replaceSettings on state for use outside the state package.
type StorageAttachment ¶
type StorageAttachment interface { // StorageInstance returns the tag of the corresponding storage // instance. StorageInstance() names.StorageTag // Unit returns the tag of the corresponding unit. Unit() names.UnitTag // Life reports whether the storage attachment is Alive, Dying or Dead. Life() Life }
StorageAttachment represents the state of a unit's attachment to a storage instance. A non-shared storage instance will have a single attachment for the storage instance's owning unit, whereas a shared storage instance will have an attachment for each unit of the application owning the storage instance.
type StorageConstraints ¶
type StorageConstraints struct { // Pool is the name of the storage pool from which to provision the // storage instances. Pool string `bson:"pool"` // Size is the required size of the storage instances, in MiB. Size uint64 `bson:"size"` // Count is the required number of storage instances. Count uint64 `bson:"count"` }
StorageConstraints contains the user-specified constraints for provisioning storage instances for an application unit.
type StorageInstance ¶
type StorageInstance interface { Entity // StorageTag returns the tag for the storage instance. StorageTag() names.StorageTag // Kind returns the storage instance kind. Kind() StorageKind // Owner returns the tag of the application or unit that owns this storage // instance, and a boolean indicating whether or not there is an owner. // // When a non-shared storage instance is detached from the unit, the // storage instance's owner will be cleared, allowing it to be attached // to another unit. Owner() (names.Tag, bool) // StorageName returns the name of the storage, as defined in the charm // storage metadata. This does not uniquely identify storage instances, // but identifies the group that the instances belong to. StorageName() string // Life reports whether the storage instance is Alive, Dying or Dead. Life() Life // Pool returns the name of the storage pool from which the storage // instance has been or will be provisioned. Pool() string }
StorageInstance represents the state of a unit or application-wide storage instance in the model.
type StorageKind ¶
type StorageKind int
StorageKind defines the type of a store: whether it is a block device or a filesystem.
const ( StorageKindUnknown StorageKind = iota StorageKindBlock StorageKindFilesystem )
func (StorageKind) String ¶
func (k StorageKind) String() string
String returns a human readable string represting the type.
type StringsWatcher ¶
StringsWatcher generates signals when something changes, returning the changes as a list of strings.
type Subnet ¶
type Subnet struct {
// contains filtered or unexported fields
}
func (*Subnet) AvailabilityZones ¶
AvailabilityZones returns the availability zones of the subnet. If the subnet is not associated with an availability zones it will return an the empty slice.
func (*Subnet) EnsureDead ¶
EnsureDead sets the Life of the subnet to Dead if it is Alive. If the subnet is already Dead, no error is returned. When the subnet is no longer Alive or already removed, errNotAlive is returned.
func (*Subnet) FanLocalUnderlay ¶
func (*Subnet) FanOverlay ¶
func (*Subnet) NetworkSubnet ¶
func (s *Subnet) NetworkSubnet() network.SubnetInfo
NetworkSubnet maps the subnet fields into a network.SubnetInfo.
func (*Subnet) ProviderId ¶
ProviderId returns the provider-specific ID of the subnet.
func (*Subnet) ProviderNetworkId ¶
ProviderNetworkId returns the provider id of the network containing this subnet.
func (*Subnet) Refresh ¶
Refresh refreshes the contents of the Subnet from the underlying state. It an error that satisfies errors.IsNotFound if the SubnetByCIDR has been removed.
func (*Subnet) Remove ¶
Remove removes a Dead subnet. If the subnet is not Dead or it is already removed, an error is returned. On success, all IP addresses added to the subnet are also removed.
func (*Subnet) SpaceID ¶
SpaceID returns the ID of the space the subnet is associated with. If the subnet is not associated with a space it will return network.AlphaSpaceId.
func (*Subnet) SpaceName ¶
SpaceName returns the space the subnet is associated with. If no space is associated, return the default space and log an error.
func (*Subnet) Update ¶
func (s *Subnet) Update(args network.SubnetInfo) error
Update adds new info to the subnet based on input info. Currently no data is changed unless it is the "undefined" space from MAAS. There are restrictions on the additions allowed:
- No change to CIDR; more work is required to determine how to handle.
- No change to ProviderId nor ProviderNetworkID; these are immutable.
func (*Subnet) UpdateSpaceOps ¶
UpdateSpaceOps returns operations that will ensure that the subnet is in the input space, provided the space exists.
type TransactionRunner ¶
TransactionRunner is an in-place usage for running transactions to a persistence store.
type Unit ¶
type Unit struct {
// contains filtered or unexported fields
}
Unit represents the state of an application unit.
func (*Unit) ActionSpecs ¶
func (u *Unit) ActionSpecs() (ActionSpecsByName, error)
ActionSpecs gets the ActionSpec map for the Unit's charm.
func (*Unit) AddAction ¶
func (u *Unit) AddAction(operationID, name string, payload map[string]interface{}, parallel *bool, executionGroup *string) (Action, error)
AddAction adds a new Action of type name and using arguments payload to this Unit, and returns its ID. Note that the use of spec.InsertDefaults mutates payload.
func (*Unit) AgentHistory ¶
func (u *Unit) AgentHistory() status.StatusHistoryGetter
AgentHistory returns an StatusHistoryGetter which can be used to query the status history of the unit's agent.
func (*Unit) AgentStatus ¶
func (u *Unit) AgentStatus() (status.StatusInfo, error)
AgentStatus calls Status for this unit's agent, this call is equivalent to the former call to Status when Agent and Unit where not separate entities.
func (*Unit) AgentTools ¶
AgentTools returns the tools that the agent is currently running. It an error that satisfies errors.IsNotFound if the tools have not yet been set.
func (*Unit) AllAddresses ¶
func (u *Unit) AllAddresses() (addrs network.SpaceAddresses, _ error)
AllAddresses returns the public and private addresses plus the container address of the unit (if known). Only relevant for CAAS models - will return an empty slice for IAAS models.
func (*Unit) Application ¶
func (u *Unit) Application() (*Application, error)
Application returns the application.
func (*Unit) ApplicationName ¶
ApplicationName returns the application name.
func (*Unit) AssignToCleanEmptyMachine ¶
AssignToCleanEmptyMachine assigns u to a machine which is marked as clean and is also not hosting any containers. A machine is clean if it has never had any principal units assigned to it. If there are no clean machines besides any machine(s) running JobHostEnviron, an error is returned. This method does not take constraints into consideration when choosing a machine (lp:1161919).
func (*Unit) AssignToCleanMachine ¶
AssignToCleanMachine assigns u to a machine which is marked as clean. A machine is clean if it has never had any principal units assigned to it. If there are no clean machines besides any machine(s) running JobHostEnviron, an error is returned. This method does not take constraints into consideration when choosing a machine (lp:1161919).
func (*Unit) AssignToMachine ¶
AssignToMachine assigns this unit to a given machine.
func (*Unit) AssignToNewMachine ¶
AssignToNewMachine assigns the unit to a new machine, with constraints determined according to the application and model constraints at the time of unit creation.
func (*Unit) AssignToNewMachineOrContainer ¶
AssignToNewMachineOrContainer assigns the unit to a new machine, with constraints determined according to the application and model constraints at the time of unit creation. If a container is required, a clean, empty machine instance is required on which to create the container. An existing clean, empty instance is first searched for, and if not found, a new one is created.
func (*Unit) AssignedMachineId ¶
AssignedMachineId returns the id of the assigned machine.
func (*Unit) AvailabilityZone ¶
AvailabilityZone returns the name of the availability zone into which the unit's machine instance was provisioned.
func (*Unit) CancelAction ¶
CancelAction removes a pending Action from the queue for this ActionReceiver and marks it as cancelled.
func (*Unit) ClearResolved ¶
ClearResolved removes any resolved setting on the unit.
func (*Unit) CompletedActions ¶
CompletedActions returns a list of actions that have finished for this unit.
func (*Unit) ConfigSettings ¶
ConfigSettings returns the complete set of application charm config settings available to the unit. Unset values will be replaced with the default value for the associated option, and may thus be nil when no default is specified.
func (*Unit) Constraints ¶
func (u *Unit) Constraints() (*constraints.Value, error)
Constraints returns the unit's deployment constraints.
func (*Unit) ContainerInfo ¶
func (u *Unit) ContainerInfo() (CloudContainer, error)
ContainerInfo returns information about the containing hosting this unit. This is only used for CAAS models.
func (*Unit) Destroy ¶
Destroy, when called on a Alive unit, advances its lifecycle as far as possible; it otherwise has no effect. In most situations, the unit's life is just set to Dying; but if a principal unit that is not assigned to a provisioned machine is Destroyed, it will be removed from state directly.
func (*Unit) DestroyOperation ¶
func (u *Unit) DestroyOperation() *DestroyUnitOperation
DestroyOperation returns a model operation that will destroy the unit.
func (*Unit) DestroyWithForce ¶
DestroyWithForce does the same thing as Destroy() but ignores errors.
func (*Unit) EnsureDead ¶
EnsureDead sets the unit lifecycle to Dead if it is Alive or Dying. It does nothing otherwise. If the unit has subordinates, it will return ErrUnitHasSubordinates; otherwise, if it has storage instances, it will return ErrUnitHasStorageInstances.
func (*Unit) GetMeterStatus ¶
func (u *Unit) GetMeterStatus() (MeterStatus, error)
GetMeterStatus returns the meter status for the unit.
func (*Unit) IsEmbedded ¶
IsEmbedded returns true when using new CAAS charms in embedded mode.
func (*Unit) IsPrincipal ¶
IsPrincipal returns whether the unit is deployed in its own container, and can therefore have subordinate applications deployed alongside it.
func (*Unit) OpenedPortRanges ¶
func (u *Unit) OpenedPortRanges() (UnitPortRanges, error)
OpenedPortRanges returns a UnitPortRanges object that can be used to query and/or mutate the port ranges opened by the unit on the machine it is assigned to.
Calls to OpenPortRanges will return back an error if the unit is not assigned to a machine.
func (*Unit) PasswordValid ¶
PasswordValid returns whether the given password is valid for the given unit.
func (*Unit) PendingActions ¶
PendingActions returns a list of actions pending for this unit.
func (*Unit) PrincipalName ¶
PrincipalName returns the name of the unit's principal. If the unit is not a subordinate, false is returned.
func (*Unit) PrivateAddress ¶
func (u *Unit) PrivateAddress() (network.SpaceAddress, error)
PrivateAddress returns the private address of the unit.
func (*Unit) PublicAddress ¶
func (u *Unit) PublicAddress() (network.SpaceAddress, error)
PublicAddress returns the public address of the unit.
func (*Unit) Refresh ¶
Refresh refreshes the contents of the Unit from the underlying state. It an error that satisfies errors.IsNotFound if the unit has been removed.
func (*Unit) RelationsInScope ¶
RelationsInScope returns the relations for which the unit has entered scope and not left it.
func (*Unit) RelationsJoined ¶
RelationsJoined returns the relations for which the unit has entered scope and neither left it nor prepared to leave it
func (*Unit) Remove ¶
Remove removes the unit from state, and may remove its application as well, if the application is Dying and no other references to it exist. It will fail if the unit is not Dead.
func (*Unit) RemoveOperation ¶
func (u *Unit) RemoveOperation(force bool) *RemoveUnitOperation
RemoveOperation returns a model operation that will remove the unit.
func (*Unit) RemoveWithForce ¶
RemoveWithForce removes the unit from state similar to the unit.Remove() but it ignores errors. In addition, this function also returns all non-fatal operational errors encountered.
func (*Unit) Resolve ¶
Resolve marks the unit as having had any previous state transition problems resolved, and informs the unit that it may attempt to reestablish normal workflow. The retryHooks parameter informs whether to attempt to reexecute previous failed hooks or to continue as if they had succeeded before.
func (*Unit) Resolved ¶
func (u *Unit) Resolved() ResolvedMode
Resolved returns the resolved mode for the unit.
func (*Unit) RunningActions ¶
RunningActions returns a list of actions running on this unit.
func (*Unit) SetAgentStatus ¶
func (u *Unit) SetAgentStatus(agentStatus status.StatusInfo) error
SetAgentStatus calls SetStatus for this unit's agent, this call is equivalent to the former call to SetStatus when Agent and Unit where not separate entities.
func (*Unit) SetAgentVersion ¶
SetAgentVersion sets the version of juju that the agent is currently running.
func (*Unit) SetCharmURL ¶
SetCharmURL marks the unit as currently using the supplied charm URL. An error will be returned if the unit is dead, or the charm URL not known.
func (*Unit) SetMeterStatus ¶
SetMeterStatus sets the meter status for the unit.
func (*Unit) SetPassword ¶
SetPassword sets the password for the machine's agent.
func (*Unit) SetResolved ¶
func (u *Unit) SetResolved(mode ResolvedMode) (err error)
SetResolved marks the unit as having had any previous state transition problems resolved, and informs the unit that it may attempt to reestablish normal workflow. The resolved mode parameter informs whether to attempt to reexecute previous failed hooks or to continue as if they had succeeded before.
func (*Unit) SetState ¶
func (u *Unit) SetState(unitState *UnitState, limits UnitStateSizeLimits) error
SetState replaces the currently stored state for a unit with the contents of the provided UnitState.
Use this for testing, otherwise use SetStateOperation.
func (*Unit) SetStateOperation ¶
func (u *Unit) SetStateOperation(unitState *UnitState, limits UnitStateSizeLimits) ModelOperation
SetStateOperation returns a ModelOperation for replacing the currently stored state for a unit with the contents of the provided UnitState.
func (*Unit) SetStatus ¶
func (u *Unit) SetStatus(unitStatus status.StatusInfo) error
SetStatus sets the status of the unit agent. The optional values allow to pass additional helpful status data. This method relies on globalKey instead of globalAgentKey since it is part of the effort to separate Unit from UnitAgent. Now the SetStatus for UnitAgent is in the UnitAgent struct.
func (*Unit) SetUpgradeSeriesStatus ¶
func (u *Unit) SetUpgradeSeriesStatus(status model.UpgradeSeriesStatus, message string) error
SetUpgradeSeriesStatus sets the upgrade status of the units assigned machine.
func (*Unit) SetWorkloadVersion ¶
SetWorkloadVersion sets the version of the workload that the unit is currently running.
func (*Unit) ShouldBeAssigned ¶
ShouldBeAssigned returns whether the unit should be assigned to a machine. IAAS models require units to be assigned.
func (*Unit) Status ¶
func (u *Unit) Status() (status.StatusInfo, error)
Status returns the status of the unit. This method relies on globalKey instead of globalAgentKey since it is part of the effort to separate Unit from UnitAgent. Now the Status for UnitAgent is in the UnitAgent struct.
func (*Unit) StatusHistory ¶
func (u *Unit) StatusHistory(filter status.StatusHistoryFilter) ([]status.StatusInfo, error)
StatusHistory returns a slice of at most <size> StatusInfo items or items as old as <date> or items newer than now - <delta> time representing past statuses for this unit.
func (*Unit) StorageConstraints ¶
func (u *Unit) StorageConstraints() (map[string]StorageConstraints, error)
StorageConstraints returns the unit's storage constraints.
func (*Unit) SubordinateNames ¶
SubordinateNames returns the names of any subordinate units.
func (*Unit) Tag ¶
func (u *Unit) Tag() names.Tag
Tag returns a name identifying the unit. The returned name will be different from other Tag values returned by any other entities from the same state.
func (*Unit) UnassignFromMachine ¶
UnassignFromMachine removes the assignment between this unit and the machine it's assigned to.
func (*Unit) UnitTag ¶
func (u *Unit) UnitTag() names.UnitTag
UnitTag returns a names.UnitTag representing this Unit, unless the unit Name is invalid, in which case it will panic
func (*Unit) UpdateOperation ¶
func (u *Unit) UpdateOperation(props UnitUpdateProperties) *UpdateUnitOperation
UpdateOperation returns a model operation that will update a unit.
func (*Unit) UpgradeSeriesStatus ¶
func (u *Unit) UpgradeSeriesStatus() (model.UpgradeSeriesStatus, error)
UpgradeSeriesStatus returns the upgrade status of the units assigned machine.
func (*Unit) Watch ¶
func (u *Unit) Watch() NotifyWatcher
Watch returns a watcher for observing changes to a unit.
func (*Unit) WatchActionNotifications ¶
func (u *Unit) WatchActionNotifications() StringsWatcher
WatchActionNotifications starts and returns a StringsWatcher that notifies when actions with Id prefixes matching this Unit are added
func (*Unit) WatchApplicationConfigSettings ¶
func (u *Unit) WatchApplicationConfigSettings() (NotifyWatcher, error)
WatchApplicationConfigSettings is the same as WatchConfigSettings but notifies on changes to application configuration not charm configuration.
func (*Unit) WatchApplicationConfigSettingsHash ¶
func (u *Unit) WatchApplicationConfigSettingsHash() (StringsWatcher, error)
WatchApplicationConfigSettingsHash is the same as WatchConfigSettingsHash but watches the application's config rather than charm configuration. Yields a hash of the application config with each change.
func (*Unit) WatchConfigSettings ¶
func (u *Unit) WatchConfigSettings() (NotifyWatcher, error)
WatchConfigSettings returns a watcher for observing changes to the unit's application configuration settings. The unit must have a charm URL set before this method is called, and the returned watcher will be valid only while the unit's charm URL is not changed. TODO(fwereade): this could be much smarter; if it were, uniter.Filter could be somewhat simpler.
func (*Unit) WatchConfigSettingsHash ¶
func (u *Unit) WatchConfigSettingsHash() (StringsWatcher, error)
WatchConfigSettingsHash returns a watcher that yields a hash of the unit's charm config settings whenever they are changed. The returned watcher will be valid only while the application's charm URL is not changed.
func (*Unit) WatchContainerAddresses ¶
func (u *Unit) WatchContainerAddresses() NotifyWatcher
WatchContainerAddresses returns a new NotifyWatcher watching the unit's pod address(es).
func (*Unit) WatchLXDProfileUpgradeNotifications ¶
func (u *Unit) WatchLXDProfileUpgradeNotifications() (StringsWatcher, error)
WatchLXDProfileUpgradeNotifications returns a watcher that observes the status of a lxd profile upgrade by monitoring changes on the unit machine's lxd profile upgrade completed field that is specific to itself.
func (*Unit) WatchMachineAndEndpointAddressesHash ¶
func (u *Unit) WatchMachineAndEndpointAddressesHash() (StringsWatcher, error)
WatchMachineAndEndpointAddressesHash returns a StringsWatcher that reports changes to the hash value of the address assignments to the unit's endpoints. The hash is recalculated when any of the following events occurs: - the machine addresses for the unit change. - the endpoint bindings for the unit's application change.
func (*Unit) WatchMeterStatus ¶
func (u *Unit) WatchMeterStatus() NotifyWatcher
WatchMeterStatus returns a watcher observing changes that affect the meter status of a unit.
func (*Unit) WatchPendingActionNotifications ¶
func (u *Unit) WatchPendingActionNotifications() StringsWatcher
WatchPendingActionNotifications is part of the ActionReceiver interface.
func (*Unit) WatchSubordinateUnits ¶
func (u *Unit) WatchSubordinateUnits() StringsWatcher
WatchSubordinateUnits returns a StringsWatcher tracking the unit's subordinate units.
func (*Unit) WorkloadVersion ¶
WorkloadVersion returns the version of the running workload set by the charm (eg, the version of postgresql that is running, as opposed to the version of the postgresql charm).
func (*Unit) WorkloadVersionHistory ¶
func (u *Unit) WorkloadVersionHistory() *HistoryGetter
WorkloadVersionHistory returns a HistoryGetter which enables the caller to request past workload version changes.
type UnitAgent ¶
type UnitAgent struct { status.StatusHistoryGetter // contains filtered or unexported fields }
UnitAgent represents the state of an application's unit agent.
func (*UnitAgent) SetStatus ¶
func (u *UnitAgent) SetStatus(unitAgentStatus status.StatusInfo) (err error)
SetStatus sets the status of the unit agent. The optional values allow to pass additional helpful status data.
func (*UnitAgent) Status ¶
func (u *UnitAgent) Status() (status.StatusInfo, error)
Status returns the status of the unit agent.
func (*UnitAgent) StatusHistory ¶
func (u *UnitAgent) 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 agent.
type UnitAssignment ¶
type UnitAssignment struct { // Unit is the ID of the unit to be assigned. Unit string // Scope is the placement scope to apply to the unit. Scope string // Directive is the placement directive to apply to the unit. Directive string }
UnitAssignment represents a staged unit assignment.
type UnitAssignmentResult ¶
UnitAssignmentResult is the result of running a staged unit assignment.
type UnitPayloads ¶
type UnitPayloads struct {
// contains filtered or unexported fields
}
UnitPayloads lets you CRUD payloads for a single unit.
func (UnitPayloads) List ¶
func (up UnitPayloads) List(names ...string) ([]payload.Result, error)
List has two different modes of operation, because that's never a bad idea. If you pass no args, it returns information about all payloads tracked by the unit; if you pass names, it returns a slice of results corresponding to names, in which any names not tracked have both the NotFound field *and* an Error set.
func (UnitPayloads) LookUp ¶
func (UnitPayloads) LookUp(name, rawID string) (string, error)
LookUp returns its first argument and no error.
func (UnitPayloads) SetStatus ¶
func (up UnitPayloads) SetStatus(name, status string) error
SetStatus updates the raw status for the identified payload to the provided value. If the payload is missing then payload.ErrNotFound is returned.
func (UnitPayloads) Track ¶
func (up UnitPayloads) Track(pl payload.Payload) error
Track inserts the provided payload info in state. If the payload is already in the DB then it is replaced.
func (UnitPayloads) Untrack ¶
func (up UnitPayloads) Untrack(name string) error
Untrack removes the identified payload from state. It does not trigger the actual destruction of the payload. If the payload is missing then this is a noop.
type UnitPortRanges ¶
type UnitPortRanges interface { // UnitName returns the name of the unit these ranges apply to. UnitName() string // ForEndpoint returns a list of open port ranges for a particular // application endpoint. ForEndpoint(endpointName string) []network.PortRange // ByEndpoint returns the list of open port ranges grouped by // application endpoint. ByEndpoint() network.GroupedPortRanges // Open records a request for opening the specified port range for the // specified endpoint. Open(endpoint string, portRange network.PortRange) // Close records a request for closing a particular port range for the // specified endpoint. Close(endpoint string, portRange network.PortRange) // UniquePortRanges returns a slice of unique open PortRanges across // all endpoints. UniquePortRanges() []network.PortRange // Changes returns a ModelOperation for applying any changes that were // made to the port ranges for this unit. Changes() ModelOperation }
UnitPortRanges is implemented by types that can query and/or manipulate a set of opened port ranges for a particular unit in an endpoint-aware manner.
type UnitState ¶
type UnitState struct {
// contains filtered or unexported fields
}
UnitState contains the various state saved for this unit, including from the charm itself and the uniter.
func (*UnitState) CharmState ¶
CharmState returns the unit's stored charm state and bool indicating whether the data was set.
func (*UnitState) MeterStatusState ¶
MeterStatusState returns the meter status state and a bool to indicate whether the data was set.
func (*UnitState) RelationState ¶
RelationState returns the relation state and bool indicating whether the data was set.
func (*UnitState) SetCharmState ¶
SetCharmState sets the charm state value.
func (*UnitState) SetMeterStatusState ¶
SetMeterStatusState sets the state value for meter state.
func (*UnitState) SetRelationState ¶
SetRelationState sets the relation state value.
func (*UnitState) SetStorageState ¶
SetStorageState sets the storage state value.
func (*UnitState) SetUniterState ¶
SetUniterState sets the uniter state value.
func (*UnitState) StorageState ¶
StorageState returns the storage state and bool indicating whether the data was set.
func (*UnitState) UniterState ¶
UniterState returns the uniter state and bool indicating whether the data was set.
type UnitStateSizeLimits ¶
type UnitStateSizeLimits struct { // The maximum allowed size for the charm state. It can be set to zero // to bypass the charm state quota checks. // quota checks will be MaxCharmStateSize int // The maximum allowed size for the uniter's state. It can be set to // zero to bypass the uniter state quota checks. MaxAgentStateSize int }
UnitStateSizeLimits defines the quota limits that are enforced when updating the state (charm and uniter) of a unit.
type UnitUpdateProperties ¶
type UnitUpdateProperties struct { ProviderId *string Address *string Ports *[]string UnitName *string AgentStatus *status.StatusInfo UnitStatus *status.StatusInfo CloudContainerStatus *status.StatusInfo }
UnitUpdateProperties holds information used to update the state model for the unit.
type UnitsWatcher ¶
type UnitsWatcher interface { Entity WatchUnits() StringsWatcher }
UnitsWatcher defines the methods needed to retrieve an entity (a machine or an application) and watch its units.
type UpdateMachineOperation ¶
type UpdateMachineOperation struct { AgentVersion *version.Binary Constraints *constraints.Value MachineAddresses *[]network.SpaceAddress ProviderAddresses *[]network.SpaceAddress PasswordHash *string // contains filtered or unexported fields }
UpdateMachineOperation is a model operation for updating a machine.
func (*UpdateMachineOperation) Build ¶
func (op *UpdateMachineOperation) Build(attempt int) ([]txn.Op, error)
Build is part of the ModelOperation interface.
func (*UpdateMachineOperation) Done ¶
func (op *UpdateMachineOperation) Done(err error) error
Done is part of the ModelOperation interface.
type UpdateUnitOperation ¶
type UpdateUnitOperation struct {
// contains filtered or unexported fields
}
UpdateUnitOperation is a model operation for updating a unit.
func (*UpdateUnitOperation) Build ¶
func (op *UpdateUnitOperation) Build(attempt int) ([]txn.Op, error)
Build is part of the ModelOperation interface.
func (*UpdateUnitOperation) Done ¶
func (op *UpdateUnitOperation) Done(err error) error
Done is part of the ModelOperation interface.
type UpdateUnitsOperation ¶
type UpdateUnitsOperation struct { Adds []*AddUnitOperation Deletes []*DestroyUnitOperation Updates []*UpdateUnitOperation }
UpdateUnitsOperation is a model operation for updating some units of an application.
func (*UpdateUnitsOperation) Build ¶
func (op *UpdateUnitsOperation) Build(attempt int) ([]txn.Op, error)
Build is part of the ModelOperation interface.
func (*UpdateUnitsOperation) Done ¶
func (op *UpdateUnitsOperation) Done(err error) error
Done is part of the ModelOperation interface.
type UpgradeInfo ¶
type UpgradeInfo struct {
// contains filtered or unexported fields
}
UpgradeInfo is used to synchronise controller upgrades.
func (*UpgradeInfo) Abort ¶
func (info *UpgradeInfo) Abort() error
Abort marks the current upgrade as aborted. It should be called if the upgrade can't be completed for some reason.
func (*UpgradeInfo) AllProvisionedControllersReady ¶
func (info *UpgradeInfo) AllProvisionedControllersReady() (bool, error)
AllProvisionedControllersReady returns true if and only if all controllers that have been started by the provisioner have called EnsureUpgradeInfo with matching versions.
When this returns true the master state controller can begin it's own upgrade.
func (*UpgradeInfo) ControllersDone ¶
func (info *UpgradeInfo) ControllersDone() []string
ControllersDone returns the machine ids for controllers that have completed their upgrades.
func (*UpgradeInfo) ControllersReady ¶
func (info *UpgradeInfo) ControllersReady() []string
ControllersReady returns the machine ids for controllers that have signalled that they are ready for upgrade.
func (*UpgradeInfo) PreviousVersion ¶
func (info *UpgradeInfo) PreviousVersion() version.Number
PreviousVersion returns the version being upgraded from.
func (*UpgradeInfo) Refresh ¶
func (info *UpgradeInfo) Refresh() error
Refresh updates the contents of the UpgradeInfo from underlying state.
func (*UpgradeInfo) SetControllerDone ¶
func (info *UpgradeInfo) SetControllerDone(controllerId string) error
SetControllerDone marks the supplied state controllerId as having completed its upgrades. When SetControllerDone is called by the last provisioned controller, the current upgrade info document will be archived with a status of UpgradeComplete.
func (*UpgradeInfo) SetStatus ¶
func (info *UpgradeInfo) SetStatus(status UpgradeStatus) error
SetStatus sets the status of the current upgrade. Checks are made to ensure that status changes are performed in the correct order.
func (*UpgradeInfo) Started ¶
func (info *UpgradeInfo) Started() time.Time
Started returns the time at which the upgrade was started.
func (*UpgradeInfo) Status ¶
func (info *UpgradeInfo) Status() UpgradeStatus
Status returns the status of the upgrade.
func (*UpgradeInfo) TargetVersion ¶
func (info *UpgradeInfo) TargetVersion() version.Number
TargetVersion returns the version being upgraded to.
func (*UpgradeInfo) Watch ¶
func (info *UpgradeInfo) Watch() NotifyWatcher
Watch returns a watcher for the state underlying the current UpgradeInfo instance. This is provided purely for convenience.
type UpgradeSeriesMessage ¶
type UpgradeSeriesMessage struct { Message string `bson:"message"` Timestamp time.Time `bson:"timestamp"` Seen bool `bson:"seen"` }
UpgradeSeriesMessage holds a message detailing why the upgrade series status was updated. This format of this message should be a single sentence similar to logging message. The string is accompanied by a timestamp and a boolean value indicating whether or not the message has been observed by a client.
type UpgradeSeriesUnitStatus ¶
type UpgradeSeriesUnitStatus struct { Status model.UpgradeSeriesStatus Timestamp time.Time }
type UpgradeStatus ¶
type UpgradeStatus string
UpgradeStatus describes the states an upgrade operation may be in.
const ( // UpgradePending indicates that an upgrade is queued but not yet started. UpgradePending UpgradeStatus = "pending" // UpgradeDBComplete indicates that the controller running the primary // MongoDB has completed running the database upgrade steps. UpgradeDBComplete UpgradeStatus = "db-complete" // UpgradeRunning indicates that the master controller has started // running non-DB upgrade logic, and other controllers are waiting for it. UpgradeRunning UpgradeStatus = "running" // UpgradeFinishing indicates that the master controller has finished // running all upgrade logic, and other controllers are catching up. UpgradeFinishing UpgradeStatus = "finishing" // UpgradeComplete indicates that all controllers have finished running // upgrade logic. UpgradeComplete UpgradeStatus = "complete" // UpgradeAborted indicates that the upgrade wasn't completed due // to some problem. UpgradeAborted UpgradeStatus = "aborted" )
type User ¶
type User struct {
// contains filtered or unexported fields
}
User represents a local user in the database.
func (*User) DateCreated ¶
DateCreated returns when this User was created in UTC.
func (*User) DisplayName ¶
DisplayName returns the display name of the User.
func (*User) IsDisabled ¶
IsDisabled returns whether the user is currently enabled.
func (*User) LastLogin ¶
LastLogin returns when this User last connected through the API in UTC. The resulting time will be nil if the user has never logged in. In the normal case, the LastLogin is the last time that the user connected through the API server.
func (*User) PasswordValid ¶
PasswordValid returns whether the given password is valid for the User. The caller should call user.Refresh before calling this.
func (*User) ResetPassword ¶
ResetPassword clears the user's password (if there is one), and generates a new secret key for the user. This must be an active user.
func (*User) SetPassword ¶
SetPassword sets the password associated with the User.
func (*User) SetPasswordHash ¶
SetPasswordHash stores the hash and the salt of the password. If the User has a secret key set then it will be cleared.
func (*User) UpdateLastLogin ¶
UpdateLastLogin sets the LastLogin time of the user to be now (to the nearest second).
type UserAccessInfo ¶
type UserAccessInfo struct { permission.UserAccess LastConnection *time.Time }
UserAccessInfo contains just the information about a single user's access to a model and when they last connected.
type UserAccessSpec ¶
type UserAccessSpec struct { User names.UserTag CreatedBy names.UserTag DisplayName string Access permission.Access }
UserAccessSpec defines the attributes that can be set when adding a new user access.
type ValidateConfigFunc ¶
type Volume ¶
type Volume interface { GlobalEntity Lifer status.StatusGetter status.StatusSetter // VolumeTag returns the tag for the volume. VolumeTag() names.VolumeTag // StorageInstance returns the tag of the storage instance that this // volume is assigned to, if any. If the volume is not assigned to // a storage instance, an error satisfying errors.IsNotAssigned will // be returned. // // A volume can be assigned to at most one storage instance, and a // storage instance can have at most one associated volume. StorageInstance() (names.StorageTag, error) // Info returns the volume's VolumeInfo, or a NotProvisioned // error if the volume has not yet been provisioned. Info() (VolumeInfo, error) // Params returns the parameters for provisioning the volume, // if it has not already been provisioned. Params returns true if the // returned parameters are usable for provisioning, otherwise false. Params() (VolumeParams, bool) // Detachable reports whether or not the volume is detachable. Detachable() bool // Releasing reports whether or not the volume is to be released // from the model when it is Dying/Dead. Releasing() bool }
Volume describes a volume (disk, logical volume, etc.) in the model.
type VolumeAttachment ¶
type VolumeAttachment interface { Lifer // Volume returns the tag of the related Volume. Volume() names.VolumeTag // Host returns the tag of the related Host. Host() names.Tag // Info returns the volume attachment's VolumeAttachmentInfo, or a // NotProvisioned error if the attachment has not yet been made. // // TODO(axw) use a different error, rather than NotProvisioned // (say, NotAttached or NotAssociated). Info() (VolumeAttachmentInfo, error) // Params returns the parameters for creating the volume attachment, // if it has not already been made. Params returns true if the returned // parameters are usable for creating an attachment, otherwise false. Params() (VolumeAttachmentParams, bool) }
VolumeAttachment describes an attachment of a volume to a machine.
type VolumeAttachmentInfo ¶
type VolumeAttachmentInfo struct { DeviceName string `bson:"devicename,omitempty"` DeviceLink string `bson:"devicelink,omitempty"` BusAddress string `bson:"busaddress,omitempty"` ReadOnly bool `bson:"read-only"` // PlanInfo holds information used by the machine storage // provisioner to execute any needed steps in order to make // make sure the actual storage device becomes available. // For example, any storage backend that requires userspace // setup, like iSCSI would fall into this category. PlanInfo *VolumeAttachmentPlanInfo `bson:"plan-info,omitempty"` }
VolumeAttachmentInfo describes information about a volume attachment.
type VolumeAttachmentParams ¶
type VolumeAttachmentParams struct {
ReadOnly bool `bson:"read-only"`
}
VolumeAttachmentParams records parameters for attaching a volume to a machine.
type VolumeAttachmentPlan ¶
type VolumeAttachmentPlan interface { Lifer // Volume returns the tag of the related Volume. Volume() names.VolumeTag // Machine returns the tag of the related Machine. Machine() names.MachineTag // PlanInfo returns the plan info for a volume PlanInfo() (VolumeAttachmentPlanInfo, error) // BlockDeviceInfo returns the block device info associated with // this plan, as seen by the machine agent it is plugged into BlockDeviceInfo() (BlockDeviceInfo, error) }
VolumeAttachmentPlan describes the plan information for a particular volume Machine agents use this information to do any extra initialization that is needed This is separate from VolumeAttachment to allow separation of concerns between the controller's idea of detaching a volume and the machine agent's idea. This way, we can have the controller ask the environment for a volume, attach it to the instance, which in some cases simply means granting the instance access to connect to it, and then explicitly let the machine agent know that something has been attached to it.
type VolumeAttachmentPlanInfo ¶
type VolumeAttachmentPlanInfo struct { // DeviceType is the type of storage type this plan info // describes. For directly attached local storage, this // can be left to its default value, or set as storage.DeviceTypeLocal // This value will be used by the machine storage provisioner // to load the appropriate storage plan, and execute any Attach/Detach // operations. DeviceType storage.DeviceType `bson:"device-type,omitempty"` // DeviceAttributes holds a map of key/value pairs that may be used // by the storage plan backend to initialize the storage device // For example, if dealing with iSCSI, this can hold the IP address // of the remote server, the LUN, access credentials, etc. DeviceAttributes map[string]string `bson:"device-attributes,omitempty"` }
type VolumeInfo ¶
type VolumeInfo struct { HardwareId string `bson:"hardwareid,omitempty"` WWN string `bson:"wwn,omitempty"` Size uint64 `bson:"size"` Pool string `bson:"pool"` VolumeId string `bson:"volumeid"` Persistent bool `bson:"persistent"` }
VolumeInfo describes information about a volume.
type VolumeParams ¶
type VolumeParams struct { Pool string `bson:"pool"` Size uint64 `bson:"size"` // contains filtered or unexported fields }
VolumeParams records parameters for provisioning a new volume.
type WatchParams ¶
type WatchParams struct { // IncludeOffers controls whether application offers should be watched. IncludeOffers bool }
WatchParams defines config to control which entites are included when watching a model.
type Watcher ¶
type Watcher interface { // Kill asks the watcher to stop without waiting for it do so. Kill() // Wait waits for the watcher to die and returns any // error encountered when it was running. Wait() error // Stop kills the watcher, then waits for it to die. Stop() error // Err returns any error encountered while the watcher // has been running. Err() error }
Watcher is implemented by all watchers; the actual changes channel is returned by a watcher-specific Changes method.
Source Files ¶
- action.go
- addmachine.go
- address.go
- allcollections.go
- allwatcher.go
- annotations.go
- application.go
- application_ops.go
- applicationoffers.go
- applicationofferuser.go
- autocertcache.go
- backend.go
- bakerystorage.go
- binarystorage.go
- block.go
- blockdevices.go
- caasmodel.go
- charm.go
- charmref.go
- cleanup.go
- cloud.go
- cloudcontainer.go
- cloudcredentials.go
- cloudservice.go
- clouduser.go
- collection.go
- constraints.go
- container.go
- containernetworking.go
- controller.go
- controlleruser.go
- dashboard.go
- database.go
- devices.go
- distribution.go
- docker_resource.go
- dump.go
- enableha.go
- endpoint.go
- endpoint_bindings.go
- errors.go
- externalcontroller.go
- filesystem.go
- firewallrules.go
- forcedoperation.go
- images.go
- initialize.go
- interface.go
- leadership.go
- leaseupgrades.go
- life.go
- life_ns.go
- linklayerdevices.go
- linklayerdevices_ipaddresses.go
- logs.go
- machine.go
- machine_linklayerdevices.go
- machine_ports.go
- machine_ports_ops.go
- machine_upgradeseries.go
- machineremovals.go
- meterstatus.go
- metrics.go
- metricsmanager.go
- migration_export.go
- migration_import.go
- migration_import_tasks.go
- minimumunits.go
- model.go
- modelconfig.go
- modelcredential.go
- modelgeneration.go
- modelmigration.go
- modeloperation.go
- modelsummaries.go
- modeluser.go
- mongo.go
- multienv.go
- offerconnections.go
- open.go
- operation.go
- payloads.go
- payloads_ns.go
- persistence.go
- podspec.go
- podspec_ops.go
- policy.go
- pool.go
- prune.go
- querytracker.go
- reboot.go
- refcounts_ns.go
- relation.go
- relationnetworks.go
- relationunit.go
- remoteapplication.go
- remoteentities.go
- resources.go
- resources_adapters.go
- resources_mongo.go
- resources_persistence.go
- resources_persistence_staged.go
- resources_state_resource.go
- sequence.go
- settings.go
- spaces.go
- sshhostkeys.go
- state.go
- status.go
- storage.go
- storage_ops.go
- subnets.go
- txns.go
- undertaker.go
- unit.go
- unit_assignment.go
- unit_ops.go
- unit_ports.go
- unitagent.go
- unitstate.go
- upgrade.go
- upgrades.go
- user.go
- useraccess.go
- userpermission.go
- volume.go
- watcher.go
- workers.go
Directories ¶
Path | Synopsis |
---|---|
Package backups contains all the stand-alone backup-related functionality for juju state.
|
Package backups contains all the stand-alone backup-related functionality for juju state. |
Package bakerystorage provides an implementation of the bakery Storage interface that uses MongoDB to store items.
|
Package bakerystorage provides an implementation of the bakery Storage interface that uses MongoDB to store items. |
Package globalclock provides clients for updating and reading the global virtual time, stored in the MongoDB database.
|
Package globalclock provides clients for updating and reading the global virtual time, stored in the MongoDB database. |
Package migrations aims to create an intermediate state between state and the description package.
|
Package migrations aims to create an intermediate state between state and the description package. |
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
Package stateenvirons provides types and functions that interface the state and environs packages.
|
Package stateenvirons provides types and functions that interface the state and environs packages. |
The watcher package provides an interface for observing changes to arbitrary MongoDB documents that are maintained via the mgo/txn transaction package.
|
The watcher package provides an interface for observing changes to arbitrary MongoDB documents that are maintained via the mgo/txn transaction package. |