Source code for juju.client._client3

# DO NOT CHANGE THIS FILE! This file is auto-generated by facade.py.
# Changes will be overwritten/lost when the file is regenerated.

from juju.client.facade import Type, ReturnMapping
from juju.client._definitions import *


[docs]class AdminFacade(Type): name = 'Admin' version = 3 schema = {'definitions': {'Address': {'additionalProperties': False, 'properties': {'cidr': {'type': 'string'}, 'config-type': {'type': 'string'}, 'is-secondary': {'type': 'boolean'}, 'scope': {'type': 'string'}, 'space-id': {'type': 'string'}, 'space-name': {'type': 'string'}, 'type': {'type': 'string'}, 'value': {'type': 'string'}}, 'required': ['value', 'type', 'scope'], 'type': 'object'}, 'AuthUserInfo': {'additionalProperties': False, 'properties': {'controller-access': {'type': 'string'}, 'credentials': {'type': 'string'}, 'display-name': {'type': 'string'}, 'identity': {'type': 'string'}, 'last-connection': {'format': 'date-time', 'type': 'string'}, 'model-access': {'type': 'string'}}, 'required': ['display-name', 'identity', 'controller-access', 'model-access'], 'type': 'object'}, 'FacadeVersions': {'additionalProperties': False, 'properties': {'name': {'type': 'string'}, 'versions': {'items': {'type': 'integer'}, 'type': 'array'}}, 'required': ['name', 'versions'], 'type': 'object'}, 'HostPort': {'additionalProperties': False, 'properties': {'Address': {'$ref': '#/definitions/Address'}, 'cidr': {'type': 'string'}, 'config-type': {'type': 'string'}, 'is-secondary': {'type': 'boolean'}, 'port': {'type': 'integer'}, 'scope': {'type': 'string'}, 'space-id': {'type': 'string'}, 'space-name': {'type': 'string'}, 'type': {'type': 'string'}, 'value': {'type': 'string'}}, 'required': ['value', 'type', 'scope', 'Address', 'port'], 'type': 'object'}, 'LoginRequest': {'additionalProperties': False, 'properties': {'auth-tag': {'type': 'string'}, 'bakery-version': {'type': 'integer'}, 'cli-args': {'type': 'string'}, 'client-version': {'type': 'string'}, 'credentials': {'type': 'string'}, 'macaroons': {'items': {'items': {'$ref': '#/definitions/Macaroon'}, 'type': 'array'}, 'type': 'array'}, 'nonce': {'type': 'string'}, 'token': {'type': 'string'}, 'user-data': {'type': 'string'}}, 'required': ['auth-tag', 'credentials', 'nonce', 'macaroons', 'user-data'], 'type': 'object'}, 'LoginResult': {'additionalProperties': False, 'properties': {'bakery-discharge-required': {'$ref': '#/definitions/Macaroon'}, 'controller-tag': {'type': 'string'}, 'discharge-required': {'$ref': '#/definitions/Macaroon'}, 'discharge-required-error': {'type': 'string'}, 'facades': {'items': {'$ref': '#/definitions/FacadeVersions'}, 'type': 'array'}, 'model-tag': {'type': 'string'}, 'public-dns-name': {'type': 'string'}, 'server-version': {'type': 'string'}, 'servers': {'items': {'items': {'$ref': '#/definitions/HostPort'}, 'type': 'array'}, 'type': 'array'}, 'user-info': {'$ref': '#/definitions/AuthUserInfo'}}, 'type': 'object'}, 'Macaroon': {'additionalProperties': False, 'type': 'object'}, 'RedirectInfoResult': {'additionalProperties': False, 'properties': {'ca-cert': {'type': 'string'}, 'servers': {'items': {'items': {'$ref': '#/definitions/HostPort'}, 'type': 'array'}, 'type': 'array'}}, 'required': ['servers', 'ca-cert'], 'type': 'object'}}, 'properties': {'Login': {'description': 'Login logs in with the provided ' 'credentials. All subsequent ' 'requests on the\n' 'connection will act as the ' 'authenticated user.', 'properties': {'Params': {'$ref': '#/definitions/LoginRequest'}, 'Result': {'$ref': '#/definitions/LoginResult'}}, 'type': 'object'}, 'RedirectInfo': {'description': 'RedirectInfo returns ' 'redirected host information ' 'for the model.\n' 'In Juju it always returns an ' 'error because the Juju ' 'controller\n' 'does not multiplex ' 'controllers.', 'properties': {'Result': {'$ref': '#/definitions/RedirectInfoResult'}}, 'type': 'object'}}, 'type': 'object'}
[docs] @ReturnMapping(LoginResult) async def Login(self, auth_tag=None, bakery_version=None, cli_args=None, client_version=None, credentials=None, macaroons=None, nonce=None, token=None, user_data=None): ''' Login logs in with the provided credentials. All subsequent requests on the connection will act as the authenticated user. auth_tag : str bakery_version : int cli_args : str client_version : str credentials : str macaroons : typing.Sequence[~Macaroon] nonce : str token : str user_data : str Returns -> LoginResult ''' if auth_tag is not None and not isinstance(auth_tag, (bytes, str)): raise Exception("Expected auth_tag to be a str, received: {}".format(type(auth_tag))) if bakery_version is not None and not isinstance(bakery_version, int): raise Exception("Expected bakery_version to be a int, received: {}".format(type(bakery_version))) if cli_args is not None and not isinstance(cli_args, (bytes, str)): raise Exception("Expected cli_args to be a str, received: {}".format(type(cli_args))) if client_version is not None and not isinstance(client_version, (bytes, str)): raise Exception("Expected client_version to be a str, received: {}".format(type(client_version))) if credentials is not None and not isinstance(credentials, (bytes, str)): raise Exception("Expected credentials to be a str, received: {}".format(type(credentials))) if macaroons is not None and not isinstance(macaroons, (bytes, str, list)): raise Exception("Expected macaroons to be a Sequence, received: {}".format(type(macaroons))) if nonce is not None and not isinstance(nonce, (bytes, str)): raise Exception("Expected nonce to be a str, received: {}".format(type(nonce))) if token is not None and not isinstance(token, (bytes, str)): raise Exception("Expected token to be a str, received: {}".format(type(token))) if user_data is not None and not isinstance(user_data, (bytes, str)): raise Exception("Expected user_data to be a str, received: {}".format(type(user_data))) # map input types to rpc msg _params = dict() msg = dict(type='Admin', request='Login', version=3, params=_params) _params['auth-tag'] = auth_tag _params['bakery-version'] = bakery_version _params['cli-args'] = cli_args _params['client-version'] = client_version _params['credentials'] = credentials _params['macaroons'] = macaroons _params['nonce'] = nonce _params['token'] = token _params['user-data'] = user_data reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(RedirectInfoResult) async def RedirectInfo(self): ''' RedirectInfo returns redirected host information for the model. In Juju it always returns an error because the Juju controller does not multiplex controllers. Returns -> RedirectInfoResult ''' # map input types to rpc msg _params = dict() msg = dict(type='Admin', request='RedirectInfo', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs]class AgentFacade(Type): name = 'Agent' version = 3 schema = {'definitions': {'AgentGetEntitiesResult': {'additionalProperties': False, 'properties': {'container-type': {'type': 'string'}, 'error': {'$ref': '#/definitions/Error'}, 'jobs': {'items': {'type': 'string'}, 'type': 'array'}, 'life': {'type': 'string'}}, 'required': ['life', 'jobs', 'container-type'], 'type': 'object'}, 'AgentGetEntitiesResults': {'additionalProperties': False, 'properties': {'entities': {'items': {'$ref': '#/definitions/AgentGetEntitiesResult'}, 'type': 'array'}}, 'required': ['entities'], 'type': 'object'}, 'CloudCredential': {'additionalProperties': False, 'properties': {'attrs': {'patternProperties': {'.*': {'type': 'string'}}, 'type': 'object'}, 'auth-type': {'type': 'string'}, 'redacted': {'items': {'type': 'string'}, 'type': 'array'}}, 'required': ['auth-type'], 'type': 'object'}, 'CloudSpec': {'additionalProperties': False, 'properties': {'cacertificates': {'items': {'type': 'string'}, 'type': 'array'}, 'credential': {'$ref': '#/definitions/CloudCredential'}, 'endpoint': {'type': 'string'}, 'identity-endpoint': {'type': 'string'}, 'is-controller-cloud': {'type': 'boolean'}, 'name': {'type': 'string'}, 'region': {'type': 'string'}, 'skip-tls-verify': {'type': 'boolean'}, 'storage-endpoint': {'type': 'string'}, 'type': {'type': 'string'}}, 'required': ['type', 'name'], 'type': 'object'}, 'CloudSpecResult': {'additionalProperties': False, 'properties': {'error': {'$ref': '#/definitions/Error'}, 'result': {'$ref': '#/definitions/CloudSpec'}}, 'type': 'object'}, 'CloudSpecResults': {'additionalProperties': False, 'properties': {'results': {'items': {'$ref': '#/definitions/CloudSpecResult'}, 'type': 'array'}}, 'type': 'object'}, 'ControllerAPIInfoResult': {'additionalProperties': False, 'properties': {'addresses': {'items': {'type': 'string'}, 'type': 'array'}, 'cacert': {'type': 'string'}, 'error': {'$ref': '#/definitions/Error'}}, 'required': ['addresses', 'cacert'], 'type': 'object'}, 'ControllerAPIInfoResults': {'additionalProperties': False, 'properties': {'results': {'items': {'$ref': '#/definitions/ControllerAPIInfoResult'}, 'type': 'array'}}, 'required': ['results'], 'type': 'object'}, 'ControllerConfigResult': {'additionalProperties': False, 'properties': {'config': {'patternProperties': {'.*': {'additionalProperties': True, 'type': 'object'}}, 'type': 'object'}}, 'required': ['config'], 'type': 'object'}, 'Entities': {'additionalProperties': False, 'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'}, 'type': 'array'}}, 'required': ['entities'], 'type': 'object'}, 'Entity': {'additionalProperties': False, 'properties': {'tag': {'type': 'string'}}, 'required': ['tag'], 'type': 'object'}, 'EntityPassword': {'additionalProperties': False, 'properties': {'password': {'type': 'string'}, 'tag': {'type': 'string'}}, 'required': ['tag', 'password'], 'type': 'object'}, 'EntityPasswords': {'additionalProperties': False, 'properties': {'changes': {'items': {'$ref': '#/definitions/EntityPassword'}, 'type': 'array'}}, 'required': ['changes'], 'type': 'object'}, 'Error': {'additionalProperties': False, 'properties': {'code': {'type': 'string'}, 'info': {'patternProperties': {'.*': {'additionalProperties': True, 'type': 'object'}}, 'type': 'object'}, 'message': {'type': 'string'}}, 'required': ['message', 'code'], 'type': 'object'}, 'ErrorResult': {'additionalProperties': False, 'properties': {'error': {'$ref': '#/definitions/Error'}}, 'type': 'object'}, 'ErrorResults': {'additionalProperties': False, 'properties': {'results': {'items': {'$ref': '#/definitions/ErrorResult'}, 'type': 'array'}}, 'required': ['results'], 'type': 'object'}, 'IsMasterResult': {'additionalProperties': False, 'properties': {'master': {'type': 'boolean'}}, 'required': ['master'], 'type': 'object'}, 'ModelConfigResult': {'additionalProperties': False, 'properties': {'config': {'patternProperties': {'.*': {'additionalProperties': True, 'type': 'object'}}, 'type': 'object'}}, 'required': ['config'], 'type': 'object'}, 'ModelTag': {'additionalProperties': False, 'type': 'object'}, 'NotifyWatchResult': {'additionalProperties': False, 'properties': {'NotifyWatcherId': {'type': 'string'}, 'error': {'$ref': '#/definitions/Error'}}, 'required': ['NotifyWatcherId'], 'type': 'object'}, 'NotifyWatchResults': {'additionalProperties': False, 'properties': {'results': {'items': {'$ref': '#/definitions/NotifyWatchResult'}, 'type': 'array'}}, 'required': ['results'], 'type': 'object'}, 'StateServingInfo': {'additionalProperties': False, 'properties': {'api-port': {'type': 'integer'}, 'ca-private-key': {'type': 'string'}, 'cert': {'type': 'string'}, 'controller-api-port': {'type': 'integer'}, 'private-key': {'type': 'string'}, 'shared-secret': {'type': 'string'}, 'state-port': {'type': 'integer'}, 'system-identity': {'type': 'string'}}, 'required': ['api-port', 'state-port', 'cert', 'private-key', 'ca-private-key', 'shared-secret', 'system-identity'], 'type': 'object'}}, 'properties': {'ClearReboot': {'description': 'ClearReboot will clear the ' 'reboot flag on provided ' 'machines, if it exists.', 'properties': {'Params': {'$ref': '#/definitions/Entities'}, 'Result': {'$ref': '#/definitions/ErrorResults'}}, 'type': 'object'}, 'CloudSpec': {'description': "CloudSpec returns the model's " 'cloud spec.', 'properties': {'Params': {'$ref': '#/definitions/Entities'}, 'Result': {'$ref': '#/definitions/CloudSpecResults'}}, 'type': 'object'}, 'ControllerAPIInfoForModels': {'description': 'ControllerAPIInfoForModels ' 'returns the ' 'controller api ' 'connection ' 'details for the ' 'specified ' 'models.', 'properties': {'Params': {'$ref': '#/definitions/Entities'}, 'Result': {'$ref': '#/definitions/ControllerAPIInfoResults'}}, 'type': 'object'}, 'ControllerConfig': {'description': 'ControllerConfig returns ' "the controller's " 'configuration.', 'properties': {'Result': {'$ref': '#/definitions/ControllerConfigResult'}}, 'type': 'object'}, 'GetCloudSpec': {'description': 'GetCloudSpec constructs the ' 'CloudSpec for a validated and ' 'authorized model.', 'properties': {'Params': {'$ref': '#/definitions/ModelTag'}, 'Result': {'$ref': '#/definitions/CloudSpecResult'}}, 'type': 'object'}, 'GetEntities': {'properties': {'Params': {'$ref': '#/definitions/Entities'}, 'Result': {'$ref': '#/definitions/AgentGetEntitiesResults'}}, 'type': 'object'}, 'IsMaster': {'properties': {'Result': {'$ref': '#/definitions/IsMasterResult'}}, 'type': 'object'}, 'ModelConfig': {'description': 'ModelConfig returns the ' "current model's configuration.", 'properties': {'Result': {'$ref': '#/definitions/ModelConfigResult'}}, 'type': 'object'}, 'SetPasswords': {'description': 'SetPasswords sets the given ' 'password for each supplied ' 'entity, if possible.', 'properties': {'Params': {'$ref': '#/definitions/EntityPasswords'}, 'Result': {'$ref': '#/definitions/ErrorResults'}}, 'type': 'object'}, 'StateServingInfo': {'properties': {'Result': {'$ref': '#/definitions/StateServingInfo'}}, 'type': 'object'}, 'WatchCloudSpecsChanges': {'description': 'WatchCloudSpecsChanges ' 'returns a watcher ' 'for cloud spec ' 'changes.', 'properties': {'Params': {'$ref': '#/definitions/Entities'}, 'Result': {'$ref': '#/definitions/NotifyWatchResults'}}, 'type': 'object'}, 'WatchCredentials': {'description': 'WatchCredentials watches ' 'for changes to the ' 'specified credentials.', 'properties': {'Params': {'$ref': '#/definitions/Entities'}, 'Result': {'$ref': '#/definitions/NotifyWatchResults'}}, 'type': 'object'}, 'WatchForModelConfigChanges': {'description': 'WatchForModelConfigChanges ' 'returns a ' 'NotifyWatcher ' 'that observes\n' 'changes to the ' 'model ' 'configuration.\n' 'Note that ' 'although the ' 'NotifyWatchResult ' 'contains an ' 'Error field,\n' "it's not used " 'because we are ' 'only returning ' 'a single ' 'watcher,\n' 'so we use the ' 'regular error ' 'return.', 'properties': {'Result': {'$ref': '#/definitions/NotifyWatchResult'}}, 'type': 'object'}}, 'type': 'object'}
[docs] @ReturnMapping(ErrorResults) async def ClearReboot(self, entities=None): ''' ClearReboot will clear the reboot flag on provided machines, if it exists. entities : typing.Sequence[~Entity] Returns -> ErrorResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) # map input types to rpc msg _params = dict() msg = dict(type='Agent', request='ClearReboot', version=3, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(CloudSpecResults) async def CloudSpec(self, entities=None): ''' CloudSpec returns the model's cloud spec. entities : typing.Sequence[~Entity] Returns -> CloudSpecResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) # map input types to rpc msg _params = dict() msg = dict(type='Agent', request='CloudSpec', version=3, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(ControllerAPIInfoResults) async def ControllerAPIInfoForModels(self, entities=None): ''' ControllerAPIInfoForModels returns the controller api connection details for the specified models. entities : typing.Sequence[~Entity] Returns -> ControllerAPIInfoResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) # map input types to rpc msg _params = dict() msg = dict(type='Agent', request='ControllerAPIInfoForModels', version=3, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(ControllerConfigResult) async def ControllerConfig(self): ''' ControllerConfig returns the controller's configuration. Returns -> ControllerConfigResult ''' # map input types to rpc msg _params = dict() msg = dict(type='Agent', request='ControllerConfig', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(CloudSpecResult) async def GetCloudSpec(self): ''' GetCloudSpec constructs the CloudSpec for a validated and authorized model. Returns -> CloudSpecResult ''' # map input types to rpc msg _params = dict() msg = dict(type='Agent', request='GetCloudSpec', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(AgentGetEntitiesResults) async def GetEntities(self, entities=None): ''' entities : typing.Sequence[~Entity] Returns -> AgentGetEntitiesResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) # map input types to rpc msg _params = dict() msg = dict(type='Agent', request='GetEntities', version=3, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(IsMasterResult) async def IsMaster(self): ''' Returns -> IsMasterResult ''' # map input types to rpc msg _params = dict() msg = dict(type='Agent', request='IsMaster', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(ModelConfigResult) async def ModelConfig(self): ''' ModelConfig returns the current model's configuration. Returns -> ModelConfigResult ''' # map input types to rpc msg _params = dict() msg = dict(type='Agent', request='ModelConfig', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(ErrorResults) async def SetPasswords(self, changes=None): ''' SetPasswords sets the given password for each supplied entity, if possible. changes : typing.Sequence[~EntityPassword] Returns -> ErrorResults ''' if changes is not None and not isinstance(changes, (bytes, str, list)): raise Exception("Expected changes to be a Sequence, received: {}".format(type(changes))) # map input types to rpc msg _params = dict() msg = dict(type='Agent', request='SetPasswords', version=3, params=_params) _params['changes'] = changes reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(StateServingInfo) async def StateServingInfo(self): ''' Returns -> StateServingInfo ''' # map input types to rpc msg _params = dict() msg = dict(type='Agent', request='StateServingInfo', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(NotifyWatchResults) async def WatchCloudSpecsChanges(self, entities=None): ''' WatchCloudSpecsChanges returns a watcher for cloud spec changes. entities : typing.Sequence[~Entity] Returns -> NotifyWatchResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) # map input types to rpc msg _params = dict() msg = dict(type='Agent', request='WatchCloudSpecsChanges', version=3, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(NotifyWatchResults) async def WatchCredentials(self, entities=None): ''' WatchCredentials watches for changes to the specified credentials. entities : typing.Sequence[~Entity] Returns -> NotifyWatchResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) # map input types to rpc msg _params = dict() msg = dict(type='Agent', request='WatchCredentials', version=3, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(NotifyWatchResult) async def WatchForModelConfigChanges(self): ''' WatchForModelConfigChanges returns a NotifyWatcher that observes changes to the model configuration. Note that although the NotifyWatchResult contains an Error field, it's not used because we are only returning a single watcher, so we use the regular error return. Returns -> NotifyWatchResult ''' # map input types to rpc msg _params = dict() msg = dict(type='Agent', request='WatchForModelConfigChanges', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs]class AllWatcherFacade(Type): name = 'AllWatcher' version = 3 schema = {'definitions': {'AllWatcherNextResults': {'additionalProperties': False, 'properties': {'deltas': {'items': {'$ref': '#/definitions/Delta'}, 'type': 'array'}}, 'required': ['deltas'], 'type': 'object'}, 'Delta': {'additionalProperties': False, 'properties': {'entity': {'additionalProperties': True, 'type': 'object'}, 'removed': {'type': 'boolean'}}, 'required': ['removed', 'entity'], 'type': 'object'}}, 'properties': {'Next': {'description': 'Next will return the current state of ' 'everything on the first call\n' 'and subsequent calls will', 'properties': {'Result': {'$ref': '#/definitions/AllWatcherNextResults'}}, 'type': 'object'}, 'Stop': {'description': 'Stop stops the watcher.', 'type': 'object'}}, 'type': 'object'}
[docs] @ReturnMapping(AllWatcherNextResults) async def Next(self): ''' Next will return the current state of everything on the first call and subsequent calls will Returns -> AllWatcherNextResults ''' # map input types to rpc msg _params = dict() msg = dict(type='AllWatcher', request='Next', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(None) async def Stop(self): ''' Stop stops the watcher. Returns -> None ''' # map input types to rpc msg _params = dict() msg = dict(type='AllWatcher', request='Stop', version=3, params=_params) reply = await self.rpc(msg) return reply
async def rpc(self, msg): ''' Patch rpc method to add Id. ''' if not hasattr(self, 'Id'): raise RuntimeError('Missing "Id" field') msg['Id'] = id from .facade import TypeEncoder reply = await self.connection.rpc(msg, encoder=TypeEncoder) return reply
[docs]class BackupsFacade(Type): name = 'Backups' version = 3 schema = {'definitions': {'BackupsCreateArgs': {'additionalProperties': False, 'properties': {'no-download': {'type': 'boolean'}, 'notes': {'type': 'string'}}, 'required': ['notes', 'no-download'], 'type': 'object'}, 'BackupsMetadataResult': {'additionalProperties': False, 'properties': {'base': {'type': 'string'}, 'checksum': {'type': 'string'}, 'checksum-format': {'type': 'string'}, 'controller-machine-id': {'type': 'string'}, 'controller-machine-inst-id': {'type': 'string'}, 'controller-uuid': {'type': 'string'}, 'filename': {'type': 'string'}, 'finished': {'format': 'date-time', 'type': 'string'}, 'format-version': {'type': 'integer'}, 'ha-nodes': {'type': 'integer'}, 'hostname': {'type': 'string'}, 'id': {'type': 'string'}, 'machine': {'type': 'string'}, 'model': {'type': 'string'}, 'notes': {'type': 'string'}, 'size': {'type': 'integer'}, 'started': {'format': 'date-time', 'type': 'string'}, 'stored': {'format': 'date-time', 'type': 'string'}, 'version': {'$ref': '#/definitions/Number'}}, 'required': ['id', 'checksum', 'checksum-format', 'size', 'stored', 'started', 'finished', 'notes', 'model', 'machine', 'hostname', 'version', 'base', 'filename', 'format-version', 'controller-uuid', 'controller-machine-id', 'controller-machine-inst-id', 'ha-nodes'], 'type': 'object'}, 'Number': {'additionalProperties': False, 'properties': {'Build': {'type': 'integer'}, 'Major': {'type': 'integer'}, 'Minor': {'type': 'integer'}, 'Patch': {'type': 'integer'}, 'Tag': {'type': 'string'}}, 'required': ['Major', 'Minor', 'Tag', 'Patch', 'Build'], 'type': 'object'}}, 'properties': {'Create': {'description': 'Create is the API method that ' 'requests juju to create a new ' 'backup\n' 'of its state.', 'properties': {'Params': {'$ref': '#/definitions/BackupsCreateArgs'}, 'Result': {'$ref': '#/definitions/BackupsMetadataResult'}}, 'type': 'object'}}, 'type': 'object'}
[docs] @ReturnMapping(BackupsMetadataResult) async def Create(self, no_download=None, notes=None): ''' Create is the API method that requests juju to create a new backup of its state. no_download : bool notes : str Returns -> BackupsMetadataResult ''' if no_download is not None and not isinstance(no_download, bool): raise Exception("Expected no_download to be a bool, received: {}".format(type(no_download))) if notes is not None and not isinstance(notes, (bytes, str)): raise Exception("Expected notes to be a str, received: {}".format(type(notes))) # map input types to rpc msg _params = dict() msg = dict(type='Backups', request='Create', version=3, params=_params) _params['no-download'] = no_download _params['notes'] = notes reply = await self.rpc(msg) return reply
[docs]class ImageMetadataFacade(Type): name = 'ImageMetadata' version = 3 schema = {'properties': {'UpdateFromPublishedImages': {'description': 'UpdateFromPublishedImages ' 'is now a no-op.\n' 'It is retained ' 'for ' 'compatibility.', 'type': 'object'}}, 'type': 'object'}
[docs] @ReturnMapping(None) async def UpdateFromPublishedImages(self): ''' UpdateFromPublishedImages is now a no-op. It is retained for compatibility. Returns -> None ''' # map input types to rpc msg _params = dict() msg = dict(type='ImageMetadata', request='UpdateFromPublishedImages', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs]class InstanceMutaterFacade(Type): name = 'InstanceMutater' version = 3 schema = {'definitions': {'CharmLXDProfile': {'additionalProperties': False, 'properties': {'config': {'patternProperties': {'.*': {'type': 'string'}}, 'type': 'object'}, 'description': {'type': 'string'}, 'devices': {'patternProperties': {'.*': {'patternProperties': {'.*': {'type': 'string'}}, 'type': 'object'}}, 'type': 'object'}}, 'required': ['config', 'description', 'devices'], 'type': 'object'}, 'CharmProfilingInfoResult': {'additionalProperties': False, 'properties': {'current-profiles': {'items': {'type': 'string'}, 'type': 'array'}, 'error': {'$ref': '#/definitions/Error'}, 'instance-id': {'type': 'string'}, 'model-name': {'type': 'string'}, 'profile-changes': {'items': {'$ref': '#/definitions/ProfileInfoResult'}, 'type': 'array'}}, 'required': ['instance-id', 'model-name', 'profile-changes', 'current-profiles', 'error'], 'type': 'object'}, 'ContainerTypeResult': {'additionalProperties': False, 'properties': {'container-type': {'type': 'string'}, 'error': {'$ref': '#/definitions/Error'}}, 'required': ['container-type', 'error'], 'type': 'object'}, 'Entities': {'additionalProperties': False, 'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'}, 'type': 'array'}}, 'required': ['entities'], 'type': 'object'}, 'Entity': {'additionalProperties': False, 'properties': {'tag': {'type': 'string'}}, 'required': ['tag'], 'type': 'object'}, 'EntityStatusArgs': {'additionalProperties': False, 'properties': {'data': {'patternProperties': {'.*': {'additionalProperties': True, 'type': 'object'}}, 'type': 'object'}, 'info': {'type': 'string'}, 'status': {'type': 'string'}, 'tag': {'type': 'string'}}, 'required': ['tag', 'status', 'info', 'data'], 'type': 'object'}, 'Error': {'additionalProperties': False, 'properties': {'code': {'type': 'string'}, 'info': {'patternProperties': {'.*': {'additionalProperties': True, 'type': 'object'}}, 'type': 'object'}, 'message': {'type': 'string'}}, 'required': ['message', 'code'], 'type': 'object'}, 'ErrorResult': {'additionalProperties': False, 'properties': {'error': {'$ref': '#/definitions/Error'}}, 'type': 'object'}, 'ErrorResults': {'additionalProperties': False, 'properties': {'results': {'items': {'$ref': '#/definitions/ErrorResult'}, 'type': 'array'}}, 'required': ['results'], 'type': 'object'}, 'LifeResult': {'additionalProperties': False, 'properties': {'error': {'$ref': '#/definitions/Error'}, 'life': {'type': 'string'}}, 'required': ['life'], 'type': 'object'}, 'LifeResults': {'additionalProperties': False, 'properties': {'results': {'items': {'$ref': '#/definitions/LifeResult'}, 'type': 'array'}}, 'required': ['results'], 'type': 'object'}, 'NotifyWatchResult': {'additionalProperties': False, 'properties': {'NotifyWatcherId': {'type': 'string'}, 'error': {'$ref': '#/definitions/Error'}}, 'required': ['NotifyWatcherId'], 'type': 'object'}, 'NotifyWatchResults': {'additionalProperties': False, 'properties': {'results': {'items': {'$ref': '#/definitions/NotifyWatchResult'}, 'type': 'array'}}, 'required': ['results'], 'type': 'object'}, 'ProfileInfoResult': {'additionalProperties': False, 'properties': {'application-name': {'type': 'string'}, 'error': {'$ref': '#/definitions/Error'}, 'profile': {'$ref': '#/definitions/CharmLXDProfile'}, 'revision': {'type': 'integer'}}, 'type': 'object'}, 'SetProfileArg': {'additionalProperties': False, 'properties': {'entity': {'$ref': '#/definitions/Entity'}, 'profiles': {'items': {'type': 'string'}, 'type': 'array'}}, 'required': ['entity', 'profiles'], 'type': 'object'}, 'SetProfileArgs': {'additionalProperties': False, 'properties': {'args': {'items': {'$ref': '#/definitions/SetProfileArg'}, 'type': 'array'}}, 'required': ['args'], 'type': 'object'}, 'SetStatus': {'additionalProperties': False, 'properties': {'entities': {'items': {'$ref': '#/definitions/EntityStatusArgs'}, 'type': 'array'}}, 'required': ['entities'], 'type': 'object'}, 'StringsWatchResult': {'additionalProperties': False, 'properties': {'changes': {'items': {'type': 'string'}, 'type': 'array'}, 'error': {'$ref': '#/definitions/Error'}, 'watcher-id': {'type': 'string'}}, 'required': ['watcher-id'], 'type': 'object'}}, 'properties': {'CharmProfilingInfo': {'description': 'CharmProfilingInfo ' 'returns info to update ' 'lxd profiles on the ' 'machine. If\n' 'the machine is not ' 'provisioned, no profile ' 'change info will be ' 'returned,\n' 'nor will an error.', 'properties': {'Params': {'$ref': '#/definitions/Entity'}, 'Result': {'$ref': '#/definitions/CharmProfilingInfoResult'}}, 'type': 'object'}, 'ContainerType': {'description': 'ContainerType returns the ' 'container type of a machine.', 'properties': {'Params': {'$ref': '#/definitions/Entity'}, 'Result': {'$ref': '#/definitions/ContainerTypeResult'}}, 'type': 'object'}, 'Life': {'description': 'Life returns the life status of every ' 'supplied entity, where available.', 'properties': {'Params': {'$ref': '#/definitions/Entities'}, 'Result': {'$ref': '#/definitions/LifeResults'}}, 'type': 'object'}, 'SetCharmProfiles': {'description': 'SetCharmProfiles records ' 'the given slice of charm ' 'profile names.', 'properties': {'Params': {'$ref': '#/definitions/SetProfileArgs'}, 'Result': {'$ref': '#/definitions/ErrorResults'}}, 'type': 'object'}, 'SetModificationStatus': {'description': 'SetModificationStatus ' 'updates the instance ' 'whilst changes are ' 'occurring. This\n' 'is different from ' 'SetStatus and ' 'SetInstanceStatus, ' 'by the fact this ' 'holds\n' 'information about ' 'the ongoing changes ' 'that are happening ' 'to instances.\n' 'Consider LXD Profile ' 'updates that can ' 'modify a instance, ' 'but may not cause\n' 'the instance to be ' 'placed into a error ' 'state. This ' 'modification status\n' 'serves the purpose ' 'of highlighting that ' 'to the operator.\n' 'Only machine tags ' 'are accepted.', 'properties': {'Params': {'$ref': '#/definitions/SetStatus'}, 'Result': {'$ref': '#/definitions/ErrorResults'}}, 'type': 'object'}, 'WatchContainers': {'description': 'WatchContainers starts a ' 'watcher to track ' 'Containers on a given\n' 'machine.', 'properties': {'Params': {'$ref': '#/definitions/Entity'}, 'Result': {'$ref': '#/definitions/StringsWatchResult'}}, 'type': 'object'}, 'WatchLXDProfileVerificationNeeded': {'description': 'WatchLXDProfileVerificationNeeded ' 'starts a ' 'watcher ' 'to track ' 'Applications ' 'with\n' 'LXD ' 'Profiles.', 'properties': {'Params': {'$ref': '#/definitions/Entities'}, 'Result': {'$ref': '#/definitions/NotifyWatchResults'}}, 'type': 'object'}, 'WatchMachines': {'description': 'WatchMachines starts a ' 'watcher to track machines.\n' 'WatchMachines does not ' 'consume the initial event of ' 'the watch response, as\n' 'that returns the initial set ' 'of machines that are ' 'currently available.', 'properties': {'Result': {'$ref': '#/definitions/StringsWatchResult'}}, 'type': 'object'}, 'WatchModelMachines': {'description': 'WatchModelMachines ' 'starts a watcher to ' 'track machines, but not ' 'containers.\n' 'WatchModelMachines does ' 'not consume the initial ' 'event of the watch ' 'response, as\n' 'that returns the ' 'initial set of machines ' 'that are currently ' 'available.', 'properties': {'Result': {'$ref': '#/definitions/StringsWatchResult'}}, 'type': 'object'}}, 'type': 'object'}
[docs] @ReturnMapping(CharmProfilingInfoResult) async def CharmProfilingInfo(self, tag=None): ''' CharmProfilingInfo returns info to update lxd profiles on the machine. If the machine is not provisioned, no profile change info will be returned, nor will an error. tag : str Returns -> CharmProfilingInfoResult ''' if tag is not None and not isinstance(tag, (bytes, str)): raise Exception("Expected tag to be a str, received: {}".format(type(tag))) # map input types to rpc msg _params = dict() msg = dict(type='InstanceMutater', request='CharmProfilingInfo', version=3, params=_params) _params['tag'] = tag reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(ContainerTypeResult) async def ContainerType(self, tag=None): ''' ContainerType returns the container type of a machine. tag : str Returns -> ContainerTypeResult ''' if tag is not None and not isinstance(tag, (bytes, str)): raise Exception("Expected tag to be a str, received: {}".format(type(tag))) # map input types to rpc msg _params = dict() msg = dict(type='InstanceMutater', request='ContainerType', version=3, params=_params) _params['tag'] = tag reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(LifeResults) async def Life(self, entities=None): ''' Life returns the life status of every supplied entity, where available. entities : typing.Sequence[~Entity] Returns -> LifeResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) # map input types to rpc msg _params = dict() msg = dict(type='InstanceMutater', request='Life', version=3, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(ErrorResults) async def SetCharmProfiles(self, args=None): ''' SetCharmProfiles records the given slice of charm profile names. args : typing.Sequence[~SetProfileArg] Returns -> ErrorResults ''' if args is not None and not isinstance(args, (bytes, str, list)): raise Exception("Expected args to be a Sequence, received: {}".format(type(args))) # map input types to rpc msg _params = dict() msg = dict(type='InstanceMutater', request='SetCharmProfiles', version=3, params=_params) _params['args'] = args reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(ErrorResults) async def SetModificationStatus(self, entities=None): ''' SetModificationStatus updates the instance whilst changes are occurring. This is different from SetStatus and SetInstanceStatus, by the fact this holds information about the ongoing changes that are happening to instances. Consider LXD Profile updates that can modify a instance, but may not cause the instance to be placed into a error state. This modification status serves the purpose of highlighting that to the operator. Only machine tags are accepted. entities : typing.Sequence[~EntityStatusArgs] Returns -> ErrorResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) # map input types to rpc msg _params = dict() msg = dict(type='InstanceMutater', request='SetModificationStatus', version=3, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(StringsWatchResult) async def WatchContainers(self, tag=None): ''' WatchContainers starts a watcher to track Containers on a given machine. tag : str Returns -> StringsWatchResult ''' if tag is not None and not isinstance(tag, (bytes, str)): raise Exception("Expected tag to be a str, received: {}".format(type(tag))) # map input types to rpc msg _params = dict() msg = dict(type='InstanceMutater', request='WatchContainers', version=3, params=_params) _params['tag'] = tag reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(NotifyWatchResults) async def WatchLXDProfileVerificationNeeded(self, entities=None): ''' WatchLXDProfileVerificationNeeded starts a watcher to track Applications with LXD Profiles. entities : typing.Sequence[~Entity] Returns -> NotifyWatchResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) # map input types to rpc msg _params = dict() msg = dict(type='InstanceMutater', request='WatchLXDProfileVerificationNeeded', version=3, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(StringsWatchResult) async def WatchMachines(self): ''' WatchMachines starts a watcher to track machines. WatchMachines does not consume the initial event of the watch response, as that returns the initial set of machines that are currently available. Returns -> StringsWatchResult ''' # map input types to rpc msg _params = dict() msg = dict(type='InstanceMutater', request='WatchMachines', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(StringsWatchResult) async def WatchModelMachines(self): ''' WatchModelMachines starts a watcher to track machines, but not containers. WatchModelMachines does not consume the initial event of the watch response, as that returns the initial set of machines that are currently available. Returns -> StringsWatchResult ''' # map input types to rpc msg _params = dict() msg = dict(type='InstanceMutater', request='WatchModelMachines', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs]class MigrationMasterFacade(Type): name = 'MigrationMaster' version = 3 schema = {'definitions': {'Error': {'additionalProperties': False, 'properties': {'code': {'type': 'string'}, 'info': {'patternProperties': {'.*': {'additionalProperties': True, 'type': 'object'}}, 'type': 'object'}, 'message': {'type': 'string'}}, 'required': ['message', 'code'], 'type': 'object'}, 'MasterMigrationStatus': {'additionalProperties': False, 'properties': {'migration-id': {'type': 'string'}, 'phase': {'type': 'string'}, 'phase-changed-time': {'format': 'date-time', 'type': 'string'}, 'spec': {'$ref': '#/definitions/MigrationSpec'}}, 'required': ['spec', 'migration-id', 'phase', 'phase-changed-time'], 'type': 'object'}, 'MigrationModelInfo': {'additionalProperties': False, 'properties': {'agent-version': {'$ref': '#/definitions/Number'}, 'controller-agent-version': {'$ref': '#/definitions/Number'}, 'name': {'type': 'string'}, 'owner-tag': {'type': 'string'}, 'uuid': {'type': 'string'}}, 'required': ['uuid', 'name', 'owner-tag', 'agent-version', 'controller-agent-version'], 'type': 'object'}, 'MigrationSourceInfo': {'additionalProperties': False, 'properties': {'addrs': {'items': {'type': 'string'}, 'type': 'array'}, 'ca-cert': {'type': 'string'}, 'controller-alias': {'type': 'string'}, 'controller-tag': {'type': 'string'}, 'local-related-models': {'items': {'type': 'string'}, 'type': 'array'}}, 'required': ['local-related-models', 'controller-tag', 'addrs', 'ca-cert'], 'type': 'object'}, 'MigrationSpec': {'additionalProperties': False, 'properties': {'model-tag': {'type': 'string'}, 'target-info': {'$ref': '#/definitions/MigrationTargetInfo'}}, 'required': ['model-tag', 'target-info'], 'type': 'object'}, 'MigrationTargetInfo': {'additionalProperties': False, 'properties': {'addrs': {'items': {'type': 'string'}, 'type': 'array'}, 'auth-tag': {'type': 'string'}, 'ca-cert': {'type': 'string'}, 'controller-alias': {'type': 'string'}, 'controller-tag': {'type': 'string'}, 'macaroons': {'type': 'string'}, 'password': {'type': 'string'}}, 'required': ['controller-tag', 'addrs', 'ca-cert', 'auth-tag'], 'type': 'object'}, 'MinionReports': {'additionalProperties': False, 'properties': {'failed': {'items': {'type': 'string'}, 'type': 'array'}, 'migration-id': {'type': 'string'}, 'phase': {'type': 'string'}, 'success-count': {'type': 'integer'}, 'unknown-count': {'type': 'integer'}, 'unknown-sample': {'items': {'type': 'string'}, 'type': 'array'}}, 'required': ['migration-id', 'phase', 'success-count', 'unknown-count', 'unknown-sample', 'failed'], 'type': 'object'}, 'NotifyWatchResult': {'additionalProperties': False, 'properties': {'NotifyWatcherId': {'type': 'string'}, 'error': {'$ref': '#/definitions/Error'}}, 'required': ['NotifyWatcherId'], 'type': 'object'}, 'Number': {'additionalProperties': False, 'properties': {'Build': {'type': 'integer'}, 'Major': {'type': 'integer'}, 'Minor': {'type': 'integer'}, 'Patch': {'type': 'integer'}, 'Tag': {'type': 'string'}}, 'required': ['Major', 'Minor', 'Tag', 'Patch', 'Build'], 'type': 'object'}, 'PrechecksArgs': {'additionalProperties': False, 'properties': {'target-controller-version': {'$ref': '#/definitions/Number'}}, 'required': ['target-controller-version'], 'type': 'object'}, 'ProcessRelations': {'additionalProperties': False, 'properties': {'controller-alias': {'type': 'string'}}, 'required': ['controller-alias'], 'type': 'object'}, 'SerializedModel': {'additionalProperties': False, 'properties': {'bytes': {'items': {'type': 'integer'}, 'type': 'array'}, 'charms': {'items': {'type': 'string'}, 'type': 'array'}, 'resources': {'items': {'$ref': '#/definitions/SerializedModelResource'}, 'type': 'array'}, 'tools': {'items': {'$ref': '#/definitions/SerializedModelTools'}, 'type': 'array'}}, 'required': ['bytes', 'charms', 'tools', 'resources'], 'type': 'object'}, 'SerializedModelResource': {'additionalProperties': False, 'properties': {'application': {'type': 'string'}, 'application-revision': {'$ref': '#/definitions/SerializedModelResourceRevision'}, 'charmstore-revision': {'$ref': '#/definitions/SerializedModelResourceRevision'}, 'name': {'type': 'string'}, 'unit-revisions': {'patternProperties': {'.*': {'$ref': '#/definitions/SerializedModelResourceRevision'}}, 'type': 'object'}}, 'required': ['application', 'name', 'application-revision', 'charmstore-revision', 'unit-revisions'], 'type': 'object'}, 'SerializedModelResourceRevision': {'additionalProperties': False, 'properties': {'description': {'type': 'string'}, 'fingerprint': {'type': 'string'}, 'origin': {'type': 'string'}, 'path': {'type': 'string'}, 'revision': {'type': 'integer'}, 'size': {'type': 'integer'}, 'timestamp': {'format': 'date-time', 'type': 'string'}, 'type': {'type': 'string'}, 'username': {'type': 'string'}}, 'required': ['revision', 'type', 'path', 'description', 'origin', 'fingerprint', 'size', 'timestamp'], 'type': 'object'}, 'SerializedModelTools': {'additionalProperties': False, 'properties': {'uri': {'type': 'string'}, 'version': {'type': 'string'}}, 'required': ['version', 'uri'], 'type': 'object'}, 'SetMigrationPhaseArgs': {'additionalProperties': False, 'properties': {'phase': {'type': 'string'}}, 'required': ['phase'], 'type': 'object'}, 'SetMigrationStatusMessageArgs': {'additionalProperties': False, 'properties': {'message': {'type': 'string'}}, 'required': ['message'], 'type': 'object'}, 'StringResult': {'additionalProperties': False, 'properties': {'error': {'$ref': '#/definitions/Error'}, 'result': {'type': 'string'}}, 'required': ['result'], 'type': 'object'}}, 'properties': {'Export': {'description': 'Export serializes the model ' 'associated with the API connection.', 'properties': {'Result': {'$ref': '#/definitions/SerializedModel'}}, 'type': 'object'}, 'MigrationStatus': {'description': 'MigrationStatus returns ' 'the details and progress ' 'of the latest\n' 'model migration.', 'properties': {'Result': {'$ref': '#/definitions/MasterMigrationStatus'}}, 'type': 'object'}, 'MinionReportTimeout': {'description': 'MinionReportTimeout ' 'returns the ' 'configuration value ' 'for this controller ' 'that\n' 'indicates how long the ' 'migration master ' 'worker should wait for ' 'minions to\n' 'reported on phases of ' 'a migration.', 'properties': {'Result': {'$ref': '#/definitions/StringResult'}}, 'type': 'object'}, 'MinionReports': {'description': 'MinionReports returns ' 'details of the reports made ' 'by migration\n' 'minions to the controller ' 'for the current migration ' 'phase.', 'properties': {'Result': {'$ref': '#/definitions/MinionReports'}}, 'type': 'object'}, 'ModelInfo': {'description': 'ModelInfo returns essential ' 'information about the model to ' 'be\n' 'migrated.', 'properties': {'Result': {'$ref': '#/definitions/MigrationModelInfo'}}, 'type': 'object'}, 'Prechecks': {'description': 'Prechecks performs pre-migration ' 'checks on the model and\n' '(source) controller.', 'properties': {'Params': {'$ref': '#/definitions/PrechecksArgs'}}, 'type': 'object'}, 'ProcessRelations': {'description': 'ProcessRelations ' 'processes any relations ' 'that need updating after ' 'an export.\n' 'This should help fix any ' 'remoteApplications that ' 'have been migrated.', 'properties': {'Params': {'$ref': '#/definitions/ProcessRelations'}}, 'type': 'object'}, 'Reap': {'description': 'Reap removes all documents for the ' 'model associated with the API\n' 'connection.', 'type': 'object'}, 'SetPhase': {'description': 'SetPhase sets the phase of the ' 'active model migration. The ' 'provided\n' 'phase must be a valid phase ' 'value, for example QUIESCE" or\n' '"ABORT". See the core/migration ' 'package for the complete list.', 'properties': {'Params': {'$ref': '#/definitions/SetMigrationPhaseArgs'}}, 'type': 'object'}, 'SetStatusMessage': {'description': 'SetStatusMessage sets a ' 'human readable status ' 'message containing\n' 'information about the ' "migration's progress. " 'This will be shown in\n' 'status output shown to ' 'the end user.', 'properties': {'Params': {'$ref': '#/definitions/SetMigrationStatusMessageArgs'}}, 'type': 'object'}, 'SourceControllerInfo': {'description': 'SourceControllerInfo ' 'returns the details ' 'required to connect ' 'to\n' 'the source controller ' 'for model migration.', 'properties': {'Result': {'$ref': '#/definitions/MigrationSourceInfo'}}, 'type': 'object'}, 'Watch': {'description': 'Watch starts watching for an active ' 'migration for the model\n' 'associated with the API connection. ' 'The returned id should be used\n' 'with the NotifyWatcher facade to ' 'receive events.', 'properties': {'Result': {'$ref': '#/definitions/NotifyWatchResult'}}, 'type': 'object'}, 'WatchMinionReports': {'description': 'WatchMinionReports sets ' 'up a watcher which ' 'reports when a report\n' 'for a migration minion ' 'has arrived.', 'properties': {'Result': {'$ref': '#/definitions/NotifyWatchResult'}}, 'type': 'object'}}, 'type': 'object'}
[docs] @ReturnMapping(SerializedModel) async def Export(self): ''' Export serializes the model associated with the API connection. Returns -> SerializedModel ''' # map input types to rpc msg _params = dict() msg = dict(type='MigrationMaster', request='Export', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(MasterMigrationStatus) async def MigrationStatus(self): ''' MigrationStatus returns the details and progress of the latest model migration. Returns -> MasterMigrationStatus ''' # map input types to rpc msg _params = dict() msg = dict(type='MigrationMaster', request='MigrationStatus', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(StringResult) async def MinionReportTimeout(self): ''' MinionReportTimeout returns the configuration value for this controller that indicates how long the migration master worker should wait for minions to reported on phases of a migration. Returns -> StringResult ''' # map input types to rpc msg _params = dict() msg = dict(type='MigrationMaster', request='MinionReportTimeout', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(MinionReports) async def MinionReports(self): ''' MinionReports returns details of the reports made by migration minions to the controller for the current migration phase. Returns -> MinionReports ''' # map input types to rpc msg _params = dict() msg = dict(type='MigrationMaster', request='MinionReports', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(MigrationModelInfo) async def ModelInfo(self): ''' ModelInfo returns essential information about the model to be migrated. Returns -> MigrationModelInfo ''' # map input types to rpc msg _params = dict() msg = dict(type='MigrationMaster', request='ModelInfo', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(None) async def Prechecks(self, target_controller_version=None): ''' Prechecks performs pre-migration checks on the model and (source) controller. target_controller_version : Number Returns -> None ''' if target_controller_version is not None and not isinstance(target_controller_version, (dict, Number)): raise Exception("Expected target_controller_version to be a Number, received: {}".format(type(target_controller_version))) # map input types to rpc msg _params = dict() msg = dict(type='MigrationMaster', request='Prechecks', version=3, params=_params) _params['target-controller-version'] = target_controller_version reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(None) async def ProcessRelations(self, controller_alias=None): ''' ProcessRelations processes any relations that need updating after an export. This should help fix any remoteApplications that have been migrated. controller_alias : str Returns -> None ''' if controller_alias is not None and not isinstance(controller_alias, (bytes, str)): raise Exception("Expected controller_alias to be a str, received: {}".format(type(controller_alias))) # map input types to rpc msg _params = dict() msg = dict(type='MigrationMaster', request='ProcessRelations', version=3, params=_params) _params['controller-alias'] = controller_alias reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(None) async def Reap(self): ''' Reap removes all documents for the model associated with the API connection. Returns -> None ''' # map input types to rpc msg _params = dict() msg = dict(type='MigrationMaster', request='Reap', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(None) async def SetPhase(self, phase=None): ''' SetPhase sets the phase of the active model migration. The provided phase must be a valid phase value, for example QUIESCE" or "ABORT". See the core/migration package for the complete list. phase : str Returns -> None ''' if phase is not None and not isinstance(phase, (bytes, str)): raise Exception("Expected phase to be a str, received: {}".format(type(phase))) # map input types to rpc msg _params = dict() msg = dict(type='MigrationMaster', request='SetPhase', version=3, params=_params) _params['phase'] = phase reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(None) async def SetStatusMessage(self, message=None): ''' SetStatusMessage sets a human readable status message containing information about the migration's progress. This will be shown in status output shown to the end user. message : str Returns -> None ''' if message is not None and not isinstance(message, (bytes, str)): raise Exception("Expected message to be a str, received: {}".format(type(message))) # map input types to rpc msg _params = dict() msg = dict(type='MigrationMaster', request='SetStatusMessage', version=3, params=_params) _params['message'] = message reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(MigrationSourceInfo) async def SourceControllerInfo(self): ''' SourceControllerInfo returns the details required to connect to the source controller for model migration. Returns -> MigrationSourceInfo ''' # map input types to rpc msg _params = dict() msg = dict(type='MigrationMaster', request='SourceControllerInfo', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(NotifyWatchResult) async def Watch(self): ''' Watch starts watching for an active migration for the model associated with the API connection. The returned id should be used with the NotifyWatcher facade to receive events. Returns -> NotifyWatchResult ''' # map input types to rpc msg _params = dict() msg = dict(type='MigrationMaster', request='Watch', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(NotifyWatchResult) async def WatchMinionReports(self): ''' WatchMinionReports sets up a watcher which reports when a report for a migration minion has arrived. Returns -> NotifyWatchResult ''' # map input types to rpc msg _params = dict() msg = dict(type='MigrationMaster', request='WatchMinionReports', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs]class ModelConfigFacade(Type): name = 'ModelConfig' version = 3 schema = {'definitions': {'ConfigValue': {'additionalProperties': False, 'properties': {'source': {'type': 'string'}, 'value': {'additionalProperties': True, 'type': 'object'}}, 'required': ['value', 'source'], 'type': 'object'}, 'Error': {'additionalProperties': False, 'properties': {'code': {'type': 'string'}, 'info': {'patternProperties': {'.*': {'additionalProperties': True, 'type': 'object'}}, 'type': 'object'}, 'message': {'type': 'string'}}, 'required': ['message', 'code'], 'type': 'object'}, 'GetConstraintsResults': {'additionalProperties': False, 'properties': {'constraints': {'$ref': '#/definitions/Value'}}, 'required': ['constraints'], 'type': 'object'}, 'ModelConfigResults': {'additionalProperties': False, 'properties': {'config': {'patternProperties': {'.*': {'$ref': '#/definitions/ConfigValue'}}, 'type': 'object'}}, 'required': ['config'], 'type': 'object'}, 'ModelSLA': {'additionalProperties': False, 'properties': {'ModelSLAInfo': {'$ref': '#/definitions/ModelSLAInfo'}, 'creds': {'items': {'type': 'integer'}, 'type': 'array'}, 'level': {'type': 'string'}, 'owner': {'type': 'string'}}, 'required': ['level', 'owner', 'ModelSLAInfo', 'creds'], 'type': 'object'}, 'ModelSLAInfo': {'additionalProperties': False, 'properties': {'level': {'type': 'string'}, 'owner': {'type': 'string'}}, 'required': ['level', 'owner'], 'type': 'object'}, 'ModelSequencesResult': {'additionalProperties': False, 'properties': {'sequences': {'patternProperties': {'.*': {'type': 'integer'}}, 'type': 'object'}}, 'required': ['sequences'], 'type': 'object'}, 'ModelSet': {'additionalProperties': False, 'properties': {'config': {'patternProperties': {'.*': {'additionalProperties': True, 'type': 'object'}}, 'type': 'object'}}, 'required': ['config'], 'type': 'object'}, 'ModelUnset': {'additionalProperties': False, 'properties': {'keys': {'items': {'type': 'string'}, 'type': 'array'}}, 'required': ['keys'], 'type': 'object'}, 'SetConstraints': {'additionalProperties': False, 'properties': {'application': {'type': 'string'}, 'constraints': {'$ref': '#/definitions/Value'}}, 'required': ['application', 'constraints'], 'type': 'object'}, 'StringResult': {'additionalProperties': False, 'properties': {'error': {'$ref': '#/definitions/Error'}, 'result': {'type': 'string'}}, 'required': ['result'], 'type': 'object'}, 'Value': {'additionalProperties': False, 'properties': {'allocate-public-ip': {'type': 'boolean'}, 'arch': {'type': 'string'}, 'container': {'type': 'string'}, 'cores': {'type': 'integer'}, 'cpu-power': {'type': 'integer'}, 'image-id': {'type': 'string'}, 'instance-role': {'type': 'string'}, 'instance-type': {'type': 'string'}, 'mem': {'type': 'integer'}, 'root-disk': {'type': 'integer'}, 'root-disk-source': {'type': 'string'}, 'spaces': {'items': {'type': 'string'}, 'type': 'array'}, 'tags': {'items': {'type': 'string'}, 'type': 'array'}, 'virt-type': {'type': 'string'}, 'zones': {'items': {'type': 'string'}, 'type': 'array'}}, 'type': 'object'}}, 'properties': {'GetModelConstraints': {'description': 'GetModelConstraints ' 'returns the ' 'constraints for the ' 'model.', 'properties': {'Result': {'$ref': '#/definitions/GetConstraintsResults'}}, 'type': 'object'}, 'ModelGet': {'description': 'ModelGet implements the ' 'server-side part of the\n' 'model-config CLI command.', 'properties': {'Result': {'$ref': '#/definitions/ModelConfigResults'}}, 'type': 'object'}, 'ModelSet': {'description': 'ModelSet implements the ' 'server-side part of the\n' 'set-model-config CLI command.', 'properties': {'Params': {'$ref': '#/definitions/ModelSet'}}, 'type': 'object'}, 'ModelUnset': {'description': 'ModelUnset implements the ' 'server-side part of the\n' 'set-model-config CLI command.', 'properties': {'Params': {'$ref': '#/definitions/ModelUnset'}}, 'type': 'object'}, 'SLALevel': {'description': 'SLALevel returns the current sla ' 'level for the model.', 'properties': {'Result': {'$ref': '#/definitions/StringResult'}}, 'type': 'object'}, 'Sequences': {'description': "Sequences returns the model's " 'sequence names and next values.', 'properties': {'Result': {'$ref': '#/definitions/ModelSequencesResult'}}, 'type': 'object'}, 'SetModelConstraints': {'description': 'SetModelConstraints ' 'sets the constraints ' 'for the model.', 'properties': {'Params': {'$ref': '#/definitions/SetConstraints'}}, 'type': 'object'}, 'SetSLALevel': {'description': 'SetSLALevel sets the sla level ' 'on the model.', 'properties': {'Params': {'$ref': '#/definitions/ModelSLA'}}, 'type': 'object'}}, 'type': 'object'}
[docs] @ReturnMapping(GetConstraintsResults) async def GetModelConstraints(self): ''' GetModelConstraints returns the constraints for the model. Returns -> GetConstraintsResults ''' # map input types to rpc msg _params = dict() msg = dict(type='ModelConfig', request='GetModelConstraints', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(ModelConfigResults) async def ModelGet(self): ''' ModelGet implements the server-side part of the model-config CLI command. Returns -> ModelConfigResults ''' # map input types to rpc msg _params = dict() msg = dict(type='ModelConfig', request='ModelGet', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(None) async def ModelSet(self, config=None): ''' ModelSet implements the server-side part of the set-model-config CLI command. config : typing.Mapping[str, typing.Any] Returns -> None ''' if config is not None and not isinstance(config, dict): raise Exception("Expected config to be a Mapping, received: {}".format(type(config))) # map input types to rpc msg _params = dict() msg = dict(type='ModelConfig', request='ModelSet', version=3, params=_params) _params['config'] = config reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(None) async def ModelUnset(self, keys=None): ''' ModelUnset implements the server-side part of the set-model-config CLI command. keys : typing.Sequence[str] Returns -> None ''' if keys is not None and not isinstance(keys, (bytes, str, list)): raise Exception("Expected keys to be a Sequence, received: {}".format(type(keys))) # map input types to rpc msg _params = dict() msg = dict(type='ModelConfig', request='ModelUnset', version=3, params=_params) _params['keys'] = keys reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(StringResult) async def SLALevel(self): ''' SLALevel returns the current sla level for the model. Returns -> StringResult ''' # map input types to rpc msg _params = dict() msg = dict(type='ModelConfig', request='SLALevel', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(ModelSequencesResult) async def Sequences(self): ''' Sequences returns the model's sequence names and next values. Returns -> ModelSequencesResult ''' # map input types to rpc msg _params = dict() msg = dict(type='ModelConfig', request='Sequences', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(None) async def SetModelConstraints(self, application=None, constraints=None): ''' SetModelConstraints sets the constraints for the model. application : str constraints : Value Returns -> None ''' if application is not None and not isinstance(application, (bytes, str)): raise Exception("Expected application to be a str, received: {}".format(type(application))) if constraints is not None and not isinstance(constraints, (dict, Value)): raise Exception("Expected constraints to be a Value, received: {}".format(type(constraints))) # map input types to rpc msg _params = dict() msg = dict(type='ModelConfig', request='SetModelConstraints', version=3, params=_params) _params['application'] = application _params['constraints'] = constraints reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(None) async def SetSLALevel(self, modelslainfo=None, creds=None, level=None, owner=None): ''' SetSLALevel sets the sla level on the model. modelslainfo : ModelSLAInfo creds : typing.Sequence[int] level : str owner : str Returns -> None ''' if modelslainfo is not None and not isinstance(modelslainfo, (dict, ModelSLAInfo)): raise Exception("Expected modelslainfo to be a ModelSLAInfo, received: {}".format(type(modelslainfo))) if creds is not None and not isinstance(creds, (bytes, str, list)): raise Exception("Expected creds to be a Sequence, received: {}".format(type(creds))) if level is not None and not isinstance(level, (bytes, str)): raise Exception("Expected level to be a str, received: {}".format(type(level))) if owner is not None and not isinstance(owner, (bytes, str)): raise Exception("Expected owner to be a str, received: {}".format(type(owner))) # map input types to rpc msg _params = dict() msg = dict(type='ModelConfig', request='SetSLALevel', version=3, params=_params) _params['ModelSLAInfo'] = modelslainfo _params['creds'] = creds _params['level'] = level _params['owner'] = owner reply = await self.rpc(msg) return reply
[docs]class ResourcesFacade(Type): name = 'Resources' version = 3 schema = {'definitions': {'AddPendingResourcesArgsV2': {'additionalProperties': False, 'properties': {'Entity': {'$ref': '#/definitions/Entity'}, 'charm-origin': {'$ref': '#/definitions/CharmOrigin'}, 'macaroon': {'$ref': '#/definitions/Macaroon'}, 'resources': {'items': {'$ref': '#/definitions/CharmResource'}, 'type': 'array'}, 'tag': {'type': 'string'}, 'url': {'type': 'string'}}, 'required': ['tag', 'Entity', 'url', 'charm-origin', 'macaroon', 'resources'], 'type': 'object'}, 'AddPendingResourcesResult': {'additionalProperties': False, 'properties': {'ErrorResult': {'$ref': '#/definitions/ErrorResult'}, 'error': {'$ref': '#/definitions/Error'}, 'pending-ids': {'items': {'type': 'string'}, 'type': 'array'}}, 'required': ['ErrorResult', 'pending-ids'], 'type': 'object'}, 'Base': {'additionalProperties': False, 'properties': {'channel': {'type': 'string'}, 'name': {'type': 'string'}}, 'required': ['name', 'channel'], 'type': 'object'}, 'CharmOrigin': {'additionalProperties': False, 'properties': {'architecture': {'type': 'string'}, 'base': {'$ref': '#/definitions/Base'}, 'branch': {'type': 'string'}, 'hash': {'type': 'string'}, 'id': {'type': 'string'}, 'instance-key': {'type': 'string'}, 'revision': {'type': 'integer'}, 'risk': {'type': 'string'}, 'source': {'type': 'string'}, 'track': {'type': 'string'}, 'type': {'type': 'string'}}, 'required': ['source', 'type', 'id'], 'type': 'object'}, 'CharmResource': {'additionalProperties': False, 'properties': {'description': {'type': 'string'}, 'fingerprint': {'items': {'type': 'integer'}, 'type': 'array'}, 'name': {'type': 'string'}, 'origin': {'type': 'string'}, 'path': {'type': 'string'}, 'revision': {'type': 'integer'}, 'size': {'type': 'integer'}, 'type': {'type': 'string'}}, 'required': ['name', 'type', 'path', 'origin', 'revision', 'fingerprint', 'size'], 'type': 'object'}, 'Entity': {'additionalProperties': False, 'properties': {'tag': {'type': 'string'}}, 'required': ['tag'], 'type': 'object'}, 'Error': {'additionalProperties': False, 'properties': {'code': {'type': 'string'}, 'info': {'patternProperties': {'.*': {'additionalProperties': True, 'type': 'object'}}, 'type': 'object'}, 'message': {'type': 'string'}}, 'required': ['message', 'code'], 'type': 'object'}, 'ErrorResult': {'additionalProperties': False, 'properties': {'error': {'$ref': '#/definitions/Error'}}, 'type': 'object'}, 'ListResourcesArgs': {'additionalProperties': False, 'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'}, 'type': 'array'}}, 'required': ['entities'], 'type': 'object'}, 'Macaroon': {'additionalProperties': False, 'type': 'object'}, 'Resource': {'additionalProperties': False, 'properties': {'CharmResource': {'$ref': '#/definitions/CharmResource'}, 'application': {'type': 'string'}, 'description': {'type': 'string'}, 'fingerprint': {'items': {'type': 'integer'}, 'type': 'array'}, 'id': {'type': 'string'}, 'name': {'type': 'string'}, 'origin': {'type': 'string'}, 'path': {'type': 'string'}, 'pending-id': {'type': 'string'}, 'revision': {'type': 'integer'}, 'size': {'type': 'integer'}, 'timestamp': {'format': 'date-time', 'type': 'string'}, 'type': {'type': 'string'}, 'username': {'type': 'string'}}, 'required': ['name', 'type', 'path', 'origin', 'revision', 'fingerprint', 'size', 'CharmResource', 'id', 'pending-id', 'application', 'username', 'timestamp'], 'type': 'object'}, 'ResourcesResult': {'additionalProperties': False, 'properties': {'ErrorResult': {'$ref': '#/definitions/ErrorResult'}, 'charm-store-resources': {'items': {'$ref': '#/definitions/CharmResource'}, 'type': 'array'}, 'error': {'$ref': '#/definitions/Error'}, 'resources': {'items': {'$ref': '#/definitions/Resource'}, 'type': 'array'}, 'unit-resources': {'items': {'$ref': '#/definitions/UnitResources'}, 'type': 'array'}}, 'required': ['ErrorResult', 'resources', 'charm-store-resources', 'unit-resources'], 'type': 'object'}, 'ResourcesResults': {'additionalProperties': False, 'properties': {'results': {'items': {'$ref': '#/definitions/ResourcesResult'}, 'type': 'array'}}, 'required': ['results'], 'type': 'object'}, 'UnitResources': {'additionalProperties': False, 'properties': {'Entity': {'$ref': '#/definitions/Entity'}, 'download-progress': {'patternProperties': {'.*': {'type': 'integer'}}, 'type': 'object'}, 'resources': {'items': {'$ref': '#/definitions/Resource'}, 'type': 'array'}, 'tag': {'type': 'string'}}, 'required': ['tag', 'Entity', 'resources', 'download-progress'], 'type': 'object'}}, 'properties': {'AddPendingResources': {'description': 'AddPendingResources ' 'adds the provided ' 'resources (info) to ' 'the Juju\n' 'model in a pending ' 'state, meaning they ' 'are not available ' 'until\n' 'resolved. Handles ' 'CharmHub and Local ' 'charms.', 'properties': {'Params': {'$ref': '#/definitions/AddPendingResourcesArgsV2'}, 'Result': {'$ref': '#/definitions/AddPendingResourcesResult'}}, 'type': 'object'}, 'ListResources': {'description': 'ListResources returns the ' 'list of resources for the ' 'given application.', 'properties': {'Params': {'$ref': '#/definitions/ListResourcesArgs'}, 'Result': {'$ref': '#/definitions/ResourcesResults'}}, 'type': 'object'}}, 'type': 'object'} @ReturnMapping(AddPendingResourcesResult) async def AddPendingResources(self, entity=None, charm_origin=None, macaroon=None, resources=None, tag=None, url=None): ''' AddPendingResources adds the provided resources (info) to the Juju model in a pending state, meaning they are not available until resolved. Handles CharmHub and Local charms. entity : Entity charm_origin : CharmOrigin macaroon : Macaroon resources : typing.Sequence[~CharmResource] tag : str url : str Returns -> AddPendingResourcesResult ''' if entity is not None and not isinstance(entity, (dict, Entity)): raise Exception("Expected entity to be a Entity, received: {}".format(type(entity))) if charm_origin is not None and not isinstance(charm_origin, (dict, CharmOrigin)): raise Exception("Expected charm_origin to be a CharmOrigin, received: {}".format(type(charm_origin))) if macaroon is not None and not isinstance(macaroon, (dict, Macaroon)): raise Exception("Expected macaroon to be a Macaroon, received: {}".format(type(macaroon))) if resources is not None and not isinstance(resources, (bytes, str, list)): raise Exception("Expected resources to be a Sequence, received: {}".format(type(resources))) if tag is not None and not isinstance(tag, (bytes, str)): raise Exception("Expected tag to be a str, received: {}".format(type(tag))) if url is not None and not isinstance(url, (bytes, str)): raise Exception("Expected url to be a str, received: {}".format(type(url))) # map input types to rpc msg _params = dict() msg = dict(type='Resources', request='AddPendingResources', version=3, params=_params) _params['Entity'] = entity _params['charm-origin'] = charm_origin _params['macaroon'] = macaroon _params['resources'] = resources _params['tag'] = tag _params['url'] = url reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(ResourcesResults) async def ListResources(self, entities=None): ''' ListResources returns the list of resources for the given application. entities : typing.Sequence[~Entity] Returns -> ResourcesResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) # map input types to rpc msg _params = dict() msg = dict(type='Resources', request='ListResources', version=3, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply
[docs]class UpgradeSeriesFacade(Type): name = 'UpgradeSeries' version = 3 schema = {'definitions': {'Entities': {'additionalProperties': False, 'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'}, 'type': 'array'}}, 'required': ['entities'], 'type': 'object'}, 'EntitiesResult': {'additionalProperties': False, 'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'}, 'type': 'array'}, 'error': {'$ref': '#/definitions/Error'}}, 'required': ['entities'], 'type': 'object'}, 'EntitiesResults': {'additionalProperties': False, 'properties': {'results': {'items': {'$ref': '#/definitions/EntitiesResult'}, 'type': 'array'}}, 'required': ['results'], 'type': 'object'}, 'Entity': {'additionalProperties': False, 'properties': {'tag': {'type': 'string'}}, 'required': ['tag'], 'type': 'object'}, 'EntityStatusArgs': {'additionalProperties': False, 'properties': {'data': {'patternProperties': {'.*': {'additionalProperties': True, 'type': 'object'}}, 'type': 'object'}, 'info': {'type': 'string'}, 'status': {'type': 'string'}, 'tag': {'type': 'string'}}, 'required': ['tag', 'status', 'info', 'data'], 'type': 'object'}, 'Error': {'additionalProperties': False, 'properties': {'code': {'type': 'string'}, 'info': {'patternProperties': {'.*': {'additionalProperties': True, 'type': 'object'}}, 'type': 'object'}, 'message': {'type': 'string'}}, 'required': ['message', 'code'], 'type': 'object'}, 'ErrorResult': {'additionalProperties': False, 'properties': {'error': {'$ref': '#/definitions/Error'}}, 'type': 'object'}, 'ErrorResults': {'additionalProperties': False, 'properties': {'results': {'items': {'$ref': '#/definitions/ErrorResult'}, 'type': 'array'}}, 'required': ['results'], 'type': 'object'}, 'NotifyWatchResult': {'additionalProperties': False, 'properties': {'NotifyWatcherId': {'type': 'string'}, 'error': {'$ref': '#/definitions/Error'}}, 'required': ['NotifyWatcherId'], 'type': 'object'}, 'NotifyWatchResults': {'additionalProperties': False, 'properties': {'results': {'items': {'$ref': '#/definitions/NotifyWatchResult'}, 'type': 'array'}}, 'required': ['results'], 'type': 'object'}, 'PinApplicationResult': {'additionalProperties': False, 'properties': {'application-name': {'type': 'string'}, 'error': {'$ref': '#/definitions/Error'}}, 'required': ['application-name'], 'type': 'object'}, 'PinApplicationsResults': {'additionalProperties': False, 'properties': {'results': {'items': {'$ref': '#/definitions/PinApplicationResult'}, 'type': 'array'}}, 'required': ['results'], 'type': 'object'}, 'PinnedLeadershipResult': {'additionalProperties': False, 'properties': {'error': {'$ref': '#/definitions/Error'}, 'result': {'patternProperties': {'.*': {'items': {'type': 'string'}, 'type': 'array'}}, 'type': 'object'}}, 'type': 'object'}, 'SetStatus': {'additionalProperties': False, 'properties': {'entities': {'items': {'$ref': '#/definitions/EntityStatusArgs'}, 'type': 'array'}}, 'required': ['entities'], 'type': 'object'}, 'StringResult': {'additionalProperties': False, 'properties': {'error': {'$ref': '#/definitions/Error'}, 'result': {'type': 'string'}}, 'required': ['result'], 'type': 'object'}, 'StringResults': {'additionalProperties': False, 'properties': {'results': {'items': {'$ref': '#/definitions/StringResult'}, 'type': 'array'}}, 'required': ['results'], 'type': 'object'}, 'UpdateChannelArg': {'additionalProperties': False, 'properties': {'channel': {'type': 'string'}, 'force': {'type': 'boolean'}, 'tag': {'$ref': '#/definitions/Entity'}}, 'required': ['tag', 'force', 'channel'], 'type': 'object'}, 'UpdateChannelArgs': {'additionalProperties': False, 'properties': {'args': {'items': {'$ref': '#/definitions/UpdateChannelArg'}, 'type': 'array'}}, 'required': ['args'], 'type': 'object'}, 'UpgradeSeriesStartUnitCompletionParam': {'additionalProperties': False, 'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'}, 'type': 'array'}, 'message': {'type': 'string'}}, 'required': ['entities', 'message'], 'type': 'object'}, 'UpgradeSeriesStatusParam': {'additionalProperties': False, 'properties': {'entity': {'$ref': '#/definitions/Entity'}, 'message': {'type': 'string'}, 'status': {'type': 'string'}}, 'required': ['entity', 'status', 'message'], 'type': 'object'}, 'UpgradeSeriesStatusParams': {'additionalProperties': False, 'properties': {'params': {'items': {'$ref': '#/definitions/UpgradeSeriesStatusParam'}, 'type': 'array'}}, 'required': ['params'], 'type': 'object'}, 'UpgradeSeriesStatusResult': {'additionalProperties': False, 'properties': {'error': {'$ref': '#/definitions/Error'}, 'status': {'type': 'string'}, 'target': {'type': 'string'}}, 'type': 'object'}, 'UpgradeSeriesStatusResults': {'additionalProperties': False, 'properties': {'results': {'items': {'$ref': '#/definitions/UpgradeSeriesStatusResult'}, 'type': 'array'}}, 'type': 'object'}}, 'properties': {'CurrentSeries': {'description': 'CurrentSeries returns what ' 'Juju thinks the current ' 'series of the machine is.\n' 'Note that a machine could ' 'have been upgraded ' 'out-of-band by running\n' 'do-release-upgrade outside ' 'of the upgrade-machine ' 'workflow,\n' 'making this value incorrect.', 'properties': {'Params': {'$ref': '#/definitions/Entities'}, 'Result': {'$ref': '#/definitions/StringResults'}}, 'type': 'object'}, 'FinishUpgradeSeries': {'description': 'FinishUpgradeSeries is ' 'the last action in the ' 'upgrade workflow and ' 'is\n' 'called after all ' 'machine and unit ' 'statuses are ' '"completed".\n' 'It updates the machine ' 'series to reflect the ' 'completed upgrade, ' 'then\n' 'removes the ' 'upgrade-machine lock.', 'properties': {'Params': {'$ref': '#/definitions/UpdateChannelArgs'}, 'Result': {'$ref': '#/definitions/ErrorResults'}}, 'type': 'object'}, 'MachineStatus': {'description': 'MachineStatus gets the ' 'current upgrade-machine ' 'status of a machine.', 'properties': {'Params': {'$ref': '#/definitions/Entities'}, 'Result': {'$ref': '#/definitions/UpgradeSeriesStatusResults'}}, 'type': 'object'}, 'PinMachineApplications': {'description': 'PinMachineApplications ' 'pins leadership for ' 'applications ' 'represented by ' 'units\n' 'running on the ' "auth'd machine.", 'properties': {'Result': {'$ref': '#/definitions/PinApplicationsResults'}}, 'type': 'object'}, 'PinnedLeadership': {'description': 'PinnedLeadership returns ' 'all pinned applications ' 'and the entities that\n' 'require their pinned ' 'behaviour, for leadership ' 'in the current model.', 'properties': {'Result': {'$ref': '#/definitions/PinnedLeadershipResult'}}, 'type': 'object'}, 'SetInstanceStatus': {'description': 'SetInstanceStatus sets ' 'the status of the ' 'machine.', 'properties': {'Params': {'$ref': '#/definitions/SetStatus'}, 'Result': {'$ref': '#/definitions/ErrorResults'}}, 'type': 'object'}, 'SetMachineStatus': {'description': 'SetMachineStatus sets the ' 'current upgrade-machine ' 'status of a machine.', 'properties': {'Params': {'$ref': '#/definitions/UpgradeSeriesStatusParams'}, 'Result': {'$ref': '#/definitions/ErrorResults'}}, 'type': 'object'}, 'SetUpgradeSeriesUnitStatus': {'description': 'SetUpgradeSeriesUnitStatus ' 'sets the ' 'upgrade series ' 'status of the ' 'unit.\n' 'If no upgrade ' 'is in progress ' 'an error is ' 'returned ' 'instead.', 'properties': {'Params': {'$ref': '#/definitions/UpgradeSeriesStatusParams'}, 'Result': {'$ref': '#/definitions/ErrorResults'}}, 'type': 'object'}, 'StartUnitCompletion': {'description': 'StartUnitCompletion ' 'starts the upgrade ' 'series completion ' 'phase for all ' 'subordinate\n' 'units of a given ' 'machine.', 'properties': {'Params': {'$ref': '#/definitions/UpgradeSeriesStartUnitCompletionParam'}, 'Result': {'$ref': '#/definitions/ErrorResults'}}, 'type': 'object'}, 'TargetSeries': {'description': 'TargetSeries returns the ' 'series that a machine has ' 'been locked\n' 'for upgrading to.', 'properties': {'Params': {'$ref': '#/definitions/Entities'}, 'Result': {'$ref': '#/definitions/StringResults'}}, 'type': 'object'}, 'UnitsCompleted': {'description': 'UnitsCompleted returns the ' 'units running on this ' 'machine that have ' 'completed\n' 'the upgrade-machine ' 'workflow and are in their ' 'normal running state.', 'properties': {'Params': {'$ref': '#/definitions/Entities'}, 'Result': {'$ref': '#/definitions/EntitiesResults'}}, 'type': 'object'}, 'UnitsPrepared': {'description': 'UnitsPrepared returns the ' 'units running on this ' 'machine that have completed\n' 'their upgrade-machine ' 'preparation, and are ready ' 'to be stopped and have ' 'their\n' 'unit agent services ' 'converted for the target ' 'series.', 'properties': {'Params': {'$ref': '#/definitions/Entities'}, 'Result': {'$ref': '#/definitions/EntitiesResults'}}, 'type': 'object'}, 'UnpinMachineApplications': {'description': 'UnpinMachineApplications ' 'unpins leadership ' 'for applications ' 'represented by\n' 'units running on ' "the auth'd " 'machine.', 'properties': {'Result': {'$ref': '#/definitions/PinApplicationsResults'}}, 'type': 'object'}, 'UpgradeSeriesUnitStatus': {'description': 'UpgradeSeriesUnitStatus ' 'returns the ' 'current ' 'preparation status ' 'of an\n' 'upgrading unit.\n' 'If no series ' 'upgrade is in ' 'progress an error ' 'is returned ' 'instead.', 'properties': {'Params': {'$ref': '#/definitions/Entities'}, 'Result': {'$ref': '#/definitions/UpgradeSeriesStatusResults'}}, 'type': 'object'}, 'WatchUpgradeSeriesNotifications': {'description': 'WatchUpgradeSeriesNotifications ' 'returns a ' 'NotifyWatcher ' 'for ' 'observing ' 'changes to ' 'upgrade ' 'series ' 'locks.', 'properties': {'Params': {'$ref': '#/definitions/Entities'}, 'Result': {'$ref': '#/definitions/NotifyWatchResults'}}, 'type': 'object'}}, 'type': 'object'}
[docs] @ReturnMapping(StringResults) async def CurrentSeries(self, entities=None): ''' CurrentSeries returns what Juju thinks the current series of the machine is. Note that a machine could have been upgraded out-of-band by running do-release-upgrade outside of the upgrade-machine workflow, making this value incorrect. entities : typing.Sequence[~Entity] Returns -> StringResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) # map input types to rpc msg _params = dict() msg = dict(type='UpgradeSeries', request='CurrentSeries', version=3, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(ErrorResults) async def FinishUpgradeSeries(self, args=None): ''' FinishUpgradeSeries is the last action in the upgrade workflow and is called after all machine and unit statuses are "completed". It updates the machine series to reflect the completed upgrade, then removes the upgrade-machine lock. args : typing.Sequence[~UpdateChannelArg] Returns -> ErrorResults ''' if args is not None and not isinstance(args, (bytes, str, list)): raise Exception("Expected args to be a Sequence, received: {}".format(type(args))) # map input types to rpc msg _params = dict() msg = dict(type='UpgradeSeries', request='FinishUpgradeSeries', version=3, params=_params) _params['args'] = args reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(UpgradeSeriesStatusResults) async def MachineStatus(self, entities=None): ''' MachineStatus gets the current upgrade-machine status of a machine. entities : typing.Sequence[~Entity] Returns -> UpgradeSeriesStatusResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) # map input types to rpc msg _params = dict() msg = dict(type='UpgradeSeries', request='MachineStatus', version=3, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(PinApplicationsResults) async def PinMachineApplications(self): ''' PinMachineApplications pins leadership for applications represented by units running on the auth'd machine. Returns -> PinApplicationsResults ''' # map input types to rpc msg _params = dict() msg = dict(type='UpgradeSeries', request='PinMachineApplications', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(PinnedLeadershipResult) async def PinnedLeadership(self): ''' PinnedLeadership returns all pinned applications and the entities that require their pinned behaviour, for leadership in the current model. Returns -> PinnedLeadershipResult ''' # map input types to rpc msg _params = dict() msg = dict(type='UpgradeSeries', request='PinnedLeadership', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(ErrorResults) async def SetInstanceStatus(self, entities=None): ''' SetInstanceStatus sets the status of the machine. entities : typing.Sequence[~EntityStatusArgs] Returns -> ErrorResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) # map input types to rpc msg _params = dict() msg = dict(type='UpgradeSeries', request='SetInstanceStatus', version=3, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(ErrorResults) async def SetMachineStatus(self, params=None): ''' SetMachineStatus sets the current upgrade-machine status of a machine. params : typing.Sequence[~UpgradeSeriesStatusParam] Returns -> ErrorResults ''' if params is not None and not isinstance(params, (bytes, str, list)): raise Exception("Expected params to be a Sequence, received: {}".format(type(params))) # map input types to rpc msg _params = dict() msg = dict(type='UpgradeSeries', request='SetMachineStatus', version=3, params=_params) _params['params'] = params reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(ErrorResults) async def SetUpgradeSeriesUnitStatus(self, params=None): ''' SetUpgradeSeriesUnitStatus sets the upgrade series status of the unit. If no upgrade is in progress an error is returned instead. params : typing.Sequence[~UpgradeSeriesStatusParam] Returns -> ErrorResults ''' if params is not None and not isinstance(params, (bytes, str, list)): raise Exception("Expected params to be a Sequence, received: {}".format(type(params))) # map input types to rpc msg _params = dict() msg = dict(type='UpgradeSeries', request='SetUpgradeSeriesUnitStatus', version=3, params=_params) _params['params'] = params reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(ErrorResults) async def StartUnitCompletion(self, entities=None, message=None): ''' StartUnitCompletion starts the upgrade series completion phase for all subordinate units of a given machine. entities : typing.Sequence[~Entity] message : str Returns -> ErrorResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) if message is not None and not isinstance(message, (bytes, str)): raise Exception("Expected message to be a str, received: {}".format(type(message))) # map input types to rpc msg _params = dict() msg = dict(type='UpgradeSeries', request='StartUnitCompletion', version=3, params=_params) _params['entities'] = entities _params['message'] = message reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(StringResults) async def TargetSeries(self, entities=None): ''' TargetSeries returns the series that a machine has been locked for upgrading to. entities : typing.Sequence[~Entity] Returns -> StringResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) # map input types to rpc msg _params = dict() msg = dict(type='UpgradeSeries', request='TargetSeries', version=3, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(EntitiesResults) async def UnitsCompleted(self, entities=None): ''' UnitsCompleted returns the units running on this machine that have completed the upgrade-machine workflow and are in their normal running state. entities : typing.Sequence[~Entity] Returns -> EntitiesResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) # map input types to rpc msg _params = dict() msg = dict(type='UpgradeSeries', request='UnitsCompleted', version=3, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(EntitiesResults) async def UnitsPrepared(self, entities=None): ''' UnitsPrepared returns the units running on this machine that have completed their upgrade-machine preparation, and are ready to be stopped and have their unit agent services converted for the target series. entities : typing.Sequence[~Entity] Returns -> EntitiesResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) # map input types to rpc msg _params = dict() msg = dict(type='UpgradeSeries', request='UnitsPrepared', version=3, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(PinApplicationsResults) async def UnpinMachineApplications(self): ''' UnpinMachineApplications unpins leadership for applications represented by units running on the auth'd machine. Returns -> PinApplicationsResults ''' # map input types to rpc msg _params = dict() msg = dict(type='UpgradeSeries', request='UnpinMachineApplications', version=3, params=_params) reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(UpgradeSeriesStatusResults) async def UpgradeSeriesUnitStatus(self, entities=None): ''' UpgradeSeriesUnitStatus returns the current preparation status of an upgrading unit. If no series upgrade is in progress an error is returned instead. entities : typing.Sequence[~Entity] Returns -> UpgradeSeriesStatusResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) # map input types to rpc msg _params = dict() msg = dict(type='UpgradeSeries', request='UpgradeSeriesUnitStatus', version=3, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(NotifyWatchResults) async def WatchUpgradeSeriesNotifications(self, entities=None): ''' WatchUpgradeSeriesNotifications returns a NotifyWatcher for observing changes to upgrade series locks. entities : typing.Sequence[~Entity] Returns -> NotifyWatchResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) # map input types to rpc msg _params = dict() msg = dict(type='UpgradeSeries', request='WatchUpgradeSeriesNotifications', version=3, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply
[docs]class UserManagerFacade(Type): name = 'UserManager' version = 3 schema = {'definitions': {'AddUser': {'additionalProperties': False, 'properties': {'display-name': {'type': 'string'}, 'password': {'type': 'string'}, 'username': {'type': 'string'}}, 'required': ['username', 'display-name'], 'type': 'object'}, 'AddUserResult': {'additionalProperties': False, 'properties': {'error': {'$ref': '#/definitions/Error'}, 'secret-key': {'items': {'type': 'integer'}, 'type': 'array'}, 'tag': {'type': 'string'}}, 'type': 'object'}, 'AddUserResults': {'additionalProperties': False, 'properties': {'results': {'items': {'$ref': '#/definitions/AddUserResult'}, 'type': 'array'}}, 'required': ['results'], 'type': 'object'}, 'AddUsers': {'additionalProperties': False, 'properties': {'users': {'items': {'$ref': '#/definitions/AddUser'}, 'type': 'array'}}, 'required': ['users'], 'type': 'object'}, 'Entities': {'additionalProperties': False, 'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'}, 'type': 'array'}}, 'required': ['entities'], 'type': 'object'}, 'Entity': {'additionalProperties': False, 'properties': {'tag': {'type': 'string'}}, 'required': ['tag'], 'type': 'object'}, 'EntityPassword': {'additionalProperties': False, 'properties': {'password': {'type': 'string'}, 'tag': {'type': 'string'}}, 'required': ['tag', 'password'], 'type': 'object'}, 'EntityPasswords': {'additionalProperties': False, 'properties': {'changes': {'items': {'$ref': '#/definitions/EntityPassword'}, 'type': 'array'}}, 'required': ['changes'], 'type': 'object'}, 'Error': {'additionalProperties': False, 'properties': {'code': {'type': 'string'}, 'info': {'patternProperties': {'.*': {'additionalProperties': True, 'type': 'object'}}, 'type': 'object'}, 'message': {'type': 'string'}}, 'required': ['message', 'code'], 'type': 'object'}, 'ErrorResult': {'additionalProperties': False, 'properties': {'error': {'$ref': '#/definitions/Error'}}, 'type': 'object'}, 'ErrorResults': {'additionalProperties': False, 'properties': {'results': {'items': {'$ref': '#/definitions/ErrorResult'}, 'type': 'array'}}, 'required': ['results'], 'type': 'object'}, 'ModelUserInfo': {'additionalProperties': False, 'properties': {'access': {'type': 'string'}, 'display-name': {'type': 'string'}, 'last-connection': {'format': 'date-time', 'type': 'string'}, 'model-tag': {'type': 'string'}, 'user': {'type': 'string'}}, 'required': ['model-tag', 'user', 'display-name', 'last-connection', 'access'], 'type': 'object'}, 'ModelUserInfoResult': {'additionalProperties': False, 'properties': {'error': {'$ref': '#/definitions/Error'}, 'result': {'$ref': '#/definitions/ModelUserInfo'}}, 'type': 'object'}, 'ModelUserInfoResults': {'additionalProperties': False, 'properties': {'results': {'items': {'$ref': '#/definitions/ModelUserInfoResult'}, 'type': 'array'}}, 'required': ['results'], 'type': 'object'}, 'UserInfo': {'additionalProperties': False, 'properties': {'access': {'type': 'string'}, 'created-by': {'type': 'string'}, 'date-created': {'format': 'date-time', 'type': 'string'}, 'disabled': {'type': 'boolean'}, 'display-name': {'type': 'string'}, 'last-connection': {'format': 'date-time', 'type': 'string'}, 'username': {'type': 'string'}}, 'required': ['username', 'display-name', 'access', 'created-by', 'date-created', 'disabled'], 'type': 'object'}, 'UserInfoRequest': {'additionalProperties': False, 'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'}, 'type': 'array'}, 'include-disabled': {'type': 'boolean'}}, 'required': ['entities', 'include-disabled'], 'type': 'object'}, 'UserInfoResult': {'additionalProperties': False, 'properties': {'error': {'$ref': '#/definitions/Error'}, 'result': {'$ref': '#/definitions/UserInfo'}}, 'type': 'object'}, 'UserInfoResults': {'additionalProperties': False, 'properties': {'results': {'items': {'$ref': '#/definitions/UserInfoResult'}, 'type': 'array'}}, 'required': ['results'], 'type': 'object'}}, 'properties': {'AddUser': {'description': 'AddUser adds a user with a ' 'username, and either a password ' 'or\n' 'a randomly generated secret key ' 'which will be returned.', 'properties': {'Params': {'$ref': '#/definitions/AddUsers'}, 'Result': {'$ref': '#/definitions/AddUserResults'}}, 'type': 'object'}, 'DisableUser': {'description': 'DisableUser disables one or ' 'more users. If the user is ' 'already disabled,\n' 'the action is considered a ' 'success.', 'properties': {'Params': {'$ref': '#/definitions/Entities'}, 'Result': {'$ref': '#/definitions/ErrorResults'}}, 'type': 'object'}, 'EnableUser': {'description': 'EnableUser enables one or more ' 'users. If the user is already ' 'enabled,\n' 'the action is considered a ' 'success.', 'properties': {'Params': {'$ref': '#/definitions/Entities'}, 'Result': {'$ref': '#/definitions/ErrorResults'}}, 'type': 'object'}, 'ModelUserInfo': {'description': 'ModelUserInfo returns ' 'information on all users in ' 'the model.', 'properties': {'Params': {'$ref': '#/definitions/Entities'}, 'Result': {'$ref': '#/definitions/ModelUserInfoResults'}}, 'type': 'object'}, 'RemoveUser': {'description': 'RemoveUser permanently removes ' 'a user from the current ' 'controller for each\n' 'entity provided. While the user ' 'is permanently removed we keep ' "it's\n" 'information around for auditing ' 'purposes.\n' 'TODO(redir): Add information ' 'about getting deleted user ' 'information when we\n' 'add that capability.', 'properties': {'Params': {'$ref': '#/definitions/Entities'}, 'Result': {'$ref': '#/definitions/ErrorResults'}}, 'type': 'object'}, 'ResetPassword': {'description': 'ResetPassword resets ' 'password for supplied users ' 'by\n' 'invalidating current ' 'passwords (if any) and ' 'generating\n' 'new random secret keys which ' 'will be returned.\n' 'Users cannot reset their own ' 'password.', 'properties': {'Params': {'$ref': '#/definitions/Entities'}, 'Result': {'$ref': '#/definitions/AddUserResults'}}, 'type': 'object'}, 'SetPassword': {'description': 'SetPassword changes the stored ' 'password for the specified ' 'users.', 'properties': {'Params': {'$ref': '#/definitions/EntityPasswords'}, 'Result': {'$ref': '#/definitions/ErrorResults'}}, 'type': 'object'}, 'UserInfo': {'description': 'UserInfo returns information on a ' 'user.', 'properties': {'Params': {'$ref': '#/definitions/UserInfoRequest'}, 'Result': {'$ref': '#/definitions/UserInfoResults'}}, 'type': 'object'}}, 'type': 'object'}
[docs] @ReturnMapping(AddUserResults) async def AddUser(self, users=None): ''' AddUser adds a user with a username, and either a password or a randomly generated secret key which will be returned. users : typing.Sequence[~AddUser] Returns -> AddUserResults ''' if users is not None and not isinstance(users, (bytes, str, list)): raise Exception("Expected users to be a Sequence, received: {}".format(type(users))) # map input types to rpc msg _params = dict() msg = dict(type='UserManager', request='AddUser', version=3, params=_params) _params['users'] = users reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(ErrorResults) async def DisableUser(self, entities=None): ''' DisableUser disables one or more users. If the user is already disabled, the action is considered a success. entities : typing.Sequence[~Entity] Returns -> ErrorResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) # map input types to rpc msg _params = dict() msg = dict(type='UserManager', request='DisableUser', version=3, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(ErrorResults) async def EnableUser(self, entities=None): ''' EnableUser enables one or more users. If the user is already enabled, the action is considered a success. entities : typing.Sequence[~Entity] Returns -> ErrorResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) # map input types to rpc msg _params = dict() msg = dict(type='UserManager', request='EnableUser', version=3, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(ModelUserInfoResults) async def ModelUserInfo(self, entities=None): ''' ModelUserInfo returns information on all users in the model. entities : typing.Sequence[~Entity] Returns -> ModelUserInfoResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) # map input types to rpc msg _params = dict() msg = dict(type='UserManager', request='ModelUserInfo', version=3, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(ErrorResults) async def RemoveUser(self, entities=None): ''' RemoveUser permanently removes a user from the current controller for each entity provided. While the user is permanently removed we keep it's information around for auditing purposes. TODO(redir): Add information about getting deleted user information when we add that capability. entities : typing.Sequence[~Entity] Returns -> ErrorResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) # map input types to rpc msg _params = dict() msg = dict(type='UserManager', request='RemoveUser', version=3, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(AddUserResults) async def ResetPassword(self, entities=None): ''' ResetPassword resets password for supplied users by invalidating current passwords (if any) and generating new random secret keys which will be returned. Users cannot reset their own password. entities : typing.Sequence[~Entity] Returns -> AddUserResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) # map input types to rpc msg _params = dict() msg = dict(type='UserManager', request='ResetPassword', version=3, params=_params) _params['entities'] = entities reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(ErrorResults) async def SetPassword(self, changes=None): ''' SetPassword changes the stored password for the specified users. changes : typing.Sequence[~EntityPassword] Returns -> ErrorResults ''' if changes is not None and not isinstance(changes, (bytes, str, list)): raise Exception("Expected changes to be a Sequence, received: {}".format(type(changes))) # map input types to rpc msg _params = dict() msg = dict(type='UserManager', request='SetPassword', version=3, params=_params) _params['changes'] = changes reply = await self.rpc(msg) return reply
[docs] @ReturnMapping(UserInfoResults) async def UserInfo(self, entities=None, include_disabled=None): ''' UserInfo returns information on a user. entities : typing.Sequence[~Entity] include_disabled : bool Returns -> UserInfoResults ''' if entities is not None and not isinstance(entities, (bytes, str, list)): raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities))) if include_disabled is not None and not isinstance(include_disabled, bool): raise Exception("Expected include_disabled to be a bool, received: {}".format(type(include_disabled))) # map input types to rpc msg _params = dict() msg = dict(type='UserManager', request='UserInfo', version=3, params=_params) _params['entities'] = entities _params['include-disabled'] = include_disabled reply = await self.rpc(msg) return reply