Documentation
¶
Index ¶
- type KeyValue
- type State
- func (st *State) AddStorageForUnit(ctx context.Context, storageName corestorage.Name, unitUUID coreunit.UUID, ...) ([]corestorage.ID, error)
- func (st *State) AddUnits(ctx context.Context, appUUID coreapplication.ID, args []application.AddUnitArg) error
- func (st *State) AttachStorage(ctx context.Context, storageUUID corestorage.UUID, unitUUID coreunit.UUID) error
- func (st *State) CreateApplication(ctx context.Context, name string, args application.AddApplicationArg, ...) (coreapplication.ID, error)
- func (st *State) DeleteApplication(ctx context.Context, name string) error
- func (s *State) DeleteCharm(ctx context.Context, id corecharm.ID) error
- func (st *State) DeleteUnit(ctx context.Context, unitName coreunit.Name) (bool, error)
- func (st *State) DetachStorage(ctx context.Context, storageUUID corestorage.UUID) error
- func (st *State) DetachStorageForUnit(ctx context.Context, storageUUID corestorage.UUID, unitUUID coreunit.UUID) error
- func (st *State) GetApplicationConfigAndSettings(ctx context.Context, appID coreapplication.ID) (map[string]application.ApplicationConfig, application.ApplicationSettings, ...)
- func (st *State) GetApplicationConfigHash(ctx context.Context, appID coreapplication.ID) (string, error)
- func (st *State) GetApplicationConstraints(ctx context.Context, appID coreapplication.ID) (constraints.Constraints, error)
- func (st *State) GetApplicationIDAndNameByUnitName(ctx context.Context, name coreunit.Name) (coreapplication.ID, string, error)
- func (st *State) GetApplicationIDByName(ctx context.Context, name string) (coreapplication.ID, error)
- func (st *State) GetApplicationIDByUnitName(ctx context.Context, name coreunit.Name) (coreapplication.ID, error)
- func (st *State) GetApplicationLife(ctx context.Context, appName string) (coreapplication.ID, life.Life, error)
- func (st *State) GetApplicationScaleState(ctx context.Context, appUUID coreapplication.ID) (application.ScaleState, error)
- func (st *State) GetApplicationStatus(ctx context.Context, appID coreapplication.ID) (*application.StatusInfo[application.WorkloadStatusType], error)
- func (st *State) GetApplicationTrustSetting(ctx context.Context, appID coreapplication.ID) (bool, error)
- func (st *State) GetApplicationUnitLife(ctx context.Context, appName string, ids ...coreunit.UUID) (map[coreunit.UUID]life.Life, error)
- func (st *State) GetApplicationsForRevisionUpdater(ctx context.Context) ([]application.RevisionUpdaterApplication, error)
- func (st *State) GetApplicationsWithPendingCharmsFromUUIDs(ctx context.Context, uuids []coreapplication.ID) ([]coreapplication.ID, error)
- func (st *State) GetAsyncCharmDownloadInfo(ctx context.Context, appID coreapplication.ID) (application.CharmDownloadInfo, error)
- func (s *State) GetAvailableCharmArchiveSHA256(ctx context.Context, id corecharm.ID) (string, error)
- func (s *State) GetCharm(ctx context.Context, id corecharm.ID) (charm.Charm, *charm.DownloadInfo, error)
- func (s *State) GetCharmActions(ctx context.Context, id corecharm.ID) (charm.Actions, error)
- func (s *State) GetCharmArchiveMetadata(ctx context.Context, id corecharm.ID) (archivePath string, hash string, err error)
- func (s *State) GetCharmArchivePath(ctx context.Context, id corecharm.ID) (string, error)
- func (st *State) GetCharmByApplicationID(ctx context.Context, appUUID coreapplication.ID) (charm.Charm, error)
- func (s *State) GetCharmConfig(ctx context.Context, id corecharm.ID) (charm.Config, error)
- func (st *State) GetCharmConfigByApplicationID(ctx context.Context, appID coreapplication.ID) (corecharm.ID, charm.Config, error)
- func (s *State) GetCharmDownloadInfo(ctx context.Context, id corecharm.ID) (*charm.DownloadInfo, error)
- func (s *State) GetCharmID(ctx context.Context, name string, revision int, source charm.CharmSource) (corecharm.ID, error)
- func (st *State) GetCharmIDByApplicationName(ctx context.Context, name string) (corecharm.ID, error)
- func (s *State) GetCharmLXDProfile(ctx context.Context, id corecharm.ID) ([]byte, charm.Revision, error)
- func (s *State) GetCharmLocatorByCharmID(ctx context.Context, id corecharm.ID) (charm.CharmLocator, error)
- func (s *State) GetCharmManifest(ctx context.Context, id corecharm.ID) (charm.Manifest, error)
- func (s *State) GetCharmMetadata(ctx context.Context, id corecharm.ID) (charm.Metadata, error)
- func (s *State) GetCharmMetadataDescription(ctx context.Context, id corecharm.ID) (string, error)
- func (s *State) GetCharmMetadataName(ctx context.Context, id corecharm.ID) (string, error)
- func (s *State) GetCharmMetadataResources(ctx context.Context, id corecharm.ID) (map[string]charm.Resource, error)
- func (s *State) GetCharmMetadataStorage(ctx context.Context, id corecharm.ID) (map[string]charm.Storage, error)
- func (st *State) GetCharmModifiedVersion(ctx context.Context, id coreapplication.ID) (int, error)
- func (s *State) GetLatestPendingCharmhubCharm(ctx context.Context, name string, arch architecture.Architecture) (charm.CharmLocator, error)
- func (st *State) GetModelType(ctx context.Context) (coremodel.ModelType, error)
- func (st *State) GetStoragePoolByName(ctx context.Context, name string) (domainstorage.StoragePoolDetails, error)
- func (st *State) GetStorageUUIDByID(ctx context.Context, storageID corestorage.ID) (corestorage.UUID, error)
- func (st *State) GetUnitCloudContainerStatus(ctx context.Context, uuid coreunit.UUID) (*application.StatusInfo[application.CloudContainerStatusType], error)
- func (st *State) GetUnitCloudContainerStatusesForApplication(ctx context.Context, appID coreapplication.ID) (map[coreunit.Name]application.StatusInfo[application.CloudContainerStatusType], ...)
- func (st *State) GetUnitLife(ctx context.Context, unitName coreunit.Name) (life.Life, error)
- func (st *State) GetUnitUUID(ctx domain.AtomicContext, unitName coreunit.Name) (coreunit.UUID, error)
- func (st *State) GetUnitUUIDByName(ctx context.Context, name coreunit.Name) (coreunit.UUID, error)
- func (st *State) GetUnitWorkloadStatus(ctx context.Context, uuid coreunit.UUID) (*application.StatusInfo[application.WorkloadStatusType], error)
- func (st *State) GetUnitWorkloadStatusesForApplication(ctx context.Context, appID coreapplication.ID) (map[coreunit.Name]application.StatusInfo[application.WorkloadStatusType], ...)
- func (st *State) InitialWatchStatementApplicationConfigHash(appName string) (string, eventsource.NamespaceQuery)
- func (st *State) InitialWatchStatementApplicationsWithPendingCharms() (string, eventsource.NamespaceQuery)
- func (st *State) InitialWatchStatementUnitLife(appName string) (string, eventsource.NamespaceQuery)
- func (st *State) InsertCAASUnit(ctx context.Context, appUUID coreapplication.ID, ...) error
- func (st *State) InsertUnit(ctx context.Context, appUUID coreapplication.ID, ...) error
- func (s *State) IsCharmAvailable(ctx context.Context, id corecharm.ID) (bool, error)
- func (s *State) IsControllerCharm(ctx context.Context, id corecharm.ID) (bool, error)
- func (s *State) IsSubordinateCharm(ctx context.Context, id corecharm.ID) (bool, error)
- func (s *State) ListCharmLocators(ctx context.Context) ([]charm.CharmLocator, error)
- func (s *State) ListCharmLocatorsByNames(ctx context.Context, names []string) ([]charm.CharmLocator, error)
- func (st *State) ResolveCharmDownload(ctx context.Context, id corecharm.ID, info application.ResolvedCharmDownload) error
- func (s *State) ResolveMigratingUploadedCharm(ctx context.Context, id corecharm.ID, ...) (charm.CharmLocator, error)
- func (st *State) SetApplicationConfigAndSettings(ctx context.Context, appID coreapplication.ID, cID corecharm.ID, ...) error
- func (st *State) SetApplicationConstraints(ctx context.Context, appID coreapplication.ID, cons constraints.Constraints) error
- func (st *State) SetApplicationLife(ctx context.Context, appUUID coreapplication.ID, l life.Life) error
- func (st *State) SetApplicationScalingState(ctx context.Context, appUUID coreapplication.ID, scale *int, targetScale int, ...) error
- func (st *State) SetApplicationStatus(ctx context.Context, applicationID coreapplication.ID, ...) error
- func (s *State) SetCharm(ctx context.Context, ch charm.Charm, downloadInfo *charm.DownloadInfo, ...) (corecharm.ID, charm.CharmLocator, error)
- func (s *State) SetCharmAvailable(ctx context.Context, id corecharm.ID) error
- func (st *State) SetDesiredApplicationScale(ctx context.Context, appUUID coreapplication.ID, scale int) error
- func (st *State) SetUnitLife(ctx context.Context, unitName coreunit.Name, l life.Life) error
- func (st *State) SetUnitPassword(ctx context.Context, unitUUID coreunit.UUID, password application.PasswordInfo) error
- func (st *State) SetUnitWorkloadStatus(ctx context.Context, unitUUID coreunit.UUID, ...) error
- func (st *State) StorageDefaults(ctx context.Context) (domainstorage.StorageDefaults, error)
- func (s *State) SupportsContainers(ctx context.Context, id corecharm.ID) (bool, error)
- func (st *State) UnsetApplicationConfigKeys(ctx context.Context, appID coreapplication.ID, keys []string) error
- func (st *State) UpdateCAASUnit(ctx context.Context, unitName coreunit.Name, ...) error
- func (st *State) UpsertCloudService(ctx context.Context, applicationName, providerID string, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type State ¶
func (*State) AddStorageForUnit ¶
func (*State) AddUnits ¶
func (st *State) AddUnits(ctx context.Context, appUUID coreapplication.ID, args []application.AddUnitArg) error
AddUnits adds the specified units to the application.
func (*State) AttachStorage ¶
func (*State) CreateApplication ¶
func (st *State) CreateApplication( ctx context.Context, name string, args application.AddApplicationArg, units []application.AddUnitArg, ) (coreapplication.ID, error)
CreateApplication creates an application, returning an error satisfying applicationerrors.ApplicationAlreadyExists if the application already exists. It returns as error satisfying applicationerrors.CharmNotFound if the charm for the application is not found.
func (*State) DeleteApplication ¶
DeleteApplication deletes the specified application, returning an error satisfying applicationerrors.ApplicationNotFoundError if the application doesn't exist. If the application still has units, as error satisfying applicationerrors.ApplicationHasUnits is returned.
func (*State) DeleteCharm ¶
DeleteCharm removes the charm from the state. If the charm does not exist, a errors.CharmNotFound error is returned.
func (*State) DeleteUnit ¶
DeleteUnit deletes the specified unit. If the unit's application is Dying and no other references to it exist, true is returned to indicate the application could be safely deleted. It will fail if the unit is not Dead.
func (*State) DetachStorage ¶
func (*State) DetachStorageForUnit ¶
func (*State) GetApplicationConfigAndSettings ¶
func (st *State) GetApplicationConfigAndSettings(ctx context.Context, appID coreapplication.ID) (map[string]application.ApplicationConfig, application.ApplicationSettings, error)
GetApplicationConfigAndSettings returns the application config and settings attributes for the application ID.
If no application is found, an error satisfying applicationerrors.ApplicationNotFound is returned.
func (*State) GetApplicationConfigHash ¶
func (st *State) GetApplicationConfigHash(ctx context.Context, appID coreapplication.ID) (string, error)
GetApplicationConfigHash returns the SHA256 hash of the application config for the specified application ID. If no application is found, an error satisfying applicationerrors.ApplicationNotFound is returned.
func (*State) GetApplicationConstraints ¶
func (st *State) GetApplicationConstraints(ctx context.Context, appID coreapplication.ID) (constraints.Constraints, error)
GetApplicationConstraints returns the application constraints for the specified application ID. Empty constraints are returned if no constraints exist for the given application ID. If no application is found, an error satisfying applicationerrors.ApplicationNotFound is returned.
func (*State) GetApplicationIDAndNameByUnitName ¶
func (st *State) GetApplicationIDAndNameByUnitName( ctx context.Context, name coreunit.Name, ) (coreapplication.ID, string, error)
GetApplicationIDAndNameByUnitName returns the application ID and name for the named unit.
Returns an error satisfying applicationerrors.UnitNotFound if the unit doesn't exist.
func (*State) GetApplicationIDByName ¶
func (st *State) GetApplicationIDByName(ctx context.Context, name string) (coreapplication.ID, error)
GetApplicationIDByName returns the application ID for the named application. If no application is found, an error satisfying applicationerrors.ApplicationNotFound is returned.
func (*State) GetApplicationIDByUnitName ¶
func (st *State) GetApplicationIDByUnitName( ctx context.Context, name coreunit.Name, ) (coreapplication.ID, error)
GetApplicationIDByUnitName returns the application ID for the named unit.
Returns an error satisfying applicationerrors.UnitNotFound if the unit doesn't exist.
func (*State) GetApplicationLife ¶
func (st *State) GetApplicationLife(ctx context.Context, appName string) (coreapplication.ID, life.Life, error)
GetApplicationLife looks up the life of the specified application, returning an error satisfying applicationerrors.ApplicationNotFoundError if the application is not found.
func (*State) GetApplicationScaleState ¶
func (st *State) GetApplicationScaleState(ctx context.Context, appUUID coreapplication.ID) (application.ScaleState, error)
GetApplicationScaleState looks up the scale state of the specified application, returning an error satisfying applicationerrors.ApplicationNotFound if the application is not found.
func (*State) GetApplicationStatus ¶
func (st *State) GetApplicationStatus(ctx context.Context, appID coreapplication.ID) (*application.StatusInfo[application.WorkloadStatusType], error)
GetApplicationStatus looks up the status of the specified application, returning an error satisfying applicationerrors.ApplicationNotFound if the application is not found.
func (*State) GetApplicationTrustSetting ¶
func (st *State) GetApplicationTrustSetting(ctx context.Context, appID coreapplication.ID) (bool, error)
GetApplicationTrustSetting returns the application trust setting. If no application is found, an error satisfying applicationerrors.ApplicationNotFound is returned.
func (*State) GetApplicationUnitLife ¶
func (st *State) GetApplicationUnitLife(ctx context.Context, appName string, ids ...coreunit.UUID) (map[coreunit.UUID]life.Life, error)
GetApplicationUnitLife returns the life values for the specified units of the given application. The supplied ids may belong to a different application; the application name is used to filter.
func (*State) GetApplicationsForRevisionUpdater ¶
func (st *State) GetApplicationsForRevisionUpdater(ctx context.Context) ([]application.RevisionUpdaterApplication, error)
GetApplicationsForRevisionUpdater returns all the applications for the revision updater. This will only return charmhub charms, for applications that are alive. This will return an empty slice if there are no applications.
func (*State) GetApplicationsWithPendingCharmsFromUUIDs ¶
func (st *State) GetApplicationsWithPendingCharmsFromUUIDs(ctx context.Context, uuids []coreapplication.ID) ([]coreapplication.ID, error)
GetApplicationsWithPendingCharmsFromUUIDs returns the application IDs for the applications with pending charms from the specified UUIDs.
func (*State) GetAsyncCharmDownloadInfo ¶
func (st *State) GetAsyncCharmDownloadInfo(ctx context.Context, appID coreapplication.ID) (application.CharmDownloadInfo, error)
GetAsyncCharmDownloadInfo gets the charm download for the specified application, returning an error satisfying applicationerrors.CharmAlreadyAvailable if the application is already downloading a charm, or applicationerrors.ApplicationNotFound if the application is not found.
func (*State) GetAvailableCharmArchiveSHA256 ¶
func (s *State) GetAvailableCharmArchiveSHA256(ctx context.Context, id corecharm.ID) (string, error)
GetAvailableCharmArchiveSHA256 returns the SHA256 hash of the charm archive for the given charm id. If the charm is not available, applicationerrors.CharmNotResolved is returned. Returns applicationerrors.CharmNotFound if the charm is not found.
func (*State) GetCharm ¶
func (s *State) GetCharm(ctx context.Context, id corecharm.ID) (charm.Charm, *charm.DownloadInfo, error)
GetCharm returns the charm using the charm ID. DownloadInfo is optional, and is only returned for charms from a charm store. If the charm does not exist, a errors.CharmNotFound error is returned.
func (*State) GetCharmActions ¶
GetCharmActions returns the actions for the charm using the charm ID. If the charm does not exist, a errors.CharmNotFound error is returned.
func (*State) GetCharmArchiveMetadata ¶
func (s *State) GetCharmArchiveMetadata(ctx context.Context, id corecharm.ID) (archivePath string, hash string, err error)
GetCharmArchiveMetadata returns the archive storage path and the sha256 hash for the charm using the charm ID. If the charm does not exist, a errors.CharmNotFound error is returned.
func (*State) GetCharmArchivePath ¶
GetCharmArchivePath returns the archive storage path for the charm using the charm ID. If the charm does not exist, a errors.CharmNotFound error is returned.
func (*State) GetCharmByApplicationID ¶
func (st *State) GetCharmByApplicationID(ctx context.Context, appUUID coreapplication.ID) (charm.Charm, error)
GetCharmByApplicationID returns the charm for the specified application ID. This method should be used sparingly, as it is not efficient. It should be only used when you need the whole charm, otherwise use the more specific methods.
If the application does not exist, an error satisfying applicationerrors.ApplicationNotFoundError is returned. If the charm for the application does not exist, an error satisfying applicationerrors.CharmNotFoundError is returned.
func (*State) GetCharmConfig ¶
GetCharmConfig returns the config for the charm using the charm ID. If the charm does not exist, a errors.CharmNotFound error is returned.
func (*State) GetCharmConfigByApplicationID ¶
func (st *State) GetCharmConfigByApplicationID(ctx context.Context, appID coreapplication.ID) (corecharm.ID, charm.Config, error)
GetCharmConfigByApplicationID returns the charm config for the specified application ID. If no application is found, an error satisfying applicationerrors.ApplicationNotFound is returned. If the charm for the application does not exist, an error satisfying applicationerrors.CharmNotFoundError is returned.
func (*State) GetCharmDownloadInfo ¶
func (s *State) GetCharmDownloadInfo(ctx context.Context, id corecharm.ID) (*charm.DownloadInfo, error)
GetCharmDownloadInfo returns the download info for the charm using the charm ID. Returns applicationerrors.CharmNotFound if the charm is not found.
func (*State) GetCharmID ¶
func (s *State) GetCharmID(ctx context.Context, name string, revision int, source charm.CharmSource) (corecharm.ID, error)
GetCharmID returns the charm ID by the natural key, for a specific revision and source. If the charm does not exist, a errors.CharmNotFound error is returned.
func (*State) GetCharmIDByApplicationName ¶
func (st *State) GetCharmIDByApplicationName(ctx context.Context, name string) (corecharm.ID, error)
GetCharmIDByApplicationName returns a charm ID by application name. It returns an error if the charm can not be found by the name. This can also be used as a cheap way to see if a charm exists without needing to load the charm metadata.
Returns applicationerrors.ApplicationNameNotValid if the name is not valid, applicationerrors.ApplicationNotFound if the application is not found, and applicationerrors.CharmNotFound if the charm is not found.
func (*State) GetCharmLXDProfile ¶
func (s *State) GetCharmLXDProfile(ctx context.Context, id corecharm.ID) ([]byte, charm.Revision, error)
GetCharmLXDProfile returns the LXD profile for the charm using the charm ID. If the charm does not exist, a errors.CharmNotFound error is returned.
func (*State) GetCharmLocatorByCharmID ¶
func (s *State) GetCharmLocatorByCharmID(ctx context.Context, id corecharm.ID) (charm.CharmLocator, error)
GetCharmLocatorByCharmID returns a charm locator for the given charm ID. The locator allows the reconstruction of the charm URL for the client response. If the charm does not exist, a errors.CharmNotFound error is returned.
func (*State) GetCharmManifest ¶
GetCharmManifest returns the manifest for the charm using the charm ID. If the charm does not exist, a errors.CharmNotFound error is returned.
func (*State) GetCharmMetadata ¶
GetCharmMetadata returns the metadata for the charm using the charm ID. If the charm does not exist, a errors.CharmNotFound error is returned.
func (*State) GetCharmMetadataDescription ¶
GetCharmMetadataDescription returns the description for the metadata for the charm using the charm ID. If the charm does not exist, a errors.CharmNotFound error is returned.
func (*State) GetCharmMetadataName ¶
GetCharmMetadataName returns the name from the metadata for the charm using the charm ID. If the charm does not exist, a errors.CharmNotFound error is returned.
func (*State) GetCharmMetadataResources ¶
func (s *State) GetCharmMetadataResources(ctx context.Context, id corecharm.ID) (map[string]charm.Resource, error)
GetCharmMetadataResources returns the resources metadata for the charm using the charm ID. If the charm does not exist, a errors.CharmNotFound error is returned.
func (*State) GetCharmMetadataStorage ¶
func (s *State) GetCharmMetadataStorage(ctx context.Context, id corecharm.ID) (map[string]charm.Storage, error)
GetCharmMetadataStorage returns the storage metadata for the charm using the charm ID. If the charm does not exist, a errors.CharmNotFound error is returned.
func (*State) GetCharmModifiedVersion ¶
GetCharmModifiedVersion looks up the charm modified version of the given application.
Returns applicationerrors.ApplicationNotFound if the application is not found.
func (*State) GetLatestPendingCharmhubCharm ¶
func (s *State) GetLatestPendingCharmhubCharm(ctx context.Context, name string, arch architecture.Architecture) (charm.CharmLocator, error)
GetLatestPendingCharmhubCharm returns the latest charm that is pending from the charmhub store. If there are no charms, returns is not found, as applicationerrors.CharmNotFound. If there are multiple charms, then the latest created at date is returned first.
func (*State) GetModelType ¶
GetModelType returns the model type for the underlying model. If the model does not exist then an error satisfying modelerrors.NotFound will be returned.
func (*State) GetStoragePoolByName ¶
func (st *State) GetStoragePoolByName(ctx context.Context, name string) (domainstorage.StoragePoolDetails, error)
GetStoragePoolByName returns the storage pool with the specified name, returning an error satisfying storageerrors.PoolNotFoundError if it doesn't exist.
func (*State) GetStorageUUIDByID ¶
func (st *State) GetStorageUUIDByID(ctx context.Context, storageID corestorage.ID) (corestorage.UUID, error)
GetStorageUUIDByID returns the UUID for the specified storage, returning an error satisfying storageerrors.StorageNotFound if the storage doesn't exist.
func (*State) GetUnitCloudContainerStatus ¶
func (st *State) GetUnitCloudContainerStatus(ctx context.Context, uuid coreunit.UUID) (*application.StatusInfo[application.CloudContainerStatusType], error)
GetUnitCloudContainerStatus returns the cloud container status of the specified unit. It returns; - an error satisfying applicationerrors.UnitNotFound if the unit doesn't exist or; - an error satisfying applicationerrors.UnitIsDead if the unit is dead or; - an error satisfying applicationerrors.UnitStatusNotFound if the status is not set.
func (*State) GetUnitCloudContainerStatusesForApplication ¶
func (st *State) GetUnitCloudContainerStatusesForApplication(ctx context.Context, appID coreapplication.ID) (map[coreunit.Name]application.StatusInfo[application.CloudContainerStatusType], error)
GetUnitCloudContainerStatusesForApplication returns the cloud container statuses for all units of the specified application, returning:
- an error satisfying applicationerrors.ApplicationNotFound if the application doesn't exist or;
- an error satisfying applicationerrors.ApplicationIsDead if the application is dead.
func (*State) GetUnitLife ¶
GetUnitLife looks up the life of the specified unit, returning an error satisfying applicationerrors.UnitNotFound if the unit is not found.
func (*State) GetUnitUUID ¶
func (st *State) GetUnitUUID(ctx domain.AtomicContext, unitName coreunit.Name) (coreunit.UUID, error)
GetUnitUUID returns the UUID for the named unit, returning an error satisfying applicationerrors.UnitNotFound if the unit doesn't exist.
func (*State) GetUnitUUIDByName ¶
GetUnitUUIDByName returns the UUID for the named unit, returning an error satisfying applicationerrors.UnitNotFound if the unit doesn't exist.
func (*State) GetUnitWorkloadStatus ¶
func (st *State) GetUnitWorkloadStatus(ctx context.Context, uuid coreunit.UUID) (*application.StatusInfo[application.WorkloadStatusType], error)
GetUnitWorkloadStatus returns the workload status of the specified unit, returning: - an error satisfying applicationerrors.UnitNotFound if the unit doesn't exist or; - an error satisfying applicationerrors.UnitIsDead if the unit is dead or; - an error satisfying applicationerrors.UnitStatusNotFound if the status is not set.
func (*State) GetUnitWorkloadStatusesForApplication ¶
func (st *State) GetUnitWorkloadStatusesForApplication(ctx context.Context, appID coreapplication.ID) (map[coreunit.Name]application.StatusInfo[application.WorkloadStatusType], error)
GetUnitWorkloadStatusesForApplication returns the workload statuses for all units of the specified application, returning:
- an error satisfying applicationerrors.ApplicationNotFound if the application doesn't exist or;
- error satisfying applicationerrors.ApplicationIsDead if the application is dead.
func (*State) InitialWatchStatementApplicationConfigHash ¶
func (st *State) InitialWatchStatementApplicationConfigHash(appName string) (string, eventsource.NamespaceQuery)
InitialWatchStatementApplicationConfigHash returns the initial namespace query for the application config hash watcher.
func (*State) InitialWatchStatementApplicationsWithPendingCharms ¶
func (st *State) InitialWatchStatementApplicationsWithPendingCharms() (string, eventsource.NamespaceQuery)
InitialWatchStatementApplicationsWithPendingCharms returns the initial namespace query for the applications with pending charms watcher.
func (*State) InitialWatchStatementUnitLife ¶
func (st *State) InitialWatchStatementUnitLife(appName string) (string, eventsource.NamespaceQuery)
InitialWatchStatementUnitLife returns the initial namespace query for the application unit life watcher.
func (*State) InsertCAASUnit ¶
func (st *State) InsertCAASUnit(ctx context.Context, appUUID coreapplication.ID, arg application.RegisterCAASUnitArg) error
InsertCAASUnit inserts the specified CAAS application unit, returning an error satisfying applicationerrors.UnitAlreadyExists if the unit exists, or applicationerrors.UnitNotAssigned if the unit was not assigned.
func (*State) InsertUnit ¶
func (st *State) InsertUnit( ctx context.Context, appUUID coreapplication.ID, args application.InsertUnitArg, ) error
InsertUnit insert the specified application unit, returning an error satisfying applicationerrors.UnitAlreadyExists if the unit exists.
func (*State) IsCharmAvailable ¶
IsCharmAvailable returns whether the charm is available for use. If the charm does not exist, a errors.CharmNotFound error is returned.
func (*State) IsControllerCharm ¶
IsControllerCharm returns whether the charm is a controller charm. If the charm does not exist, a errors.CharmNotFound error is returned.
func (*State) IsSubordinateCharm ¶
IsSubordinateCharm returns whether the charm is a subordinate charm. If the charm does not exist, a errors.CharmNotFound error is returned.
func (*State) ListCharmLocators ¶
ListCharmLocatorsByNames returns a list of charm locators. The locator allows the reconstruction of the charm URL for the client response.
func (*State) ListCharmLocatorsByNames ¶
func (s *State) ListCharmLocatorsByNames(ctx context.Context, names []string) ([]charm.CharmLocator, error)
ListCharmLocatorsByNames returns a list of charm locators for the specified charm names. The locator allows the reconstruction of the charm URL for the client response. If no names are provided, then nothing is returned.
func (*State) ResolveCharmDownload ¶
func (st *State) ResolveCharmDownload(ctx context.Context, id corecharm.ID, info application.ResolvedCharmDownload) error
ResolveCharmDownload resolves the charm download for the specified application, updating the charm with the specified charm information. This will only set mutable charm fields. Currently this will also set actions.yaml, although that will be removed once the charmhub store provides this information. Returns an error satisfying applicationerrors.CharmNotFound if the charm is not found, and applicationerrors.CharmAlreadyResolved if the charm is already resolved.
func (*State) ResolveMigratingUploadedCharm ¶
func (s *State) ResolveMigratingUploadedCharm(ctx context.Context, id corecharm.ID, info charm.ResolvedMigratingUploadedCharm) (charm.CharmLocator, error)
ResolveMigratingUploadedCharm resolves the charm that is migrating from the uploaded state to the available state. If the charm is not found, a applicationerrors.CharmNotFound error is returned.
func (*State) SetApplicationConfigAndSettings ¶
func (st *State) SetApplicationConfigAndSettings( ctx context.Context, appID coreapplication.ID, cID corecharm.ID, config map[string]application.ApplicationConfig, settings application.ApplicationSettings, ) error
SetApplicationConfig sets the application config attributes using the configuration.
func (*State) SetApplicationConstraints ¶
func (st *State) SetApplicationConstraints(ctx context.Context, appID coreapplication.ID, cons constraints.Constraints) error
SetApplicationConstraints sets the application constraints for the specified application ID. This method overwrites the full constraints on every call. If invalid constraints are provided (e.g. invalid container type or non-existing space), a applicationerrors.InvalidApplicationConstraints error is returned. If no application is found, an error satisfying applicationerrors.ApplicationNotFound is returned.
func (*State) SetApplicationLife ¶
func (st *State) SetApplicationLife(ctx context.Context, appUUID coreapplication.ID, l life.Life) error
SetApplicationLife sets the life of the specified application.
func (*State) SetApplicationScalingState ¶
func (st *State) SetApplicationScalingState(ctx context.Context, appUUID coreapplication.ID, scale *int, targetScale int, scaling bool) error
SetApplicationScalingState sets the scaling details for the given caas application Scale is optional and is only set if not nil.
func (*State) SetApplicationStatus ¶
func (st *State) SetApplicationStatus( ctx context.Context, applicationID coreapplication.ID, status *application.StatusInfo[application.WorkloadStatusType], ) error
SetApplicationStatus saves the given application status, overwriting any current status data. If returns an error satisfying applicationerrors.ApplicationNotFound if the application doesn't exist.
func (*State) SetCharm ¶
func (s *State) SetCharm(ctx context.Context, ch charm.Charm, downloadInfo *charm.DownloadInfo, requiresSequencing bool) (corecharm.ID, charm.CharmLocator, error)
SetCharm persists the charm metadata, actions, config and manifest to state.
func (*State) SetCharmAvailable ¶
SetCharmAvailable sets the charm as available for use. If the charm does not exist, a errors.CharmNotFound error is returned.
func (*State) SetDesiredApplicationScale ¶
func (st *State) SetDesiredApplicationScale(ctx context.Context, appUUID coreapplication.ID, scale int) error
SetDesiredApplicationScale updates the desired scale of the specified application.
func (*State) SetUnitLife ¶
SetUnitLife sets the life of the specified unit, returning an error satisfying applicationerrors.UnitNotFound if the unit is not found.
func (*State) SetUnitPassword ¶
func (st *State) SetUnitPassword(ctx context.Context, unitUUID coreunit.UUID, password application.PasswordInfo) error
SetUnitPassword updates the password for the specified unit UUID.
func (*State) SetUnitWorkloadStatus ¶
func (st *State) SetUnitWorkloadStatus(ctx context.Context, unitUUID coreunit.UUID, status *application.StatusInfo[application.WorkloadStatusType]) error
SetUnitWorkloadStatus updates the workload status of the specified unit, returning an error satisfying applicationerrors.UnitNotFound if the unit doesn't exist.
func (*State) StorageDefaults ¶
func (st *State) StorageDefaults(ctx context.Context) (domainstorage.StorageDefaults, error)
StorageDefaults returns the default storage sources for a model.
func (*State) SupportsContainers ¶
SupportsContainers returns whether the charm supports containers. If the charm does not exist, a errors.CharmNotFound error is returned.
func (*State) UnsetApplicationConfigKeys ¶
func (st *State) UnsetApplicationConfigKeys(ctx context.Context, appID coreapplication.ID, keys []string) error
UnsetApplicationConfigKeys removes the specified keys from the application config. If the key does not exist, it is ignored. If no application is found, an error satisfying applicationerrors.ApplicationNotFound is returned.
func (*State) UpdateCAASUnit ¶
func (st *State) UpdateCAASUnit(ctx context.Context, unitName coreunit.Name, params application.UpdateCAASUnitParams) error
UpdateCAASUnit updates the cloud container for specified unit, returning an error satisfying applicationerrors.UnitNotFoundError if the unit doesn't exist.
func (*State) UpsertCloudService ¶
func (st *State) UpsertCloudService(ctx context.Context, applicationName, providerID string, sAddrs network.SpaceAddresses) error
UpsertCloudService updates the cloud service for the specified application, returning an error satisfying applicationerrors.ApplicationNotFoundError if the application doesn't exist.