# 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 *


class AnnotationsFacade(Type):
    name = 'Annotations'
    version = 2
    schema =     {'definitions': {'AnnotationsGetResult': {'additionalProperties': False,
                                              'properties': {'annotations': {'patternProperties': {'.*': {'type': 'string'}},
                                                                             'type': 'object'},
                                                             'entity': {'type': 'string'},
                                                             'error': {'$ref': '#/definitions/ErrorResult'}},
                                              'required': ['entity', 'annotations'],
                                              'type': 'object'},
                     'AnnotationsGetResults': {'additionalProperties': False,
                                               'properties': {'results': {'items': {'$ref': '#/definitions/AnnotationsGetResult'},
                                                                          'type': 'array'}},
                                               'required': ['results'],
                                               'type': 'object'},
                     'AnnotationsSet': {'additionalProperties': False,
                                        'properties': {'annotations': {'items': {'$ref': '#/definitions/EntityAnnotations'},
                                                                       'type': 'array'}},
                                        'required': ['annotations'],
                                        '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'},
                     'EntityAnnotations': {'additionalProperties': False,
                                           'properties': {'annotations': {'patternProperties': {'.*': {'type': 'string'}},
                                                                          'type': 'object'},
                                                          'entity': {'type': 'string'}},
                                           'required': ['entity', 'annotations'],
                                           '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'}},
     'properties': {'Get': {'description': 'Get returns annotations for given '
                                           'entities.\n'
                                           'If annotations cannot be retrieved for '
                                           'a given entity, an error is returned.\n'
                                           'Each entity is treated independently '
                                           'and, hence, will fail or succeed '
                                           'independently.',
                            'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                           'Result': {'$ref': '#/definitions/AnnotationsGetResults'}},
                            'type': 'object'},
                    'Set': {'description': 'Set stores annotations for given '
                                           'entities',
                            'properties': {'Params': {'$ref': '#/definitions/AnnotationsSet'},
                                           'Result': {'$ref': '#/definitions/ErrorResults'}},
                            'type': 'object'}},
     'type': 'object'}
    

    @ReturnMapping(AnnotationsGetResults)
    async def Get(self, entities=None):
        '''
        Get returns annotations for given entities.
        If annotations cannot be retrieved for a given entity, an error is returned.
        Each entity is treated independently and, hence, will fail or succeed independently.

        entities : typing.Sequence[~Entity]
        Returns -> AnnotationsGetResults
        '''
        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='Annotations',
                   request='Get',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ErrorResults)
    async def Set(self, annotations=None):
        '''
        Set stores annotations for given entities

        annotations : typing.Sequence[~EntityAnnotations]
        Returns -> ErrorResults
        '''
        if annotations is not None and not isinstance(annotations, (bytes, str, list)):
            raise Exception("Expected annotations to be a Sequence, received: {}".format(type(annotations)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='Annotations',
                   request='Set',
                   version=2,
                   params=_params)
        _params['annotations'] = annotations
        reply = await self.rpc(msg)
        return reply



class BlockFacade(Type):
    name = 'Block'
    version = 2
    schema =     {'definitions': {'Block': {'additionalProperties': False,
                               'properties': {'id': {'type': 'string'},
                                              'message': {'type': 'string'},
                                              'tag': {'type': 'string'},
                                              'type': {'type': 'string'}},
                               'required': ['id', 'tag', 'type'],
                               'type': 'object'},
                     'BlockResult': {'additionalProperties': False,
                                     'properties': {'error': {'$ref': '#/definitions/Error'},
                                                    'result': {'$ref': '#/definitions/Block'}},
                                     'required': ['result'],
                                     'type': 'object'},
                     'BlockResults': {'additionalProperties': False,
                                      'properties': {'results': {'items': {'$ref': '#/definitions/BlockResult'},
                                                                 'type': 'array'}},
                                      'type': 'object'},
                     'BlockSwitchParams': {'additionalProperties': False,
                                           'properties': {'message': {'type': 'string'},
                                                          'type': {'type': 'string'}},
                                           'required': ['type'],
                                           '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'}},
     'properties': {'List': {'description': 'List implements Block.List().',
                             'properties': {'Result': {'$ref': '#/definitions/BlockResults'}},
                             'type': 'object'},
                    'SwitchBlockOff': {'description': 'SwitchBlockOff implements '
                                                      'Block.SwitchBlockOff().',
                                       'properties': {'Params': {'$ref': '#/definitions/BlockSwitchParams'},
                                                      'Result': {'$ref': '#/definitions/ErrorResult'}},
                                       'type': 'object'},
                    'SwitchBlockOn': {'description': 'SwitchBlockOn implements '
                                                     'Block.SwitchBlockOn().',
                                      'properties': {'Params': {'$ref': '#/definitions/BlockSwitchParams'},
                                                     'Result': {'$ref': '#/definitions/ErrorResult'}},
                                      'type': 'object'}},
     'type': 'object'}
    

    @ReturnMapping(BlockResults)
    async def List(self):
        '''
        List implements Block.List().


        Returns -> BlockResults
        '''

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='Block',
                   request='List',
                   version=2,
                   params=_params)

        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ErrorResult)
    async def SwitchBlockOff(self, message=None, type_=None):
        '''
        SwitchBlockOff implements Block.SwitchBlockOff().

        message : str
        type_ : str
        Returns -> ErrorResult
        '''
        if message is not None and not isinstance(message, (bytes, str)):
            raise Exception("Expected message to be a str, received: {}".format(type(message)))

        if type_ is not None and not isinstance(type_, (bytes, str)):
            raise Exception("Expected type_ to be a str, received: {}".format(type(type_)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='Block',
                   request='SwitchBlockOff',
                   version=2,
                   params=_params)
        _params['message'] = message
        _params['type'] = type_
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ErrorResult)
    async def SwitchBlockOn(self, message=None, type_=None):
        '''
        SwitchBlockOn implements Block.SwitchBlockOn().

        message : str
        type_ : str
        Returns -> ErrorResult
        '''
        if message is not None and not isinstance(message, (bytes, str)):
            raise Exception("Expected message to be a str, received: {}".format(type(message)))

        if type_ is not None and not isinstance(type_, (bytes, str)):
            raise Exception("Expected type_ to be a str, received: {}".format(type(type_)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='Block',
                   request='SwitchBlockOn',
                   version=2,
                   params=_params)
        _params['message'] = message
        _params['type'] = type_
        reply = await self.rpc(msg)
        return reply



class CAASAgentFacade(Type):
    name = 'CAASAgent'
    version = 2
    schema =     {'definitions': {'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'},
                     'Error': {'additionalProperties': False,
                               'properties': {'code': {'type': 'string'},
                                              'info': {'patternProperties': {'.*': {'additionalProperties': True,
                                                                                    'type': 'object'}},
                                                       'type': 'object'},
                                              'message': {'type': 'string'}},
                               'required': ['message', 'code'],
                               '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'}},
     'properties': {'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'},
                    'ModelConfig': {'description': 'ModelConfig returns the '
                                                   "current model's configuration.",
                                    'properties': {'Result': {'$ref': '#/definitions/ModelConfigResult'}},
                                    'type': 'object'},
                    'WatchCloudSpecsChanges': {'description': 'WatchCloudSpecsChanges '
                                                              'returns a watcher '
                                                              'for cloud spec '
                                                              'changes.',
                                               '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'}
    

    @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='CAASAgent',
                   request='CloudSpec',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @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='CAASAgent',
                   request='ControllerAPIInfoForModels',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @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='CAASAgent',
                   request='ControllerConfig',
                   version=2,
                   params=_params)

        reply = await self.rpc(msg)
        return reply



    @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='CAASAgent',
                   request='GetCloudSpec',
                   version=2,
                   params=_params)

        reply = await self.rpc(msg)
        return reply



    @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='CAASAgent',
                   request='ModelConfig',
                   version=2,
                   params=_params)

        reply = await self.rpc(msg)
        return reply



    @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='CAASAgent',
                   request='WatchCloudSpecsChanges',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @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='CAASAgent',
                   request='WatchForModelConfigChanges',
                   version=2,
                   params=_params)

        reply = await self.rpc(msg)
        return reply



class CAASUnitProvisionerFacade(Type):
    name = 'CAASUnitProvisioner'
    version = 2
    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'},
                     'ApplicationGetConfigResults': {'additionalProperties': False,
                                                     'properties': {'Results': {'items': {'$ref': '#/definitions/ConfigResult'},
                                                                                'type': 'array'}},
                                                     'required': ['Results'],
                                                     'type': 'object'},
                     'ApplicationUnitInfo': {'additionalProperties': False,
                                             'properties': {'provider-id': {'type': 'string'},
                                                            'unit-tag': {'type': 'string'}},
                                             'required': ['provider-id',
                                                          'unit-tag'],
                                             'type': 'object'},
                     'ApplicationUnitParams': {'additionalProperties': False,
                                               'properties': {'address': {'type': 'string'},
                                                              'data': {'patternProperties': {'.*': {'additionalProperties': True,
                                                                                                    'type': 'object'}},
                                                                       'type': 'object'},
                                                              'filesystem-info': {'items': {'$ref': '#/definitions/KubernetesFilesystemInfo'},
                                                                                  'type': 'array'},
                                                              'info': {'type': 'string'},
                                                              'ports': {'items': {'type': 'string'},
                                                                        'type': 'array'},
                                                              'provider-id': {'type': 'string'},
                                                              'stateful': {'type': 'boolean'},
                                                              'status': {'type': 'string'},
                                                              'unit-tag': {'type': 'string'}},
                                               'required': ['provider-id',
                                                            'unit-tag',
                                                            'address',
                                                            'ports',
                                                            'status',
                                                            'info'],
                                               'type': 'object'},
                     'BoolResult': {'additionalProperties': False,
                                    'properties': {'error': {'$ref': '#/definitions/Error'},
                                                   'result': {'type': 'boolean'}},
                                    'required': ['result'],
                                    'type': 'object'},
                     'BoolResults': {'additionalProperties': False,
                                     'properties': {'results': {'items': {'$ref': '#/definitions/BoolResult'},
                                                                'type': 'array'}},
                                     'required': ['results'],
                                     'type': 'object'},
                     'Charm': {'additionalProperties': False,
                               'properties': {'actions': {'$ref': '#/definitions/CharmActions'},
                                              'config': {'patternProperties': {'.*': {'$ref': '#/definitions/CharmOption'}},
                                                         'type': 'object'},
                                              'lxd-profile': {'$ref': '#/definitions/CharmLXDProfile'},
                                              'manifest': {'$ref': '#/definitions/CharmManifest'},
                                              'meta': {'$ref': '#/definitions/CharmMeta'},
                                              'metrics': {'$ref': '#/definitions/CharmMetrics'},
                                              'revision': {'type': 'integer'},
                                              'url': {'type': 'string'}},
                               'required': ['revision', 'url', 'config'],
                               'type': 'object'},
                     'CharmActionSpec': {'additionalProperties': False,
                                         'properties': {'description': {'type': 'string'},
                                                        'params': {'patternProperties': {'.*': {'additionalProperties': True,
                                                                                                'type': 'object'}},
                                                                   'type': 'object'}},
                                         'required': ['description', 'params'],
                                         'type': 'object'},
                     'CharmActions': {'additionalProperties': False,
                                      'properties': {'specs': {'patternProperties': {'.*': {'$ref': '#/definitions/CharmActionSpec'}},
                                                               'type': 'object'}},
                                      'type': 'object'},
                     'CharmBase': {'additionalProperties': False,
                                   'properties': {'architectures': {'items': {'type': 'string'},
                                                                    'type': 'array'},
                                                  'channel': {'type': 'string'},
                                                  'name': {'type': 'string'}},
                                   'type': 'object'},
                     'CharmContainer': {'additionalProperties': False,
                                        'properties': {'mounts': {'items': {'$ref': '#/definitions/CharmMount'},
                                                                  'type': 'array'},
                                                       'resource': {'type': 'string'}},
                                        'type': 'object'},
                     'CharmDeployment': {'additionalProperties': False,
                                         'properties': {'min-version': {'type': 'string'},
                                                        'mode': {'type': 'string'},
                                                        'service': {'type': 'string'},
                                                        'type': {'type': 'string'}},
                                         'required': ['type',
                                                      'mode',
                                                      'service',
                                                      'min-version'],
                                         'type': 'object'},
                     'CharmDevice': {'additionalProperties': False,
                                     'properties': {'CountMax': {'type': 'integer'},
                                                    'CountMin': {'type': 'integer'},
                                                    'Description': {'type': 'string'},
                                                    'Name': {'type': 'string'},
                                                    'Type': {'type': 'string'}},
                                     'required': ['Name',
                                                  'Description',
                                                  'Type',
                                                  'CountMin',
                                                  'CountMax'],
                                     'type': 'object'},
                     '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'},
                     'CharmManifest': {'additionalProperties': False,
                                       'properties': {'bases': {'items': {'$ref': '#/definitions/CharmBase'},
                                                                'type': 'array'}},
                                       'type': 'object'},
                     'CharmMeta': {'additionalProperties': False,
                                   'properties': {'assumes-expr': {'$ref': '#/definitions/ExpressionTree'},
                                                  'categories': {'items': {'type': 'string'},
                                                                 'type': 'array'},
                                                  'containers': {'patternProperties': {'.*': {'$ref': '#/definitions/CharmContainer'}},
                                                                 'type': 'object'},
                                                  'deployment': {'$ref': '#/definitions/CharmDeployment'},
                                                  'description': {'type': 'string'},
                                                  'devices': {'patternProperties': {'.*': {'$ref': '#/definitions/CharmDevice'}},
                                                              'type': 'object'},
                                                  'extra-bindings': {'patternProperties': {'.*': {'type': 'string'}},
                                                                     'type': 'object'},
                                                  'min-juju-version': {'type': 'string'},
                                                  'name': {'type': 'string'},
                                                  'payload-classes': {'patternProperties': {'.*': {'$ref': '#/definitions/CharmPayloadClass'}},
                                                                      'type': 'object'},
                                                  'peers': {'patternProperties': {'.*': {'$ref': '#/definitions/CharmRelation'}},
                                                            'type': 'object'},
                                                  'provides': {'patternProperties': {'.*': {'$ref': '#/definitions/CharmRelation'}},
                                                               'type': 'object'},
                                                  'requires': {'patternProperties': {'.*': {'$ref': '#/definitions/CharmRelation'}},
                                                               'type': 'object'},
                                                  'resources': {'patternProperties': {'.*': {'$ref': '#/definitions/CharmResourceMeta'}},
                                                                'type': 'object'},
                                                  'series': {'items': {'type': 'string'},
                                                             'type': 'array'},
                                                  'storage': {'patternProperties': {'.*': {'$ref': '#/definitions/CharmStorage'}},
                                                              'type': 'object'},
                                                  'subordinate': {'type': 'boolean'},
                                                  'summary': {'type': 'string'},
                                                  'tags': {'items': {'type': 'string'},
                                                           'type': 'array'},
                                                  'terms': {'items': {'type': 'string'},
                                                            'type': 'array'}},
                                   'required': ['name',
                                                'summary',
                                                'description',
                                                'subordinate'],
                                   'type': 'object'},
                     'CharmMetric': {'additionalProperties': False,
                                     'properties': {'description': {'type': 'string'},
                                                    'type': {'type': 'string'}},
                                     'required': ['type', 'description'],
                                     'type': 'object'},
                     'CharmMetrics': {'additionalProperties': False,
                                      'properties': {'metrics': {'patternProperties': {'.*': {'$ref': '#/definitions/CharmMetric'}},
                                                                 'type': 'object'},
                                                     'plan': {'$ref': '#/definitions/CharmPlan'}},
                                      'required': ['metrics', 'plan'],
                                      'type': 'object'},
                     'CharmMount': {'additionalProperties': False,
                                    'properties': {'location': {'type': 'string'},
                                                   'storage': {'type': 'string'}},
                                    'type': 'object'},
                     'CharmOption': {'additionalProperties': False,
                                     'properties': {'default': {'additionalProperties': True,
                                                                'type': 'object'},
                                                    'description': {'type': 'string'},
                                                    'type': {'type': 'string'}},
                                     'required': ['type'],
                                     'type': 'object'},
                     'CharmPayloadClass': {'additionalProperties': False,
                                           'properties': {'name': {'type': 'string'},
                                                          'type': {'type': 'string'}},
                                           'required': ['name', 'type'],
                                           'type': 'object'},
                     'CharmPlan': {'additionalProperties': False,
                                   'properties': {'required': {'type': 'boolean'}},
                                   'required': ['required'],
                                   'type': 'object'},
                     'CharmRelation': {'additionalProperties': False,
                                       'properties': {'interface': {'type': 'string'},
                                                      'limit': {'type': 'integer'},
                                                      'name': {'type': 'string'},
                                                      'optional': {'type': 'boolean'},
                                                      'role': {'type': 'string'},
                                                      'scope': {'type': 'string'}},
                                       'required': ['name',
                                                    'role',
                                                    'interface',
                                                    'optional',
                                                    'limit',
                                                    'scope'],
                                       'type': 'object'},
                     'CharmResourceMeta': {'additionalProperties': False,
                                           'properties': {'description': {'type': 'string'},
                                                          'name': {'type': 'string'},
                                                          'path': {'type': 'string'},
                                                          'type': {'type': 'string'}},
                                           'required': ['name',
                                                        'type',
                                                        'path',
                                                        'description'],
                                           'type': 'object'},
                     'CharmStorage': {'additionalProperties': False,
                                      'properties': {'count-max': {'type': 'integer'},
                                                     'count-min': {'type': 'integer'},
                                                     'description': {'type': 'string'},
                                                     'location': {'type': 'string'},
                                                     'minimum-size': {'type': 'integer'},
                                                     'name': {'type': 'string'},
                                                     'properties': {'items': {'type': 'string'},
                                                                    'type': 'array'},
                                                     'read-only': {'type': 'boolean'},
                                                     'shared': {'type': 'boolean'},
                                                     'type': {'type': 'string'}},
                                      'required': ['name',
                                                   'description',
                                                   'type',
                                                   'shared',
                                                   'read-only',
                                                   'count-min',
                                                   'count-max',
                                                   'minimum-size'],
                                      'type': 'object'},
                     'CharmURL': {'additionalProperties': False,
                                  'properties': {'url': {'type': 'string'}},
                                  'required': ['url'],
                                  'type': 'object'},
                     'ConfigResult': {'additionalProperties': False,
                                      'properties': {'config': {'patternProperties': {'.*': {'additionalProperties': True,
                                                                                             'type': 'object'}},
                                                                'type': 'object'},
                                                     'error': {'$ref': '#/definitions/Error'}},
                                      'required': ['config'],
                                      'type': 'object'},
                     'DockerImageInfo': {'additionalProperties': False,
                                         'properties': {'auth': {'type': 'string'},
                                                        'email': {'type': 'string'},
                                                        'identitytoken': {'type': 'string'},
                                                        'image-name': {'type': 'string'},
                                                        'password': {'type': 'string'},
                                                        'registrytoken': {'type': 'string'},
                                                        'repository': {'type': 'string'},
                                                        'serveraddress': {'type': 'string'},
                                                        'username': {'type': 'string'}},
                                         'required': ['image-name'],
                                         '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'},
                     'EntityStatus': {'additionalProperties': False,
                                      'properties': {'data': {'patternProperties': {'.*': {'additionalProperties': True,
                                                                                           'type': 'object'}},
                                                              'type': 'object'},
                                                     'info': {'type': 'string'},
                                                     'since': {'format': 'date-time',
                                                               'type': 'string'},
                                                     'status': {'type': 'string'}},
                                      'required': ['status', 'info', 'since'],
                                      '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'},
                     'ExpressionTree': {'additionalProperties': False,
                                        'properties': {'Expression': {'additionalProperties': True,
                                                                      'type': 'object'}},
                                        'required': ['Expression'],
                                        'type': 'object'},
                     'IntResult': {'additionalProperties': False,
                                   'properties': {'error': {'$ref': '#/definitions/Error'},
                                                  'result': {'type': 'integer'}},
                                   'required': ['result'],
                                   'type': 'object'},
                     'IntResults': {'additionalProperties': False,
                                    'properties': {'results': {'items': {'$ref': '#/definitions/IntResult'},
                                                               'type': 'array'}},
                                    'required': ['results'],
                                    'type': 'object'},
                     'KubernetesDeploymentInfo': {'additionalProperties': False,
                                                  'properties': {'deployment-type': {'type': 'string'},
                                                                 'service-type': {'type': 'string'}},
                                                  'required': ['deployment-type',
                                                               'service-type'],
                                                  'type': 'object'},
                     'KubernetesDeviceParams': {'additionalProperties': False,
                                                'properties': {'Attributes': {'patternProperties': {'.*': {'type': 'string'}},
                                                                              'type': 'object'},
                                                               'Count': {'type': 'integer'},
                                                               'Type': {'type': 'string'}},
                                                'required': ['Type',
                                                             'Count',
                                                             'Attributes'],
                                                'type': 'object'},
                     'KubernetesFilesystemAttachmentParams': {'additionalProperties': False,
                                                              'properties': {'mount-point': {'type': 'string'},
                                                                             'provider': {'type': 'string'},
                                                                             'read-only': {'type': 'boolean'}},
                                                              'required': ['provider'],
                                                              'type': 'object'},
                     'KubernetesFilesystemInfo': {'additionalProperties': False,
                                                  'properties': {'data': {'patternProperties': {'.*': {'additionalProperties': True,
                                                                                                       'type': 'object'}},
                                                                          'type': 'object'},
                                                                 'filesystem-id': {'type': 'string'},
                                                                 'info': {'type': 'string'},
                                                                 'mount-point': {'type': 'string'},
                                                                 'pool': {'type': 'string'},
                                                                 'read-only': {'type': 'boolean'},
                                                                 'size': {'type': 'integer'},
                                                                 'status': {'type': 'string'},
                                                                 'storagename': {'type': 'string'},
                                                                 'volume': {'$ref': '#/definitions/KubernetesVolumeInfo'}},
                                                  'required': ['storagename',
                                                               'pool',
                                                               'size',
                                                               'filesystem-id',
                                                               'status',
                                                               'info',
                                                               'volume'],
                                                  'type': 'object'},
                     'KubernetesFilesystemParams': {'additionalProperties': False,
                                                    'properties': {'attachment': {'$ref': '#/definitions/KubernetesFilesystemAttachmentParams'},
                                                                   'attributes': {'patternProperties': {'.*': {'additionalProperties': True,
                                                                                                               'type': 'object'}},
                                                                                  'type': 'object'},
                                                                   'provider': {'type': 'string'},
                                                                   'size': {'type': 'integer'},
                                                                   'storagename': {'type': 'string'},
                                                                   'tags': {'patternProperties': {'.*': {'type': 'string'}},
                                                                            'type': 'object'}},
                                                    'required': ['storagename',
                                                                 'size',
                                                                 'provider'],
                                                    'type': 'object'},
                     'KubernetesProvisioningInfo': {'additionalProperties': False,
                                                    'properties': {'charm-modified-version': {'type': 'integer'},
                                                                   'constraints': {'$ref': '#/definitions/Value'},
                                                                   'deployment-info': {'$ref': '#/definitions/KubernetesDeploymentInfo'},
                                                                   'devices': {'items': {'$ref': '#/definitions/KubernetesDeviceParams'},
                                                                               'type': 'array'},
                                                                   'filesystems': {'items': {'$ref': '#/definitions/KubernetesFilesystemParams'},
                                                                                   'type': 'array'},
                                                                   'image-repo': {'$ref': '#/definitions/DockerImageInfo'},
                                                                   'pod-spec': {'type': 'string'},
                                                                   'raw-k8s-spec': {'type': 'string'},
                                                                   'tags': {'patternProperties': {'.*': {'type': 'string'}},
                                                                            'type': 'object'},
                                                                   'volumes': {'items': {'$ref': '#/definitions/KubernetesVolumeParams'},
                                                                               'type': 'array'}},
                                                    'required': ['pod-spec',
                                                                 'constraints'],
                                                    'type': 'object'},
                     'KubernetesProvisioningInfoResult': {'additionalProperties': False,
                                                          'properties': {'error': {'$ref': '#/definitions/Error'},
                                                                         'result': {'$ref': '#/definitions/KubernetesProvisioningInfo'}},
                                                          'required': ['result'],
                                                          'type': 'object'},
                     'KubernetesProvisioningInfoResults': {'additionalProperties': False,
                                                           'properties': {'results': {'items': {'$ref': '#/definitions/KubernetesProvisioningInfoResult'},
                                                                                      'type': 'array'}},
                                                           'required': ['results'],
                                                           'type': 'object'},
                     'KubernetesVolumeAttachmentParams': {'additionalProperties': False,
                                                          'properties': {'provider': {'type': 'string'},
                                                                         'read-only': {'type': 'boolean'}},
                                                          'required': ['provider'],
                                                          'type': 'object'},
                     'KubernetesVolumeInfo': {'additionalProperties': False,
                                              'properties': {'data': {'patternProperties': {'.*': {'additionalProperties': True,
                                                                                                   'type': 'object'}},
                                                                      'type': 'object'},
                                                             'info': {'type': 'string'},
                                                             'persistent': {'type': 'boolean'},
                                                             'pool': {'type': 'string'},
                                                             'size': {'type': 'integer'},
                                                             'status': {'type': 'string'},
                                                             'volume-id': {'type': 'string'}},
                                              'required': ['volume-id',
                                                           'size',
                                                           'persistent',
                                                           'status',
                                                           'info'],
                                              'type': 'object'},
                     'KubernetesVolumeParams': {'additionalProperties': False,
                                                'properties': {'attachment': {'$ref': '#/definitions/KubernetesVolumeAttachmentParams'},
                                                               'attributes': {'patternProperties': {'.*': {'additionalProperties': True,
                                                                                                           'type': 'object'}},
                                                                              'type': 'object'},
                                                               'provider': {'type': 'string'},
                                                               'size': {'type': 'integer'},
                                                               'storagename': {'type': 'string'},
                                                               'tags': {'patternProperties': {'.*': {'type': 'string'}},
                                                                        'type': 'object'}},
                                                'required': ['storagename',
                                                             'size',
                                                             'provider'],
                                                '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'},
                     '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'},
                     'StringsWatchResult': {'additionalProperties': False,
                                            'properties': {'changes': {'items': {'type': 'string'},
                                                                       'type': 'array'},
                                                           'error': {'$ref': '#/definitions/Error'},
                                                           'watcher-id': {'type': 'string'}},
                                            'required': ['watcher-id'],
                                            'type': 'object'},
                     'StringsWatchResults': {'additionalProperties': False,
                                             'properties': {'results': {'items': {'$ref': '#/definitions/StringsWatchResult'},
                                                                        'type': 'array'}},
                                             'required': ['results'],
                                             'type': 'object'},
                     'UpdateApplicationServiceArg': {'additionalProperties': False,
                                                     'properties': {'addresses': {'items': {'$ref': '#/definitions/Address'},
                                                                                  'type': 'array'},
                                                                    'application-tag': {'type': 'string'},
                                                                    'generation': {'type': 'integer'},
                                                                    'provider-id': {'type': 'string'},
                                                                    'scale': {'type': 'integer'}},
                                                     'required': ['application-tag',
                                                                  'provider-id',
                                                                  'addresses'],
                                                     'type': 'object'},
                     'UpdateApplicationServiceArgs': {'additionalProperties': False,
                                                      'properties': {'args': {'items': {'$ref': '#/definitions/UpdateApplicationServiceArg'},
                                                                              'type': 'array'}},
                                                      'required': ['args'],
                                                      'type': 'object'},
                     'UpdateApplicationUnitArgs': {'additionalProperties': False,
                                                   'properties': {'args': {'items': {'$ref': '#/definitions/UpdateApplicationUnits'},
                                                                           'type': 'array'}},
                                                   'required': ['args'],
                                                   'type': 'object'},
                     'UpdateApplicationUnitResult': {'additionalProperties': False,
                                                     'properties': {'error': {'$ref': '#/definitions/Error'},
                                                                    'info': {'$ref': '#/definitions/UpdateApplicationUnitsInfo'}},
                                                     'type': 'object'},
                     'UpdateApplicationUnitResults': {'additionalProperties': False,
                                                      'properties': {'results': {'items': {'$ref': '#/definitions/UpdateApplicationUnitResult'},
                                                                                 'type': 'array'}},
                                                      'required': ['results'],
                                                      'type': 'object'},
                     'UpdateApplicationUnits': {'additionalProperties': False,
                                                'properties': {'application-tag': {'type': 'string'},
                                                               'generation': {'type': 'integer'},
                                                               'scale': {'type': 'integer'},
                                                               'status': {'$ref': '#/definitions/EntityStatus'},
                                                               'units': {'items': {'$ref': '#/definitions/ApplicationUnitParams'},
                                                                         'type': 'array'}},
                                                'required': ['application-tag',
                                                             'units'],
                                                'type': 'object'},
                     'UpdateApplicationUnitsInfo': {'additionalProperties': False,
                                                    'properties': {'units': {'items': {'$ref': '#/definitions/ApplicationUnitInfo'},
                                                                             'type': 'array'}},
                                                    'required': ['units'],
                                                    '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': {'ApplicationCharmInfo': {'description': 'ApplicationCharmInfo '
                                                            'returns information '
                                                            'about an '
                                                            "application's charm.",
                                             'properties': {'Params': {'$ref': '#/definitions/Entity'},
                                                            'Result': {'$ref': '#/definitions/Charm'}},
                                             'type': 'object'},
                    'ApplicationsConfig': {'description': 'ApplicationsConfig '
                                                          'returns the config for '
                                                          'the specified '
                                                          'applications.',
                                           'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                          'Result': {'$ref': '#/definitions/ApplicationGetConfigResults'}},
                                           'type': 'object'},
                    'ApplicationsScale': {'description': 'ApplicationsScale '
                                                         'returns the scaling info '
                                                         'for specified '
                                                         'applications in this '
                                                         'model.',
                                          'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                         'Result': {'$ref': '#/definitions/IntResults'}},
                                          'type': 'object'},
                    'ApplicationsTrust': {'description': 'ApplicationsTrust '
                                                         'returns the trust status '
                                                         'for specified '
                                                         'applications in this '
                                                         'model.',
                                          'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                         'Result': {'$ref': '#/definitions/BoolResults'}},
                                          'type': 'object'},
                    'CharmInfo': {'description': 'CharmInfo returns information '
                                                 'about the requested charm.',
                                  'properties': {'Params': {'$ref': '#/definitions/CharmURL'},
                                                 'Result': {'$ref': '#/definitions/Charm'}},
                                  'type': 'object'},
                    'ClearApplicationsResources': {'description': 'ClearApplicationsResources '
                                                                  'clears the '
                                                                  'flags which '
                                                                  'indicate\n'
                                                                  'applications '
                                                                  'still have '
                                                                  'resources in '
                                                                  'the cluster.',
                                                   'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                                  'Result': {'$ref': '#/definitions/ErrorResults'}},
                                                   'type': 'object'},
                    'DeploymentMode': {'description': 'DeploymentMode returns the '
                                                      'deployment mode of the '
                                                      "given applications' charms.",
                                       'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                      'Result': {'$ref': '#/definitions/StringResults'}},
                                       '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'},
                    'ProvisioningInfo': {'description': 'ProvisioningInfo returns '
                                                        'the provisioning info for '
                                                        'specified applications in '
                                                        'this model.',
                                         'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                        'Result': {'$ref': '#/definitions/KubernetesProvisioningInfoResults'}},
                                         'type': 'object'},
                    'SetOperatorStatus': {'description': 'SetOperatorStatus '
                                                         'updates the operator '
                                                         'status for each given '
                                                         'application.',
                                          'properties': {'Params': {'$ref': '#/definitions/SetStatus'},
                                                         'Result': {'$ref': '#/definitions/ErrorResults'}},
                                          'type': 'object'},
                    'UpdateApplicationsService': {'description': 'UpdateApplicationsService '
                                                                 'updates the Juju '
                                                                 'data model to '
                                                                 'reflect the '
                                                                 'given\n'
                                                                 'service details '
                                                                 'of the specified '
                                                                 'application.',
                                                  'properties': {'Params': {'$ref': '#/definitions/UpdateApplicationServiceArgs'},
                                                                 'Result': {'$ref': '#/definitions/ErrorResults'}},
                                                  'type': 'object'},
                    'UpdateApplicationsUnits': {'description': 'UpdateApplicationsUnits '
                                                               'updates the Juju '
                                                               'data model to '
                                                               'reflect the given\n'
                                                               'units of the '
                                                               'specified '
                                                               'application.',
                                                'properties': {'Params': {'$ref': '#/definitions/UpdateApplicationUnitArgs'},
                                                               'Result': {'$ref': '#/definitions/UpdateApplicationUnitResults'}},
                                                'type': 'object'},
                    'Watch': {'description': 'Watch starts a NotifyWatcher for '
                                             'each entity given.',
                              'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                             'Result': {'$ref': '#/definitions/NotifyWatchResults'}},
                              'type': 'object'},
                    'WatchApplications': {'description': 'WatchApplications starts '
                                                         'a StringsWatcher to '
                                                         'watch applications\n'
                                                         'deployed to this model.',
                                          'properties': {'Result': {'$ref': '#/definitions/StringsWatchResult'}},
                                          'type': 'object'},
                    'WatchApplicationsScale': {'description': 'WatchApplicationsScale '
                                                              'starts a '
                                                              'NotifyWatcher to '
                                                              'watch changes\n'
                                                              'to the '
                                                              "applications' "
                                                              'scale.',
                                               'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                              'Result': {'$ref': '#/definitions/NotifyWatchResults'}},
                                               'type': 'object'},
                    'WatchApplicationsTrustHash': {'description': 'WatchApplicationsTrustHash '
                                                                  'starts a '
                                                                  'StringsWatcher '
                                                                  'to watch '
                                                                  'changes\n'
                                                                  'to the '
                                                                  "applications' "
                                                                  'trust status.',
                                                   'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                                  'Result': {'$ref': '#/definitions/StringsWatchResults'}},
                                                   'type': 'object'},
                    'WatchPodSpec': {'description': 'WatchPodSpec starts a '
                                                    'NotifyWatcher to watch '
                                                    'changes to the\n'
                                                    'pod spec for specified units '
                                                    'in this model.',
                                     'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                    'Result': {'$ref': '#/definitions/NotifyWatchResults'}},
                                     'type': 'object'}},
     'type': 'object'}
    

    @ReturnMapping(Charm)
    async def ApplicationCharmInfo(self, tag=None):
        '''
        ApplicationCharmInfo returns information about an application's charm.

        tag : str
        Returns -> Charm
        '''
        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='CAASUnitProvisioner',
                   request='ApplicationCharmInfo',
                   version=2,
                   params=_params)
        _params['tag'] = tag
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ApplicationGetConfigResults)
    async def ApplicationsConfig(self, entities=None):
        '''
        ApplicationsConfig returns the config for the specified applications.

        entities : typing.Sequence[~Entity]
        Returns -> ApplicationGetConfigResults
        '''
        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='CAASUnitProvisioner',
                   request='ApplicationsConfig',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(IntResults)
    async def ApplicationsScale(self, entities=None):
        '''
        ApplicationsScale returns the scaling info for specified applications in this model.

        entities : typing.Sequence[~Entity]
        Returns -> IntResults
        '''
        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='CAASUnitProvisioner',
                   request='ApplicationsScale',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(BoolResults)
    async def ApplicationsTrust(self, entities=None):
        '''
        ApplicationsTrust returns the trust status for specified applications in this model.

        entities : typing.Sequence[~Entity]
        Returns -> BoolResults
        '''
        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='CAASUnitProvisioner',
                   request='ApplicationsTrust',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(Charm)
    async def CharmInfo(self, url=None):
        '''
        CharmInfo returns information about the requested charm.

        url : str
        Returns -> Charm
        '''
        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='CAASUnitProvisioner',
                   request='CharmInfo',
                   version=2,
                   params=_params)
        _params['url'] = url
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ErrorResults)
    async def ClearApplicationsResources(self, entities=None):
        '''
        ClearApplicationsResources clears the flags which indicate
        applications still have resources in the cluster.

        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='CAASUnitProvisioner',
                   request='ClearApplicationsResources',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(StringResults)
    async def DeploymentMode(self, entities=None):
        '''
        DeploymentMode returns the deployment mode of the given applications' charms.

        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='CAASUnitProvisioner',
                   request='DeploymentMode',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @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='CAASUnitProvisioner',
                   request='Life',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(KubernetesProvisioningInfoResults)
    async def ProvisioningInfo(self, entities=None):
        '''
        ProvisioningInfo returns the provisioning info for specified applications in this model.

        entities : typing.Sequence[~Entity]
        Returns -> KubernetesProvisioningInfoResults
        '''
        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='CAASUnitProvisioner',
                   request='ProvisioningInfo',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ErrorResults)
    async def SetOperatorStatus(self, entities=None):
        '''
        SetOperatorStatus updates the operator status for each given application.

        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='CAASUnitProvisioner',
                   request='SetOperatorStatus',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ErrorResults)
    async def UpdateApplicationsService(self, args=None):
        '''
        UpdateApplicationsService updates the Juju data model to reflect the given
        service details of the specified application.

        args : typing.Sequence[~UpdateApplicationServiceArg]
        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='CAASUnitProvisioner',
                   request='UpdateApplicationsService',
                   version=2,
                   params=_params)
        _params['args'] = args
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(UpdateApplicationUnitResults)
    async def UpdateApplicationsUnits(self, args=None):
        '''
        UpdateApplicationsUnits updates the Juju data model to reflect the given
        units of the specified application.

        args : typing.Sequence[~UpdateApplicationUnits]
        Returns -> UpdateApplicationUnitResults
        '''
        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='CAASUnitProvisioner',
                   request='UpdateApplicationsUnits',
                   version=2,
                   params=_params)
        _params['args'] = args
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(NotifyWatchResults)
    async def Watch(self, entities=None):
        '''
        Watch starts a NotifyWatcher for each entity given.

        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='CAASUnitProvisioner',
                   request='Watch',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(StringsWatchResult)
    async def WatchApplications(self):
        '''
        WatchApplications starts a StringsWatcher to watch applications
        deployed to this model.


        Returns -> StringsWatchResult
        '''

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='CAASUnitProvisioner',
                   request='WatchApplications',
                   version=2,
                   params=_params)

        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(NotifyWatchResults)
    async def WatchApplicationsScale(self, entities=None):
        '''
        WatchApplicationsScale starts a NotifyWatcher to watch changes
        to the applications' scale.

        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='CAASUnitProvisioner',
                   request='WatchApplicationsScale',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(StringsWatchResults)
    async def WatchApplicationsTrustHash(self, entities=None):
        '''
        WatchApplicationsTrustHash starts a StringsWatcher to watch changes
        to the applications' trust status.

        entities : typing.Sequence[~Entity]
        Returns -> StringsWatchResults
        '''
        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='CAASUnitProvisioner',
                   request='WatchApplicationsTrustHash',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(NotifyWatchResults)
    async def WatchPodSpec(self, entities=None):
        '''
        WatchPodSpec starts a NotifyWatcher to watch changes to the
        pod spec for specified units in this model.

        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='CAASUnitProvisioner',
                   request='WatchPodSpec',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



class CharmRevisionUpdaterFacade(Type):
    name = 'CharmRevisionUpdater'
    version = 2
    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'},
                     'ErrorResult': {'additionalProperties': False,
                                     'properties': {'error': {'$ref': '#/definitions/Error'}},
                                     'type': 'object'}},
     'properties': {'UpdateLatestRevisions': {'description': 'UpdateLatestRevisions '
                                                             'retrieves the latest '
                                                             'revision information '
                                                             'from the charm store '
                                                             'for all deployed '
                                                             'charms\n'
                                                             'and records this '
                                                             'information in '
                                                             'state.',
                                              'properties': {'Result': {'$ref': '#/definitions/ErrorResult'}},
                                              'type': 'object'}},
     'type': 'object'}
    

    @ReturnMapping(ErrorResult)
    async def UpdateLatestRevisions(self):
        '''
        UpdateLatestRevisions retrieves the latest revision information from the charm store for all deployed charms
        and records this information in state.


        Returns -> ErrorResult
        '''

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='CharmRevisionUpdater',
                   request='UpdateLatestRevisions',
                   version=2,
                   params=_params)

        reply = await self.rpc(msg)
        return reply



class CleanerFacade(Type):
    name = 'Cleaner'
    version = 2
    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'},
                     'NotifyWatchResult': {'additionalProperties': False,
                                           'properties': {'NotifyWatcherId': {'type': 'string'},
                                                          'error': {'$ref': '#/definitions/Error'}},
                                           'required': ['NotifyWatcherId'],
                                           'type': 'object'}},
     'properties': {'Cleanup': {'description': 'Cleanup triggers a state cleanup',
                                'type': 'object'},
                    'WatchCleanups': {'description': 'WatchCleanups watches for '
                                                     'cleanups to be performed in '
                                                     'state.',
                                      'properties': {'Result': {'$ref': '#/definitions/NotifyWatchResult'}},
                                      'type': 'object'}},
     'type': 'object'}
    

    @ReturnMapping(None)
    async def Cleanup(self):
        '''
        Cleanup triggers a state cleanup


        Returns -> None
        '''

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='Cleaner',
                   request='Cleanup',
                   version=2,
                   params=_params)

        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(NotifyWatchResult)
    async def WatchCleanups(self):
        '''
        WatchCleanups watches for cleanups to be performed in state.


        Returns -> NotifyWatchResult
        '''

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='Cleaner',
                   request='WatchCleanups',
                   version=2,
                   params=_params)

        reply = await self.rpc(msg)
        return reply



class CredentialValidatorFacade(Type):
    name = 'CredentialValidator'
    version = 2
    schema =     {'definitions': {'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'},
                     'InvalidateCredentialArg': {'additionalProperties': False,
                                                 'properties': {'reason': {'type': 'string'}},
                                                 'type': 'object'},
                     'ModelCredential': {'additionalProperties': False,
                                         'properties': {'credential-tag': {'type': 'string'},
                                                        'exists': {'type': 'boolean'},
                                                        'model-tag': {'type': 'string'},
                                                        'valid': {'type': 'boolean'}},
                                         'required': ['model-tag',
                                                      'credential-tag'],
                                         'type': 'object'},
                     'NotifyWatchResult': {'additionalProperties': False,
                                           'properties': {'NotifyWatcherId': {'type': 'string'},
                                                          'error': {'$ref': '#/definitions/Error'}},
                                           'required': ['NotifyWatcherId'],
                                           'type': 'object'}},
     'properties': {'InvalidateModelCredential': {'description': 'InvalidateModelCredential '
                                                                 'marks the cloud '
                                                                 'credential for '
                                                                 'this model as '
                                                                 'invalid.',
                                                  'properties': {'Params': {'$ref': '#/definitions/InvalidateCredentialArg'},
                                                                 'Result': {'$ref': '#/definitions/ErrorResult'}},
                                                  'type': 'object'},
                    'ModelCredential': {'description': 'ModelCredential returns '
                                                       'cloud credential '
                                                       'information for a  model.',
                                        'properties': {'Result': {'$ref': '#/definitions/ModelCredential'}},
                                        'type': 'object'},
                    'WatchCredential': {'description': 'WatchCredential returns a '
                                                       'NotifyWatcher that '
                                                       'observes\n'
                                                       'changes to a given cloud '
                                                       'credential.',
                                        'properties': {'Params': {'$ref': '#/definitions/Entity'},
                                                       'Result': {'$ref': '#/definitions/NotifyWatchResult'}},
                                        'type': 'object'},
                    'WatchModelCredential': {'description': 'WatchModelCredential '
                                                            'returns a '
                                                            'NotifyWatcher that '
                                                            'watches what cloud '
                                                            'credential a model '
                                                            'uses.',
                                             'properties': {'Result': {'$ref': '#/definitions/NotifyWatchResult'}},
                                             'type': 'object'}},
     'type': 'object'}
    

    @ReturnMapping(ErrorResult)
    async def InvalidateModelCredential(self, reason=None):
        '''
        InvalidateModelCredential marks the cloud credential for this model as invalid.

        reason : str
        Returns -> ErrorResult
        '''
        if reason is not None and not isinstance(reason, (bytes, str)):
            raise Exception("Expected reason to be a str, received: {}".format(type(reason)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='CredentialValidator',
                   request='InvalidateModelCredential',
                   version=2,
                   params=_params)
        _params['reason'] = reason
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ModelCredential)
    async def ModelCredential(self):
        '''
        ModelCredential returns cloud credential information for a  model.


        Returns -> ModelCredential
        '''

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='CredentialValidator',
                   request='ModelCredential',
                   version=2,
                   params=_params)

        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(NotifyWatchResult)
    async def WatchCredential(self, tag=None):
        '''
        WatchCredential returns a NotifyWatcher that observes
        changes to a given cloud credential.

        tag : str
        Returns -> NotifyWatchResult
        '''
        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='CredentialValidator',
                   request='WatchCredential',
                   version=2,
                   params=_params)
        _params['tag'] = tag
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(NotifyWatchResult)
    async def WatchModelCredential(self):
        '''
        WatchModelCredential returns a NotifyWatcher that watches what cloud credential a model uses.


        Returns -> NotifyWatchResult
        '''

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='CredentialValidator',
                   request='WatchModelCredential',
                   version=2,
                   params=_params)

        reply = await self.rpc(msg)
        return reply



class CrossModelRelationsFacade(Type):
    name = 'CrossModelRelations'
    version = 2
    schema =     {'definitions': {'EntityStatus': {'additionalProperties': False,
                                      'properties': {'data': {'patternProperties': {'.*': {'additionalProperties': True,
                                                                                           'type': 'object'}},
                                                              'type': 'object'},
                                                     'info': {'type': 'string'},
                                                     'since': {'format': 'date-time',
                                                               'type': 'string'},
                                                     'status': {'type': 'string'}},
                                      'required': ['status', 'info', 'since'],
                                      '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'},
                     'IngressNetworksChangeEvent': {'additionalProperties': False,
                                                    'properties': {'application-token': {'type': 'string'},
                                                                   'bakery-version': {'type': 'integer'},
                                                                   'ingress-required': {'type': 'boolean'},
                                                                   'macaroons': {'items': {'$ref': '#/definitions/Macaroon'},
                                                                                 'type': 'array'},
                                                                   'networks': {'items': {'type': 'string'},
                                                                                'type': 'array'},
                                                                   'relation-token': {'type': 'string'}},
                                                    'required': ['relation-token',
                                                                 'application-token',
                                                                 'ingress-required'],
                                                    'type': 'object'},
                     'IngressNetworksChanges': {'additionalProperties': False,
                                                'properties': {'changes': {'items': {'$ref': '#/definitions/IngressNetworksChangeEvent'},
                                                                           'type': 'array'}},
                                                'type': 'object'},
                     'Macaroon': {'additionalProperties': False, 'type': 'object'},
                     'OfferArg': {'additionalProperties': False,
                                  'properties': {'bakery-version': {'type': 'integer'},
                                                 'macaroons': {'items': {'$ref': '#/definitions/Macaroon'},
                                                               'type': 'array'},
                                                 'offer-uuid': {'type': 'string'}},
                                  'required': ['offer-uuid'],
                                  'type': 'object'},
                     'OfferArgs': {'additionalProperties': False,
                                   'properties': {'args': {'items': {'$ref': '#/definitions/OfferArg'},
                                                           'type': 'array'}},
                                   'required': ['args'],
                                   'type': 'object'},
                     'OfferStatusChange': {'additionalProperties': False,
                                           'properties': {'offer-name': {'type': 'string'},
                                                          'status': {'$ref': '#/definitions/EntityStatus'}},
                                           'required': ['offer-name', 'status'],
                                           'type': 'object'},
                     'OfferStatusWatchResult': {'additionalProperties': False,
                                                'properties': {'changes': {'items': {'$ref': '#/definitions/OfferStatusChange'},
                                                                           'type': 'array'},
                                                               'error': {'$ref': '#/definitions/Error'},
                                                               'watcher-id': {'type': 'string'}},
                                                'required': ['watcher-id',
                                                             'changes'],
                                                'type': 'object'},
                     'OfferStatusWatchResults': {'additionalProperties': False,
                                                 'properties': {'results': {'items': {'$ref': '#/definitions/OfferStatusWatchResult'},
                                                                            'type': 'array'}},
                                                 'required': ['results'],
                                                 'type': 'object'},
                     'RegisterRemoteRelationArg': {'additionalProperties': False,
                                                   'properties': {'application-token': {'type': 'string'},
                                                                  'auth-token': {'type': 'string'},
                                                                  'bakery-version': {'type': 'integer'},
                                                                  'consume-version': {'type': 'integer'},
                                                                  'local-endpoint-name': {'type': 'string'},
                                                                  'macaroons': {'items': {'$ref': '#/definitions/Macaroon'},
                                                                                'type': 'array'},
                                                                  'offer-uuid': {'type': 'string'},
                                                                  'relation-token': {'type': 'string'},
                                                                  'remote-endpoint': {'$ref': '#/definitions/RemoteEndpoint'},
                                                                  'remote-space': {'$ref': '#/definitions/RemoteSpace'},
                                                                  'source-model-tag': {'type': 'string'}},
                                                   'required': ['application-token',
                                                                'source-model-tag',
                                                                'relation-token',
                                                                'remote-endpoint',
                                                                'remote-space',
                                                                'offer-uuid',
                                                                'local-endpoint-name'],
                                                   'type': 'object'},
                     'RegisterRemoteRelationArgs': {'additionalProperties': False,
                                                    'properties': {'relations': {'items': {'$ref': '#/definitions/RegisterRemoteRelationArg'},
                                                                                 'type': 'array'}},
                                                    'required': ['relations'],
                                                    'type': 'object'},
                     'RegisterRemoteRelationResult': {'additionalProperties': False,
                                                      'properties': {'error': {'$ref': '#/definitions/Error'},
                                                                     'result': {'$ref': '#/definitions/RemoteRelationDetails'}},
                                                      'type': 'object'},
                     'RegisterRemoteRelationResults': {'additionalProperties': False,
                                                       'properties': {'results': {'items': {'$ref': '#/definitions/RegisterRemoteRelationResult'},
                                                                                  'type': 'array'}},
                                                       'type': 'object'},
                     'RelationLifeSuspendedStatusChange': {'additionalProperties': False,
                                                           'properties': {'key': {'type': 'string'},
                                                                          'life': {'type': 'string'},
                                                                          'suspended': {'type': 'boolean'},
                                                                          'suspended-reason': {'type': 'string'}},
                                                           'required': ['key',
                                                                        'life',
                                                                        'suspended',
                                                                        'suspended-reason'],
                                                           'type': 'object'},
                     'RelationLifeSuspendedStatusWatchResult': {'additionalProperties': False,
                                                                'properties': {'changes': {'items': {'$ref': '#/definitions/RelationLifeSuspendedStatusChange'},
                                                                                           'type': 'array'},
                                                                               'error': {'$ref': '#/definitions/Error'},
                                                                               'watcher-id': {'type': 'string'}},
                                                                'required': ['watcher-id',
                                                                             'changes'],
                                                                'type': 'object'},
                     'RelationStatusWatchResults': {'additionalProperties': False,
                                                    'properties': {'results': {'items': {'$ref': '#/definitions/RelationLifeSuspendedStatusWatchResult'},
                                                                               'type': 'array'}},
                                                    'required': ['results'],
                                                    'type': 'object'},
                     'RemoteEndpoint': {'additionalProperties': False,
                                        'properties': {'interface': {'type': 'string'},
                                                       'limit': {'type': 'integer'},
                                                       'name': {'type': 'string'},
                                                       'role': {'type': 'string'}},
                                        'required': ['name',
                                                     'role',
                                                     'interface',
                                                     'limit'],
                                        'type': 'object'},
                     'RemoteEntityArg': {'additionalProperties': False,
                                         'properties': {'bakery-version': {'type': 'integer'},
                                                        'macaroons': {'items': {'$ref': '#/definitions/Macaroon'},
                                                                      'type': 'array'},
                                                        'relation-token': {'type': 'string'}},
                                         'required': ['relation-token'],
                                         'type': 'object'},
                     'RemoteEntityArgs': {'additionalProperties': False,
                                          'properties': {'args': {'items': {'$ref': '#/definitions/RemoteEntityArg'},
                                                                  'type': 'array'}},
                                          'required': ['args'],
                                          'type': 'object'},
                     'RemoteRelationChangeEvent': {'additionalProperties': False,
                                                   'properties': {'application-settings': {'patternProperties': {'.*': {'additionalProperties': True,
                                                                                                                        'type': 'object'}},
                                                                                           'type': 'object'},
                                                                  'application-token': {'type': 'string'},
                                                                  'bakery-version': {'type': 'integer'},
                                                                  'changed-units': {'items': {'$ref': '#/definitions/RemoteRelationUnitChange'},
                                                                                    'type': 'array'},
                                                                  'departed-units': {'items': {'type': 'integer'},
                                                                                     'type': 'array'},
                                                                  'force-cleanup': {'type': 'boolean'},
                                                                  'life': {'type': 'string'},
                                                                  'macaroons': {'items': {'$ref': '#/definitions/Macaroon'},
                                                                                'type': 'array'},
                                                                  'relation-token': {'type': 'string'},
                                                                  'suspended': {'type': 'boolean'},
                                                                  'suspended-reason': {'type': 'string'},
                                                                  'unit-count': {'type': 'integer'}},
                                                   'required': ['relation-token',
                                                                'application-token',
                                                                'life',
                                                                'unit-count'],
                                                   'type': 'object'},
                     'RemoteRelationDetails': {'additionalProperties': False,
                                               'properties': {'bakery-version': {'type': 'integer'},
                                                              'macaroon': {'$ref': '#/definitions/Macaroon'},
                                                              'relation-token': {'type': 'string'}},
                                               'required': ['relation-token'],
                                               'type': 'object'},
                     'RemoteRelationUnitChange': {'additionalProperties': False,
                                                  'properties': {'settings': {'patternProperties': {'.*': {'additionalProperties': True,
                                                                                                           'type': 'object'}},
                                                                              'type': 'object'},
                                                                 'unit-id': {'type': 'integer'}},
                                                  'required': ['unit-id'],
                                                  'type': 'object'},
                     'RemoteRelationWatchResult': {'additionalProperties': False,
                                                   'properties': {'changes': {'$ref': '#/definitions/RemoteRelationChangeEvent'},
                                                                  'error': {'$ref': '#/definitions/Error'},
                                                                  'watcher-id': {'type': 'string'}},
                                                   'required': ['watcher-id',
                                                                'changes'],
                                                   'type': 'object'},
                     'RemoteRelationWatchResults': {'additionalProperties': False,
                                                    'properties': {'results': {'items': {'$ref': '#/definitions/RemoteRelationWatchResult'},
                                                                               'type': 'array'}},
                                                    'required': ['results'],
                                                    'type': 'object'},
                     'RemoteRelationsChanges': {'additionalProperties': False,
                                                'properties': {'changes': {'items': {'$ref': '#/definitions/RemoteRelationChangeEvent'},
                                                                           'type': 'array'}},
                                                'type': 'object'},
                     'RemoteSpace': {'additionalProperties': False,
                                     'properties': {'cloud-type': {'type': 'string'},
                                                    'name': {'type': 'string'},
                                                    'provider-attributes': {'patternProperties': {'.*': {'additionalProperties': True,
                                                                                                         'type': 'object'}},
                                                                            'type': 'object'},
                                                    'provider-id': {'type': 'string'},
                                                    'subnets': {'items': {'$ref': '#/definitions/Subnet'},
                                                                'type': 'array'}},
                                     'required': ['cloud-type',
                                                  'name',
                                                  'provider-id',
                                                  'provider-attributes',
                                                  'subnets'],
                                     'type': 'object'},
                     'SecretRevisionChange': {'additionalProperties': False,
                                              'properties': {'revision': {'type': 'integer'},
                                                             'uri': {'type': 'string'}},
                                              'required': ['uri', 'revision'],
                                              'type': 'object'},
                     'SecretRevisionWatchResult': {'additionalProperties': False,
                                                   'properties': {'changes': {'items': {'$ref': '#/definitions/SecretRevisionChange'},
                                                                              'type': 'array'},
                                                                  'error': {'$ref': '#/definitions/Error'},
                                                                  'watcher-id': {'type': 'string'}},
                                                   'required': ['watcher-id',
                                                                'changes'],
                                                   'type': 'object'},
                     'SecretRevisionWatchResults': {'additionalProperties': False,
                                                    'properties': {'results': {'items': {'$ref': '#/definitions/SecretRevisionWatchResult'},
                                                                               'type': 'array'}},
                                                    'required': ['results'],
                                                    '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'},
                     'StringsWatchResults': {'additionalProperties': False,
                                             'properties': {'results': {'items': {'$ref': '#/definitions/StringsWatchResult'},
                                                                        'type': 'array'}},
                                             'required': ['results'],
                                             'type': 'object'},
                     'Subnet': {'additionalProperties': False,
                                'properties': {'cidr': {'type': 'string'},
                                               'life': {'type': 'string'},
                                               'provider-id': {'type': 'string'},
                                               'provider-network-id': {'type': 'string'},
                                               'provider-space-id': {'type': 'string'},
                                               'space-tag': {'type': 'string'},
                                               'status': {'type': 'string'},
                                               'vlan-tag': {'type': 'integer'},
                                               'zones': {'items': {'type': 'string'},
                                                         'type': 'array'}},
                                'required': ['cidr',
                                             'vlan-tag',
                                             'life',
                                             'space-tag',
                                             'zones'],
                                'type': 'object'},
                     'WatchRemoteSecretChangesArg': {'additionalProperties': False,
                                                     'properties': {'application-token': {'type': 'string'},
                                                                    'bakery-version': {'type': 'integer'},
                                                                    'macaroons': {'items': {'$ref': '#/definitions/Macaroon'},
                                                                                  'type': 'array'}},
                                                     'required': ['application-token'],
                                                     'type': 'object'},
                     'WatchRemoteSecretChangesArgs': {'additionalProperties': False,
                                                      'properties': {'relations': {'items': {'$ref': '#/definitions/WatchRemoteSecretChangesArg'},
                                                                                   'type': 'array'}},
                                                      'required': ['relations'],
                                                      'type': 'object'}},
     'properties': {'PublishIngressNetworkChanges': {'description': 'PublishIngressNetworkChanges '
                                                                    'publishes '
                                                                    'changes to '
                                                                    'the required\n'
                                                                    'ingress '
                                                                    'addresses to '
                                                                    'the model '
                                                                    'hosting the '
                                                                    'offer in the '
                                                                    'relation.',
                                                     'properties': {'Params': {'$ref': '#/definitions/IngressNetworksChanges'},
                                                                    'Result': {'$ref': '#/definitions/ErrorResults'}},
                                                     'type': 'object'},
                    'PublishRelationChanges': {'description': 'PublishRelationChanges '
                                                              'publishes relation '
                                                              'changes to the\n'
                                                              'model hosting the '
                                                              'remote application '
                                                              'involved in the '
                                                              'relation.',
                                               'properties': {'Params': {'$ref': '#/definitions/RemoteRelationsChanges'},
                                                              'Result': {'$ref': '#/definitions/ErrorResults'}},
                                               'type': 'object'},
                    'RegisterRemoteRelations': {'description': 'RegisterRemoteRelations '
                                                               'sets up the model '
                                                               'to participate\n'
                                                               'in the specified '
                                                               'relations. This '
                                                               'operation is '
                                                               'idempotent.',
                                                'properties': {'Params': {'$ref': '#/definitions/RegisterRemoteRelationArgs'},
                                                               'Result': {'$ref': '#/definitions/RegisterRemoteRelationResults'}},
                                                'type': 'object'},
                    'WatchConsumedSecretsChanges': {'description': 'WatchConsumedSecretsChanges '
                                                                   'returns a '
                                                                   'watcher which '
                                                                   'notifies of '
                                                                   'changes to any '
                                                                   'secrets\n'
                                                                   'for the '
                                                                   'specified '
                                                                   'remote '
                                                                   'consumers.',
                                                    'properties': {'Params': {'$ref': '#/definitions/WatchRemoteSecretChangesArgs'},
                                                                   'Result': {'$ref': '#/definitions/SecretRevisionWatchResults'}},
                                                    'type': 'object'},
                    'WatchEgressAddressesForRelations': {'description': 'WatchEgressAddressesForRelations '
                                                                        'creates a '
                                                                        'watcher '
                                                                        'that '
                                                                        'notifies '
                                                                        'when '
                                                                        'addresses, '
                                                                        'from '
                                                                        'which\n'
                                                                        'connections '
                                                                        'will '
                                                                        'originate '
                                                                        'for the '
                                                                        'relation, '
                                                                        'change.\n'
                                                                        'Each '
                                                                        'event '
                                                                        'contains '
                                                                        'the '
                                                                        'entire '
                                                                        'set of '
                                                                        'addresses '
                                                                        'which are '
                                                                        'required '
                                                                        'for '
                                                                        'ingress '
                                                                        'for the '
                                                                        'relation.',
                                                         'properties': {'Params': {'$ref': '#/definitions/RemoteEntityArgs'},
                                                                        'Result': {'$ref': '#/definitions/StringsWatchResults'}},
                                                         'type': 'object'},
                    'WatchOfferStatus': {'description': 'WatchOfferStatus starts '
                                                        'an OfferStatusWatcher '
                                                        'for\n'
                                                        'watching the status of an '
                                                        'offer.',
                                         'properties': {'Params': {'$ref': '#/definitions/OfferArgs'},
                                                        'Result': {'$ref': '#/definitions/OfferStatusWatchResults'}},
                                         'type': 'object'},
                    'WatchRelationChanges': {'description': 'WatchRelationChanges '
                                                            'starts a '
                                                            'RemoteRelationChangesWatcher '
                                                            'for each\n'
                                                            'specified relation, '
                                                            'returning the watcher '
                                                            'IDs and initial '
                                                            'values,\n'
                                                            'or an error if the '
                                                            'remote relations '
                                                            "couldn't be watched.",
                                             'properties': {'Params': {'$ref': '#/definitions/RemoteEntityArgs'},
                                                            'Result': {'$ref': '#/definitions/RemoteRelationWatchResults'}},
                                             'type': 'object'},
                    'WatchRelationsSuspendedStatus': {'description': 'WatchRelationsSuspendedStatus '
                                                                     'starts a '
                                                                     'RelationStatusWatcher '
                                                                     'for\n'
                                                                     'watching the '
                                                                     'life and '
                                                                     'suspended '
                                                                     'status of a '
                                                                     'relation.',
                                                      'properties': {'Params': {'$ref': '#/definitions/RemoteEntityArgs'},
                                                                     'Result': {'$ref': '#/definitions/RelationStatusWatchResults'}},
                                                      'type': 'object'}},
     'type': 'object'}
    

    @ReturnMapping(ErrorResults)
    async def PublishIngressNetworkChanges(self, changes=None):
        '''
        PublishIngressNetworkChanges publishes changes to the required
        ingress addresses to the model hosting the offer in the relation.

        changes : typing.Sequence[~IngressNetworksChangeEvent]
        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='CrossModelRelations',
                   request='PublishIngressNetworkChanges',
                   version=2,
                   params=_params)
        _params['changes'] = changes
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ErrorResults)
    async def PublishRelationChanges(self, changes=None):
        '''
        PublishRelationChanges publishes relation changes to the
        model hosting the remote application involved in the relation.

        changes : typing.Sequence[~RemoteRelationChangeEvent]
        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='CrossModelRelations',
                   request='PublishRelationChanges',
                   version=2,
                   params=_params)
        _params['changes'] = changes
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(RegisterRemoteRelationResults)
    async def RegisterRemoteRelations(self, relations=None):
        '''
        RegisterRemoteRelations sets up the model to participate
        in the specified relations. This operation is idempotent.

        relations : typing.Sequence[~RegisterRemoteRelationArg]
        Returns -> RegisterRemoteRelationResults
        '''
        if relations is not None and not isinstance(relations, (bytes, str, list)):
            raise Exception("Expected relations to be a Sequence, received: {}".format(type(relations)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='CrossModelRelations',
                   request='RegisterRemoteRelations',
                   version=2,
                   params=_params)
        _params['relations'] = relations
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(SecretRevisionWatchResults)
    async def WatchConsumedSecretsChanges(self, relations=None):
        '''
        WatchConsumedSecretsChanges returns a watcher which notifies of changes to any secrets
        for the specified remote consumers.

        relations : typing.Sequence[~WatchRemoteSecretChangesArg]
        Returns -> SecretRevisionWatchResults
        '''
        if relations is not None and not isinstance(relations, (bytes, str, list)):
            raise Exception("Expected relations to be a Sequence, received: {}".format(type(relations)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='CrossModelRelations',
                   request='WatchConsumedSecretsChanges',
                   version=2,
                   params=_params)
        _params['relations'] = relations
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(StringsWatchResults)
    async def WatchEgressAddressesForRelations(self, args=None):
        '''
        WatchEgressAddressesForRelations creates a watcher that notifies when addresses, from which
        connections will originate for the relation, change.
        Each event contains the entire set of addresses which are required for ingress for the relation.

        args : typing.Sequence[~RemoteEntityArg]
        Returns -> StringsWatchResults
        '''
        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='CrossModelRelations',
                   request='WatchEgressAddressesForRelations',
                   version=2,
                   params=_params)
        _params['args'] = args
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(OfferStatusWatchResults)
    async def WatchOfferStatus(self, args=None):
        '''
        WatchOfferStatus starts an OfferStatusWatcher for
        watching the status of an offer.

        args : typing.Sequence[~OfferArg]
        Returns -> OfferStatusWatchResults
        '''
        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='CrossModelRelations',
                   request='WatchOfferStatus',
                   version=2,
                   params=_params)
        _params['args'] = args
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(RemoteRelationWatchResults)
    async def WatchRelationChanges(self, args=None):
        '''
        WatchRelationChanges starts a RemoteRelationChangesWatcher for each
        specified relation, returning the watcher IDs and initial values,
        or an error if the remote relations couldn't be watched.

        args : typing.Sequence[~RemoteEntityArg]
        Returns -> RemoteRelationWatchResults
        '''
        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='CrossModelRelations',
                   request='WatchRelationChanges',
                   version=2,
                   params=_params)
        _params['args'] = args
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(RelationStatusWatchResults)
    async def WatchRelationsSuspendedStatus(self, args=None):
        '''
        WatchRelationsSuspendedStatus starts a RelationStatusWatcher for
        watching the life and suspended status of a relation.

        args : typing.Sequence[~RemoteEntityArg]
        Returns -> RelationStatusWatchResults
        '''
        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='CrossModelRelations',
                   request='WatchRelationsSuspendedStatus',
                   version=2,
                   params=_params)
        _params['args'] = args
        reply = await self.rpc(msg)
        return reply



class DiskManagerFacade(Type):
    name = 'DiskManager'
    version = 2
    schema =     {'definitions': {'BlockDevice': {'additionalProperties': False,
                                     'properties': {'BusAddress': {'type': 'string'},
                                                    'DeviceLinks': {'items': {'type': 'string'},
                                                                    'type': 'array'},
                                                    'DeviceName': {'type': 'string'},
                                                    'FilesystemType': {'type': 'string'},
                                                    'HardwareId': {'type': 'string'},
                                                    'InUse': {'type': 'boolean'},
                                                    'Label': {'type': 'string'},
                                                    'MountPoint': {'type': 'string'},
                                                    'SerialId': {'type': 'string'},
                                                    'Size': {'type': 'integer'},
                                                    'UUID': {'type': 'string'},
                                                    'WWN': {'type': 'string'}},
                                     'required': ['DeviceName',
                                                  'DeviceLinks',
                                                  'Label',
                                                  'UUID',
                                                  'HardwareId',
                                                  'WWN',
                                                  'BusAddress',
                                                  'Size',
                                                  'FilesystemType',
                                                  'InUse',
                                                  'MountPoint',
                                                  'SerialId'],
                                     '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'},
                     'MachineBlockDevices': {'additionalProperties': False,
                                             'properties': {'block-devices': {'items': {'$ref': '#/definitions/BlockDevice'},
                                                                              'type': 'array'},
                                                            'machine': {'type': 'string'}},
                                             'required': ['machine'],
                                             'type': 'object'},
                     'SetMachineBlockDevices': {'additionalProperties': False,
                                                'properties': {'machine-block-devices': {'items': {'$ref': '#/definitions/MachineBlockDevices'},
                                                                                         'type': 'array'}},
                                                'required': ['machine-block-devices'],
                                                'type': 'object'}},
     'properties': {'SetMachineBlockDevices': {'properties': {'Params': {'$ref': '#/definitions/SetMachineBlockDevices'},
                                                              'Result': {'$ref': '#/definitions/ErrorResults'}},
                                               'type': 'object'}},
     'type': 'object'}
    

    @ReturnMapping(ErrorResults)
    async def SetMachineBlockDevices(self, machine_block_devices=None):
        '''
        machine_block_devices : typing.Sequence[~MachineBlockDevices]
        Returns -> ErrorResults
        '''
        if machine_block_devices is not None and not isinstance(machine_block_devices, (bytes, str, list)):
            raise Exception("Expected machine_block_devices to be a Sequence, received: {}".format(type(machine_block_devices)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='DiskManager',
                   request='SetMachineBlockDevices',
                   version=2,
                   params=_params)
        _params['machine-block-devices'] = machine_block_devices
        reply = await self.rpc(msg)
        return reply



class EntityWatcherFacade(Type):
    name = 'EntityWatcher'
    version = 2
    schema =     {'definitions': {'EntitiesWatchResult': {'additionalProperties': False,
                                             'properties': {'changes': {'items': {'type': 'string'},
                                                                        'type': 'array'},
                                                            'error': {'$ref': '#/definitions/Error'},
                                                            'watcher-id': {'type': 'string'}},
                                             'required': ['watcher-id'],
                                             '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'}},
     'properties': {'Next': {'description': 'Next returns when a change has '
                                            'occurred to an entity of the\n'
                                            'collection being watched since the '
                                            'most recent call to Next\n'
                                            'or the Watch call that created the '
                                            'srvEntitiesWatcher.',
                             'properties': {'Result': {'$ref': '#/definitions/EntitiesWatchResult'}},
                             'type': 'object'},
                    'Stop': {'description': 'Stop stops the watcher.',
                             'type': 'object'}},
     'type': 'object'}
    

    @ReturnMapping(EntitiesWatchResult)
    async def Next(self):
        '''
        Next returns when a change has occurred to an entity of the
        collection being watched since the most recent call to Next
        or the Watch call that created the srvEntitiesWatcher.


        Returns -> EntitiesWatchResult
        '''

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='EntityWatcher',
                   request='Next',
                   version=2,
                   params=_params)

        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(None)
    async def Stop(self):
        '''
        Stop stops the watcher.


        Returns -> None
        '''

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='EntityWatcher',
                   request='Stop',
                   version=2,
                   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



class FilesystemAttachmentsWatcherFacade(Type):
    name = 'FilesystemAttachmentsWatcher'
    version = 2
    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'},
                     'MachineStorageId': {'additionalProperties': False,
                                          'properties': {'attachment-tag': {'type': 'string'},
                                                         'machine-tag': {'type': 'string'}},
                                          'required': ['machine-tag',
                                                       'attachment-tag'],
                                          'type': 'object'},
                     'MachineStorageIdsWatchResult': {'additionalProperties': False,
                                                      'properties': {'changes': {'items': {'$ref': '#/definitions/MachineStorageId'},
                                                                                 'type': 'array'},
                                                                     'error': {'$ref': '#/definitions/Error'},
                                                                     'watcher-id': {'type': 'string'}},
                                                      'required': ['watcher-id',
                                                                   'changes'],
                                                      'type': 'object'}},
     'properties': {'Next': {'description': 'Next returns when a change has '
                                            'occurred to an entity of the\n'
                                            'collection being watched since the '
                                            'most recent call to Next\n'
                                            'or the Watch call that created the '
                                            'srvMachineStorageIdsWatcher.',
                             'properties': {'Result': {'$ref': '#/definitions/MachineStorageIdsWatchResult'}},
                             'type': 'object'},
                    'Stop': {'description': 'Stop stops the watcher.',
                             'type': 'object'}},
     'type': 'object'}
    

    @ReturnMapping(MachineStorageIdsWatchResult)
    async def Next(self):
        '''
        Next returns when a change has occurred to an entity of the
        collection being watched since the most recent call to Next
        or the Watch call that created the srvMachineStorageIdsWatcher.


        Returns -> MachineStorageIdsWatchResult
        '''

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='FilesystemAttachmentsWatcher',
                   request='Next',
                   version=2,
                   params=_params)

        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(None)
    async def Stop(self):
        '''
        Stop stops the watcher.


        Returns -> None
        '''

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='FilesystemAttachmentsWatcher',
                   request='Stop',
                   version=2,
                   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



class HighAvailabilityFacade(Type):
    name = 'HighAvailability'
    version = 2
    schema =     {'definitions': {'ControllersChangeResult': {'additionalProperties': False,
                                                 'properties': {'error': {'$ref': '#/definitions/Error'},
                                                                'result': {'$ref': '#/definitions/ControllersChanges'}},
                                                 'required': ['result'],
                                                 'type': 'object'},
                     'ControllersChangeResults': {'additionalProperties': False,
                                                  'properties': {'results': {'items': {'$ref': '#/definitions/ControllersChangeResult'},
                                                                             'type': 'array'}},
                                                  'required': ['results'],
                                                  'type': 'object'},
                     'ControllersChanges': {'additionalProperties': False,
                                            'properties': {'added': {'items': {'type': 'string'},
                                                                     'type': 'array'},
                                                           'converted': {'items': {'type': 'string'},
                                                                         'type': 'array'},
                                                           'maintained': {'items': {'type': 'string'},
                                                                          'type': 'array'},
                                                           'removed': {'items': {'type': 'string'},
                                                                       'type': 'array'}},
                                            'type': 'object'},
                     'ControllersSpec': {'additionalProperties': False,
                                         'properties': {'constraints': {'$ref': '#/definitions/Value'},
                                                        'num-controllers': {'type': 'integer'},
                                                        'placement': {'items': {'type': 'string'},
                                                                      'type': 'array'}},
                                         'required': ['num-controllers'],
                                         'type': 'object'},
                     'ControllersSpecs': {'additionalProperties': False,
                                          'properties': {'specs': {'items': {'$ref': '#/definitions/ControllersSpec'},
                                                                   'type': 'array'}},
                                          'required': ['specs'],
                                          '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'},
                     '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': {'EnableHA': {'description': 'EnableHA adds controller machines '
                                                'as necessary to ensure the\n'
                                                'controller has the number of '
                                                'machines specified.',
                                 'properties': {'Params': {'$ref': '#/definitions/ControllersSpecs'},
                                                'Result': {'$ref': '#/definitions/ControllersChangeResults'}},
                                 'type': 'object'}},
     'type': 'object'}
    

    @ReturnMapping(ControllersChangeResults)
    async def EnableHA(self, specs=None):
        '''
        EnableHA adds controller machines as necessary to ensure the
        controller has the number of machines specified.

        specs : typing.Sequence[~ControllersSpec]
        Returns -> ControllersChangeResults
        '''
        if specs is not None and not isinstance(specs, (bytes, str, list)):
            raise Exception("Expected specs to be a Sequence, received: {}".format(type(specs)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='HighAvailability',
                   request='EnableHA',
                   version=2,
                   params=_params)
        _params['specs'] = specs
        reply = await self.rpc(msg)
        return reply



class LeadershipServiceFacade(Type):
    name = 'LeadershipService'
    version = 2
    schema =     {'definitions': {'ApplicationTag': {'additionalProperties': False,
                                        'properties': {'Name': {'type': 'string'}},
                                        'required': ['Name'],
                                        'type': 'object'},
                     'ClaimLeadershipBulkParams': {'additionalProperties': False,
                                                   'properties': {'params': {'items': {'$ref': '#/definitions/ClaimLeadershipParams'},
                                                                             'type': 'array'}},
                                                   'required': ['params'],
                                                   'type': 'object'},
                     'ClaimLeadershipBulkResults': {'additionalProperties': False,
                                                    'properties': {'results': {'items': {'$ref': '#/definitions/ErrorResult'},
                                                                               'type': 'array'}},
                                                    'required': ['results'],
                                                    'type': 'object'},
                     'ClaimLeadershipParams': {'additionalProperties': False,
                                               'properties': {'application-tag': {'type': 'string'},
                                                              'duration': {'type': 'number'},
                                                              'unit-tag': {'type': 'string'}},
                                               'required': ['application-tag',
                                                            'unit-tag',
                                                            'duration'],
                                               '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'}},
     'properties': {'BlockUntilLeadershipReleased': {'description': 'BlockUntilLeadershipReleased '
                                                                    'blocks the '
                                                                    'caller until '
                                                                    'leadership '
                                                                    'is\n'
                                                                    'released for '
                                                                    'the given '
                                                                    'service.',
                                                     'properties': {'Params': {'$ref': '#/definitions/ApplicationTag'},
                                                                    'Result': {'$ref': '#/definitions/ErrorResult'}},
                                                     'type': 'object'},
                    'ClaimLeadership': {'description': 'ClaimLeadership makes a '
                                                       'leadership claim with the '
                                                       'given parameters.',
                                        'properties': {'Params': {'$ref': '#/definitions/ClaimLeadershipBulkParams'},
                                                       'Result': {'$ref': '#/definitions/ClaimLeadershipBulkResults'}},
                                        'type': 'object'}},
     'type': 'object'}
    

    @ReturnMapping(ErrorResult)
    async def BlockUntilLeadershipReleased(self, name=None):
        '''
        BlockUntilLeadershipReleased blocks the caller until leadership is
        released for the given service.

        name : str
        Returns -> ErrorResult
        '''
        if name is not None and not isinstance(name, (bytes, str)):
            raise Exception("Expected name to be a str, received: {}".format(type(name)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='LeadershipService',
                   request='BlockUntilLeadershipReleased',
                   version=2,
                   params=_params)
        _params['Name'] = name
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ClaimLeadershipBulkResults)
    async def ClaimLeadership(self, params=None):
        '''
        ClaimLeadership makes a leadership claim with the given parameters.

        params : typing.Sequence[~ClaimLeadershipParams]
        Returns -> ClaimLeadershipBulkResults
        '''
        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='LeadershipService',
                   request='ClaimLeadership',
                   version=2,
                   params=_params)
        _params['params'] = params
        reply = await self.rpc(msg)
        return reply



class MeterStatusFacade(Type):
    name = 'MeterStatus'
    version = 2
    schema =     {'definitions': {'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'},
                     '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'},
                     'MeterStatusResult': {'additionalProperties': False,
                                           'properties': {'code': {'type': 'string'},
                                                          'error': {'$ref': '#/definitions/Error'},
                                                          'info': {'type': 'string'}},
                                           'required': ['code', 'info'],
                                           'type': 'object'},
                     'MeterStatusResults': {'additionalProperties': False,
                                            'properties': {'results': {'items': {'$ref': '#/definitions/MeterStatusResult'},
                                                                       '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'},
                     'SetUnitStateArg': {'additionalProperties': False,
                                         'properties': {'charm-state': {'patternProperties': {'.*': {'type': 'string'}},
                                                                        'type': 'object'},
                                                        'meter-status-state': {'type': 'string'},
                                                        'relation-state': {'patternProperties': {'.*': {'type': 'string'}},
                                                                           'type': 'object'},
                                                        'secret-state': {'type': 'string'},
                                                        'storage-state': {'type': 'string'},
                                                        'tag': {'type': 'string'},
                                                        'uniter-state': {'type': 'string'}},
                                         'required': ['tag'],
                                         'type': 'object'},
                     'SetUnitStateArgs': {'additionalProperties': False,
                                          'properties': {'args': {'items': {'$ref': '#/definitions/SetUnitStateArg'},
                                                                  'type': 'array'}},
                                          'required': ['args'],
                                          'type': 'object'},
                     'UnitStateResult': {'additionalProperties': False,
                                         'properties': {'charm-state': {'patternProperties': {'.*': {'type': 'string'}},
                                                                        'type': 'object'},
                                                        'error': {'$ref': '#/definitions/Error'},
                                                        'meter-status-state': {'type': 'string'},
                                                        'relation-state': {'patternProperties': {'.*': {'type': 'string'}},
                                                                           'type': 'object'},
                                                        'secret-state': {'type': 'string'},
                                                        'storage-state': {'type': 'string'},
                                                        'uniter-state': {'type': 'string'}},
                                         'type': 'object'},
                     'UnitStateResults': {'additionalProperties': False,
                                          'properties': {'results': {'items': {'$ref': '#/definitions/UnitStateResult'},
                                                                     'type': 'array'}},
                                          'required': ['results'],
                                          'type': 'object'}},
     'properties': {'GetMeterStatus': {'description': 'GetMeterStatus returns '
                                                      'meter status information '
                                                      'for each unit.',
                                       'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                      'Result': {'$ref': '#/definitions/MeterStatusResults'}},
                                       'type': 'object'},
                    'SetState': {'description': 'SetState sets the state persisted '
                                                'by the charm running in this '
                                                'unit\n'
                                                'and the state internal to the '
                                                'uniter for this unit.',
                                 'properties': {'Params': {'$ref': '#/definitions/SetUnitStateArgs'},
                                                'Result': {'$ref': '#/definitions/ErrorResults'}},
                                 'type': 'object'},
                    'State': {'description': 'State returns the state persisted by '
                                             'the charm running in this unit\n'
                                             'and the state internal to the uniter '
                                             'for this unit.',
                              'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                             'Result': {'$ref': '#/definitions/UnitStateResults'}},
                              'type': 'object'},
                    'WatchMeterStatus': {'description': 'WatchMeterStatus returns '
                                                        'a NotifyWatcher for '
                                                        'observing changes\n'
                                                        "to each unit's meter "
                                                        'status.',
                                         'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                        'Result': {'$ref': '#/definitions/NotifyWatchResults'}},
                                         'type': 'object'}},
     'type': 'object'}
    

    @ReturnMapping(MeterStatusResults)
    async def GetMeterStatus(self, entities=None):
        '''
        GetMeterStatus returns meter status information for each unit.

        entities : typing.Sequence[~Entity]
        Returns -> MeterStatusResults
        '''
        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='MeterStatus',
                   request='GetMeterStatus',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ErrorResults)
    async def SetState(self, args=None):
        '''
        SetState sets the state persisted by the charm running in this unit
        and the state internal to the uniter for this unit.

        args : typing.Sequence[~SetUnitStateArg]
        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='MeterStatus',
                   request='SetState',
                   version=2,
                   params=_params)
        _params['args'] = args
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(UnitStateResults)
    async def State(self, entities=None):
        '''
        State returns the state persisted by the charm running in this unit
        and the state internal to the uniter for this unit.

        entities : typing.Sequence[~Entity]
        Returns -> UnitStateResults
        '''
        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='MeterStatus',
                   request='State',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(NotifyWatchResults)
    async def WatchMeterStatus(self, entities=None):
        '''
        WatchMeterStatus returns a NotifyWatcher for observing changes
        to each unit's meter status.

        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='MeterStatus',
                   request='WatchMeterStatus',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



class MetricsAdderFacade(Type):
    name = 'MetricsAdder'
    version = 2
    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'},
                     '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'},
                     'Metric': {'additionalProperties': False,
                                'properties': {'key': {'type': 'string'},
                                               'labels': {'patternProperties': {'.*': {'type': 'string'}},
                                                          'type': 'object'},
                                               'time': {'format': 'date-time',
                                                        'type': 'string'},
                                               'value': {'type': 'string'}},
                                'required': ['key', 'value', 'time'],
                                'type': 'object'},
                     'MetricBatch': {'additionalProperties': False,
                                     'properties': {'charm-url': {'type': 'string'},
                                                    'created': {'format': 'date-time',
                                                                'type': 'string'},
                                                    'metrics': {'items': {'$ref': '#/definitions/Metric'},
                                                                'type': 'array'},
                                                    'uuid': {'type': 'string'}},
                                     'required': ['uuid',
                                                  'charm-url',
                                                  'created',
                                                  'metrics'],
                                     'type': 'object'},
                     'MetricBatchParam': {'additionalProperties': False,
                                          'properties': {'batch': {'$ref': '#/definitions/MetricBatch'},
                                                         'tag': {'type': 'string'}},
                                          'required': ['tag', 'batch'],
                                          'type': 'object'},
                     'MetricBatchParams': {'additionalProperties': False,
                                           'properties': {'batches': {'items': {'$ref': '#/definitions/MetricBatchParam'},
                                                                      'type': 'array'}},
                                           'required': ['batches'],
                                           'type': 'object'}},
     'properties': {'AddMetricBatches': {'description': 'AddMetricBatches '
                                                        'implements the '
                                                        'MetricsAdder interface.',
                                         'properties': {'Params': {'$ref': '#/definitions/MetricBatchParams'},
                                                        'Result': {'$ref': '#/definitions/ErrorResults'}},
                                         'type': 'object'}},
     'type': 'object'}
    

    @ReturnMapping(ErrorResults)
    async def AddMetricBatches(self, batches=None):
        '''
        AddMetricBatches implements the MetricsAdder interface.

        batches : typing.Sequence[~MetricBatchParam]
        Returns -> ErrorResults
        '''
        if batches is not None and not isinstance(batches, (bytes, str, list)):
            raise Exception("Expected batches to be a Sequence, received: {}".format(type(batches)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='MetricsAdder',
                   request='AddMetricBatches',
                   version=2,
                   params=_params)
        _params['batches'] = batches
        reply = await self.rpc(msg)
        return reply



class MetricsDebugFacade(Type):
    name = 'MetricsDebug'
    version = 2
    schema =     {'definitions': {'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'},
                     'EntityMetrics': {'additionalProperties': False,
                                       'properties': {'error': {'$ref': '#/definitions/Error'},
                                                      'metrics': {'items': {'$ref': '#/definitions/MetricResult'},
                                                                  'type': 'array'}},
                                       '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'},
                     'MeterStatusParam': {'additionalProperties': False,
                                          'properties': {'code': {'type': 'string'},
                                                         'info': {'type': 'string'},
                                                         'tag': {'type': 'string'}},
                                          'required': ['tag', 'code'],
                                          'type': 'object'},
                     'MeterStatusParams': {'additionalProperties': False,
                                           'properties': {'statues': {'items': {'$ref': '#/definitions/MeterStatusParam'},
                                                                      'type': 'array'}},
                                           'required': ['statues'],
                                           'type': 'object'},
                     'MetricResult': {'additionalProperties': False,
                                      'properties': {'key': {'type': 'string'},
                                                     'labels': {'patternProperties': {'.*': {'type': 'string'}},
                                                                'type': 'object'},
                                                     'time': {'format': 'date-time',
                                                              'type': 'string'},
                                                     'unit': {'type': 'string'},
                                                     'value': {'type': 'string'}},
                                      'required': ['time',
                                                   'key',
                                                   'value',
                                                   'unit',
                                                   'labels'],
                                      'type': 'object'},
                     'MetricResults': {'additionalProperties': False,
                                       'properties': {'results': {'items': {'$ref': '#/definitions/EntityMetrics'},
                                                                  'type': 'array'}},
                                       'required': ['results'],
                                       'type': 'object'}},
     'properties': {'GetMetrics': {'description': 'GetMetrics returns all metrics '
                                                  'stored by the state server.',
                                   'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                  'Result': {'$ref': '#/definitions/MetricResults'}},
                                   'type': 'object'},
                    'SetMeterStatus': {'description': 'SetMeterStatus sets meter '
                                                      'statuses for entities.',
                                       'properties': {'Params': {'$ref': '#/definitions/MeterStatusParams'},
                                                      'Result': {'$ref': '#/definitions/ErrorResults'}},
                                       'type': 'object'}},
     'type': 'object'}
    

    @ReturnMapping(MetricResults)
    async def GetMetrics(self, entities=None):
        '''
        GetMetrics returns all metrics stored by the state server.

        entities : typing.Sequence[~Entity]
        Returns -> MetricResults
        '''
        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='MetricsDebug',
                   request='GetMetrics',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ErrorResults)
    async def SetMeterStatus(self, statues=None):
        '''
        SetMeterStatus sets meter statuses for entities.

        statues : typing.Sequence[~MeterStatusParam]
        Returns -> ErrorResults
        '''
        if statues is not None and not isinstance(statues, (bytes, str, list)):
            raise Exception("Expected statues to be a Sequence, received: {}".format(type(statues)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='MetricsDebug',
                   request='SetMeterStatus',
                   version=2,
                   params=_params)
        _params['statues'] = statues
        reply = await self.rpc(msg)
        return reply



class MigrationTargetFacade(Type):
    name = 'MigrationTarget'
    version = 2
    schema =     {'definitions': {'ActivateModelArgs': {'additionalProperties': False,
                                           'properties': {'controller-alias': {'type': 'string'},
                                                          'controller-tag': {'type': 'string'},
                                                          'cross-model-uuids': {'items': {'type': 'string'},
                                                                                'type': 'array'},
                                                          'model-tag': {'type': 'string'},
                                                          'source-api-addrs': {'items': {'type': 'string'},
                                                                               'type': 'array'},
                                                          'source-ca-cert': {'type': 'string'}},
                                           'required': ['model-tag',
                                                        'controller-tag',
                                                        'source-api-addrs',
                                                        'source-ca-cert',
                                                        'cross-model-uuids'],
                                           'type': 'object'},
                     'AdoptResourcesArgs': {'additionalProperties': False,
                                            'properties': {'model-tag': {'type': 'string'},
                                                           'source-controller-version': {'$ref': '#/definitions/Number'}},
                                            'required': ['model-tag',
                                                         'source-controller-version'],
                                            'type': 'object'},
                     'BytesResult': {'additionalProperties': False,
                                     'properties': {'result': {'items': {'type': 'integer'},
                                                               'type': 'array'}},
                                     'required': ['result'],
                                     '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'},
                     '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'},
                     'ModelArgs': {'additionalProperties': False,
                                   'properties': {'model-tag': {'type': 'string'}},
                                   'required': ['model-tag'],
                                   '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'},
                     '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'}},
     'properties': {'Abort': {'description': 'Abort removes the specified model '
                                             'from the database. It is an error '
                                             'to\n'
                                             'attempt to Abort a model that has a '
                                             'migration mode other than importing.',
                              'properties': {'Params': {'$ref': '#/definitions/ModelArgs'}},
                              'type': 'object'},
                    'Activate': {'description': 'Activate sets the migration mode '
                                                'of the model to "none", meaning '
                                                'it\n'
                                                'is ready for use. It is an error '
                                                'to attempt to Abort a model that\n'
                                                'has a migration mode other than '
                                                'importing. It also adds any '
                                                'required\n'
                                                'external controller records for '
                                                'those controllers hosting offers '
                                                'used\n'
                                                'by the model.',
                                 'properties': {'Params': {'$ref': '#/definitions/ActivateModelArgs'}},
                                 'type': 'object'},
                    'AdoptResources': {'description': 'AdoptResources asks the '
                                                      'cloud provider to update '
                                                      'the controller\n'
                                                      "tags for a model's "
                                                      'resources. This prevents '
                                                      'the resources from\n'
                                                      'being destroyed if the '
                                                      'source controller is '
                                                      'destroyed after the\n'
                                                      'model is migrated away.',
                                       'properties': {'Params': {'$ref': '#/definitions/AdoptResourcesArgs'}},
                                       'type': 'object'},
                    'CACert': {'description': 'CACert returns the certificate used '
                                              'to validate the state connection.',
                               'properties': {'Result': {'$ref': '#/definitions/BytesResult'}},
                               'type': 'object'},
                    'CheckMachines': {'description': 'CheckMachines compares the '
                                                     'machines in state with the '
                                                     'ones reported\n'
                                                     'by the provider and reports '
                                                     'any discrepancies.',
                                      'properties': {'Params': {'$ref': '#/definitions/ModelArgs'},
                                                     'Result': {'$ref': '#/definitions/ErrorResults'}},
                                      'type': 'object'},
                    'Import': {'description': 'Import takes a serialized Juju '
                                              'model, deserializes it, and\n'
                                              'recreates it in the receiving '
                                              'controller.',
                               'properties': {'Params': {'$ref': '#/definitions/SerializedModel'}},
                               'type': 'object'},
                    'LatestLogTime': {'description': 'LatestLogTime returns the '
                                                     'time of the most recent log '
                                                     'record\n'
                                                     'received by the logtransfer '
                                                     'endpoint. This can be used '
                                                     'as the start\n'
                                                     'point for streaming logs '
                                                     'from the source if the '
                                                     'transfer was\n'
                                                     'interrupted.\n'
                                                     '\n'
                                                     'For performance reasons, not '
                                                     'every time is tracked, so if '
                                                     'the\n'
                                                     'target controller died '
                                                     'during the transfer the '
                                                     'latest log time\n'
                                                     'might be up to 2 minutes '
                                                     'earlier. If the transfer was '
                                                     'interrupted\n'
                                                     'in some other way (like the '
                                                     'source controller going away '
                                                     'or a\n'
                                                     'network partition) the time '
                                                     'will be up-to-date.\n'
                                                     '\n'
                                                     'Log messages are assumed to '
                                                     'be sent in time order (which '
                                                     'is how\n'
                                                     'debug-log emits them). If '
                                                     "that isn't the case then "
                                                     'this mechanism\n'
                                                     "can't be used to avoid "
                                                     'duplicates when logtransfer '
                                                     'is restarted.\n'
                                                     '\n'
                                                     'Returns the zero time if no '
                                                     'logs have been transferred.',
                                      'properties': {'Params': {'$ref': '#/definitions/ModelArgs'},
                                                     'Result': {'format': 'date-time',
                                                                'type': 'string'}},
                                      'type': 'object'},
                    'Prechecks': {'description': 'Prechecks ensure that the target '
                                                 'controller is ready to accept a\n'
                                                 'model migration.',
                                  'properties': {'Params': {'$ref': '#/definitions/MigrationModelInfo'}},
                                  'type': 'object'}},
     'type': 'object'}
    

    @ReturnMapping(None)
    async def Abort(self, model_tag=None):
        '''
        Abort removes the specified model from the database. It is an error to
        attempt to Abort a model that has a migration mode other than importing.

        model_tag : str
        Returns -> None
        '''
        if model_tag is not None and not isinstance(model_tag, (bytes, str)):
            raise Exception("Expected model_tag to be a str, received: {}".format(type(model_tag)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='MigrationTarget',
                   request='Abort',
                   version=2,
                   params=_params)
        _params['model-tag'] = model_tag
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(None)
    async def Activate(self, controller_alias=None, controller_tag=None, cross_model_uuids=None, model_tag=None, source_api_addrs=None, source_ca_cert=None):
        '''
        Activate sets the migration mode of the model to "none", meaning it
        is ready for use. It is an error to attempt to Abort a model that
        has a migration mode other than importing. It also adds any required
        external controller records for those controllers hosting offers used
        by the model.

        controller_alias : str
        controller_tag : str
        cross_model_uuids : typing.Sequence[str]
        model_tag : str
        source_api_addrs : typing.Sequence[str]
        source_ca_cert : 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)))

        if controller_tag is not None and not isinstance(controller_tag, (bytes, str)):
            raise Exception("Expected controller_tag to be a str, received: {}".format(type(controller_tag)))

        if cross_model_uuids is not None and not isinstance(cross_model_uuids, (bytes, str, list)):
            raise Exception("Expected cross_model_uuids to be a Sequence, received: {}".format(type(cross_model_uuids)))

        if model_tag is not None and not isinstance(model_tag, (bytes, str)):
            raise Exception("Expected model_tag to be a str, received: {}".format(type(model_tag)))

        if source_api_addrs is not None and not isinstance(source_api_addrs, (bytes, str, list)):
            raise Exception("Expected source_api_addrs to be a Sequence, received: {}".format(type(source_api_addrs)))

        if source_ca_cert is not None and not isinstance(source_ca_cert, (bytes, str)):
            raise Exception("Expected source_ca_cert to be a str, received: {}".format(type(source_ca_cert)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='MigrationTarget',
                   request='Activate',
                   version=2,
                   params=_params)
        _params['controller-alias'] = controller_alias
        _params['controller-tag'] = controller_tag
        _params['cross-model-uuids'] = cross_model_uuids
        _params['model-tag'] = model_tag
        _params['source-api-addrs'] = source_api_addrs
        _params['source-ca-cert'] = source_ca_cert
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(None)
    async def AdoptResources(self, model_tag=None, source_controller_version=None):
        '''
        AdoptResources asks the cloud provider to update the controller
        tags for a model's resources. This prevents the resources from
        being destroyed if the source controller is destroyed after the
        model is migrated away.

        model_tag : str
        source_controller_version : Number
        Returns -> None
        '''
        if model_tag is not None and not isinstance(model_tag, (bytes, str)):
            raise Exception("Expected model_tag to be a str, received: {}".format(type(model_tag)))

        if source_controller_version is not None and not isinstance(source_controller_version, (dict, Number)):
            raise Exception("Expected source_controller_version to be a Number, received: {}".format(type(source_controller_version)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='MigrationTarget',
                   request='AdoptResources',
                   version=2,
                   params=_params)
        _params['model-tag'] = model_tag
        _params['source-controller-version'] = source_controller_version
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(BytesResult)
    async def CACert(self):
        '''
        CACert returns the certificate used to validate the state connection.


        Returns -> BytesResult
        '''

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='MigrationTarget',
                   request='CACert',
                   version=2,
                   params=_params)

        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ErrorResults)
    async def CheckMachines(self, model_tag=None):
        '''
        CheckMachines compares the machines in state with the ones reported
        by the provider and reports any discrepancies.

        model_tag : str
        Returns -> ErrorResults
        '''
        if model_tag is not None and not isinstance(model_tag, (bytes, str)):
            raise Exception("Expected model_tag to be a str, received: {}".format(type(model_tag)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='MigrationTarget',
                   request='CheckMachines',
                   version=2,
                   params=_params)
        _params['model-tag'] = model_tag
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(None)
    async def Import(self, bytes_=None, charms=None, resources=None, tools=None):
        '''
        Import takes a serialized Juju model, deserializes it, and
        recreates it in the receiving controller.

        bytes_ : typing.Sequence[int]
        charms : typing.Sequence[str]
        resources : typing.Sequence[~SerializedModelResource]
        tools : typing.Sequence[~SerializedModelTools]
        Returns -> None
        '''
        if bytes_ is not None and not isinstance(bytes_, (bytes, str, list)):
            raise Exception("Expected bytes_ to be a Sequence, received: {}".format(type(bytes_)))

        if charms is not None and not isinstance(charms, (bytes, str, list)):
            raise Exception("Expected charms to be a Sequence, received: {}".format(type(charms)))

        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 tools is not None and not isinstance(tools, (bytes, str, list)):
            raise Exception("Expected tools to be a Sequence, received: {}".format(type(tools)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='MigrationTarget',
                   request='Import',
                   version=2,
                   params=_params)
        _params['bytes'] = bytes_
        _params['charms'] = charms
        _params['resources'] = resources
        _params['tools'] = tools
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(str)
    async def LatestLogTime(self, model_tag=None):
        '''
        LatestLogTime returns the time of the most recent log record
        received by the logtransfer endpoint. This can be used as the start
        point for streaming logs from the source if the transfer was
        interrupted.

        For performance reasons, not every time is tracked, so if the
        target controller died during the transfer the latest log time
        might be up to 2 minutes earlier. If the transfer was interrupted
        in some other way (like the source controller going away or a
        network partition) the time will be up-to-date.

        Log messages are assumed to be sent in time order (which is how
        debug-log emits them). If that isn't the case then this mechanism
        can't be used to avoid duplicates when logtransfer is restarted.

        Returns the zero time if no logs have been transferred.

        model_tag : str
        Returns -> str
        '''
        if model_tag is not None and not isinstance(model_tag, (bytes, str)):
            raise Exception("Expected model_tag to be a str, received: {}".format(type(model_tag)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='MigrationTarget',
                   request='LatestLogTime',
                   version=2,
                   params=_params)
        _params['model-tag'] = model_tag
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(None)
    async def Prechecks(self, agent_version=None, controller_agent_version=None, name=None, owner_tag=None, uuid=None):
        '''
        Prechecks ensure that the target controller is ready to accept a
        model migration.

        agent_version : Number
        controller_agent_version : Number
        name : str
        owner_tag : str
        uuid : str
        Returns -> None
        '''
        if agent_version is not None and not isinstance(agent_version, (dict, Number)):
            raise Exception("Expected agent_version to be a Number, received: {}".format(type(agent_version)))

        if controller_agent_version is not None and not isinstance(controller_agent_version, (dict, Number)):
            raise Exception("Expected controller_agent_version to be a Number, received: {}".format(type(controller_agent_version)))

        if name is not None and not isinstance(name, (bytes, str)):
            raise Exception("Expected name to be a str, received: {}".format(type(name)))

        if owner_tag is not None and not isinstance(owner_tag, (bytes, str)):
            raise Exception("Expected owner_tag to be a str, received: {}".format(type(owner_tag)))

        if uuid is not None and not isinstance(uuid, (bytes, str)):
            raise Exception("Expected uuid to be a str, received: {}".format(type(uuid)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='MigrationTarget',
                   request='Prechecks',
                   version=2,
                   params=_params)
        _params['agent-version'] = agent_version
        _params['controller-agent-version'] = controller_agent_version
        _params['name'] = name
        _params['owner-tag'] = owner_tag
        _params['uuid'] = uuid
        reply = await self.rpc(msg)
        return reply



class ProxyUpdaterFacade(Type):
    name = 'ProxyUpdater'
    version = 2
    schema =     {'definitions': {'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'},
                     'Error': {'additionalProperties': False,
                               'properties': {'code': {'type': 'string'},
                                              'info': {'patternProperties': {'.*': {'additionalProperties': True,
                                                                                    'type': 'object'}},
                                                       'type': 'object'},
                                              'message': {'type': 'string'}},
                               'required': ['message', 'code'],
                               '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'},
                     'ProxyConfig': {'additionalProperties': False,
                                     'properties': {'ftp': {'type': 'string'},
                                                    'http': {'type': 'string'},
                                                    'https': {'type': 'string'},
                                                    'no-proxy': {'type': 'string'}},
                                     'required': ['http',
                                                  'https',
                                                  'ftp',
                                                  'no-proxy'],
                                     'type': 'object'},
                     'ProxyConfigResult': {'additionalProperties': False,
                                           'properties': {'apt-mirror': {'type': 'string'},
                                                          'apt-proxy-settings': {'$ref': '#/definitions/ProxyConfig'},
                                                          'error': {'$ref': '#/definitions/Error'},
                                                          'juju-proxy-settings': {'$ref': '#/definitions/ProxyConfig'},
                                                          'legacy-proxy-settings': {'$ref': '#/definitions/ProxyConfig'},
                                                          'snap-proxy-settings': {'$ref': '#/definitions/ProxyConfig'},
                                                          'snap-store-assertions': {'type': 'string'},
                                                          'snap-store-id': {'type': 'string'},
                                                          'snap-store-proxy-url': {'type': 'string'}},
                                           'required': ['legacy-proxy-settings',
                                                        'juju-proxy-settings'],
                                           'type': 'object'},
                     'ProxyConfigResults': {'additionalProperties': False,
                                            'properties': {'results': {'items': {'$ref': '#/definitions/ProxyConfigResult'},
                                                                       'type': 'array'}},
                                            'required': ['results'],
                                            'type': 'object'}},
     'properties': {'ProxyConfig': {'description': 'ProxyConfig returns the proxy '
                                                   'settings for the current '
                                                   'model.',
                                    'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                   'Result': {'$ref': '#/definitions/ProxyConfigResults'}},
                                    'type': 'object'},
                    'WatchForProxyConfigAndAPIHostPortChanges': {'description': 'WatchForProxyConfigAndAPIHostPortChanges '
                                                                                'watches '
                                                                                'for '
                                                                                'changes '
                                                                                'to '
                                                                                'the '
                                                                                'proxy '
                                                                                'and '
                                                                                'api '
                                                                                'host '
                                                                                'port '
                                                                                'settings.',
                                                                 'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                                                'Result': {'$ref': '#/definitions/NotifyWatchResults'}},
                                                                 'type': 'object'}},
     'type': 'object'}
    

    @ReturnMapping(ProxyConfigResults)
    async def ProxyConfig(self, entities=None):
        '''
        ProxyConfig returns the proxy settings for the current model.

        entities : typing.Sequence[~Entity]
        Returns -> ProxyConfigResults
        '''
        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='ProxyUpdater',
                   request='ProxyConfig',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(NotifyWatchResults)
    async def WatchForProxyConfigAndAPIHostPortChanges(self, entities=None):
        '''
        WatchForProxyConfigAndAPIHostPortChanges watches for changes to the proxy and api host port settings.

        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='ProxyUpdater',
                   request='WatchForProxyConfigAndAPIHostPortChanges',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



class RaftLeaseFacade(Type):
    name = 'RaftLease'
    version = 2
    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'},
                     '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'},
                     'LeaseOperationCommand': {'additionalProperties': False,
                                               'properties': {'duration': {'type': 'integer'},
                                                              'holder': {'type': 'string'},
                                                              'lease': {'type': 'string'},
                                                              'model-uuid': {'type': 'string'},
                                                              'namespace': {'type': 'string'},
                                                              'new-time': {'format': 'date-time',
                                                                           'type': 'string'},
                                                              'old-time': {'format': 'date-time',
                                                                           'type': 'string'},
                                                              'operation': {'type': 'string'},
                                                              'pin-entity': {'type': 'string'},
                                                              'version': {'type': 'integer'}},
                                               'required': ['version', 'operation'],
                                               'type': 'object'},
                     'LeaseOperationsV2': {'additionalProperties': False,
                                           'properties': {'commands': {'items': {'$ref': '#/definitions/LeaseOperationCommand'},
                                                                       'type': 'array'}},
                                           'required': ['commands'],
                                           'type': 'object'}},
     'properties': {'ApplyLease': {'properties': {'Params': {'$ref': '#/definitions/LeaseOperationsV2'},
                                                  'Result': {'$ref': '#/definitions/ErrorResults'}},
                                   'type': 'object'}},
     'type': 'object'}
    

    @ReturnMapping(ErrorResults)
    async def ApplyLease(self, commands=None):
        '''
        commands : typing.Sequence[~LeaseOperationCommand]
        Returns -> ErrorResults
        '''
        if commands is not None and not isinstance(commands, (bytes, str, list)):
            raise Exception("Expected commands to be a Sequence, received: {}".format(type(commands)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='RaftLease',
                   request='ApplyLease',
                   version=2,
                   params=_params)
        _params['commands'] = commands
        reply = await self.rpc(msg)
        return reply



class RebootFacade(Type):
    name = 'Reboot'
    version = 2
    schema =     {'definitions': {'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'},
                     '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'},
                     'RebootActionResult': {'additionalProperties': False,
                                            'properties': {'error': {'$ref': '#/definitions/Error'},
                                                           'result': {'type': 'string'}},
                                            'type': 'object'},
                     'RebootActionResults': {'additionalProperties': False,
                                             'properties': {'results': {'items': {'$ref': '#/definitions/RebootActionResult'},
                                                                        'type': 'array'}},
                                             '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'},
                    'GetRebootAction': {'description': 'GetRebootAction returns '
                                                       'the action a machine agent '
                                                       'should take.\n'
                                                       'If a reboot flag is set on '
                                                       'the machine, then that '
                                                       'machine is\n'
                                                       'expected to reboot '
                                                       '(params.ShouldReboot).\n'
                                                       'a reboot flag set on the '
                                                       'machine parent or '
                                                       'grandparent, will\n'
                                                       'cause the machine to '
                                                       'shutdown '
                                                       '(params.ShouldShutdown).\n'
                                                       'If no reboot flag is set, '
                                                       'the machine should do '
                                                       'nothing '
                                                       '(params.ShouldDoNothing).',
                                        'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                       'Result': {'$ref': '#/definitions/RebootActionResults'}},
                                        'type': 'object'},
                    'RequestReboot': {'description': 'RequestReboot sets the '
                                                     'reboot flag on the provided '
                                                     'machines',
                                      'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                     'Result': {'$ref': '#/definitions/ErrorResults'}},
                                      'type': 'object'},
                    'WatchForRebootEvent': {'description': 'WatchForRebootEvent '
                                                           'starts a watcher to '
                                                           'track if there is a '
                                                           'new\n'
                                                           'reboot request on the '
                                                           'machines ID or any of '
                                                           'its parents (in case '
                                                           'we are a container).',
                                            'properties': {'Result': {'$ref': '#/definitions/NotifyWatchResult'}},
                                            'type': 'object'}},
     'type': 'object'}
    

    @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='Reboot',
                   request='ClearReboot',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(RebootActionResults)
    async def GetRebootAction(self, entities=None):
        '''
        GetRebootAction returns the action a machine agent should take.
        If a reboot flag is set on the machine, then that machine is
        expected to reboot (params.ShouldReboot).
        a reboot flag set on the machine parent or grandparent, will
        cause the machine to shutdown (params.ShouldShutdown).
        If no reboot flag is set, the machine should do nothing (params.ShouldDoNothing).

        entities : typing.Sequence[~Entity]
        Returns -> RebootActionResults
        '''
        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='Reboot',
                   request='GetRebootAction',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ErrorResults)
    async def RequestReboot(self, entities=None):
        '''
        RequestReboot sets the reboot flag on the provided machines

        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='Reboot',
                   request='RequestReboot',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(NotifyWatchResult)
    async def WatchForRebootEvent(self):
        '''
        WatchForRebootEvent starts a watcher to track if there is a new
        reboot request on the machines ID or any of its parents (in case we are a container).


        Returns -> NotifyWatchResult
        '''

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='Reboot',
                   request='WatchForRebootEvent',
                   version=2,
                   params=_params)

        reply = await self.rpc(msg)
        return reply



class RemoteRelationsFacade(Type):
    name = 'RemoteRelations'
    version = 2
    schema =     {'definitions': {'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'},
                     'EntityMacaroonArg': {'additionalProperties': False,
                                           'properties': {'macaroon': {'$ref': '#/definitions/Macaroon'},
                                                          'tag': {'type': 'string'}},
                                           'required': ['macaroon', 'tag'],
                                           'type': 'object'},
                     'EntityMacaroonArgs': {'additionalProperties': False,
                                            'properties': {'Args': {'items': {'$ref': '#/definitions/EntityMacaroonArg'},
                                                                    'type': 'array'}},
                                            'required': ['Args'],
                                            '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'},
                     'ExternalControllerInfo': {'additionalProperties': False,
                                                'properties': {'addrs': {'items': {'type': 'string'},
                                                                         'type': 'array'},
                                                               'ca-cert': {'type': 'string'},
                                                               'controller-alias': {'type': 'string'},
                                                               'controller-tag': {'type': 'string'}},
                                                'required': ['controller-tag',
                                                             'controller-alias',
                                                             'addrs',
                                                             'ca-cert'],
                                                'type': 'object'},
                     'GetTokenArg': {'additionalProperties': False,
                                     'properties': {'tag': {'type': 'string'}},
                                     'required': ['tag'],
                                     'type': 'object'},
                     'GetTokenArgs': {'additionalProperties': False,
                                      'properties': {'Args': {'items': {'$ref': '#/definitions/GetTokenArg'},
                                                              'type': 'array'}},
                                      'required': ['Args'],
                                      'type': 'object'},
                     'LatestSecretRevisionChanges': {'additionalProperties': False,
                                                     'properties': {'changes': {'items': {'$ref': '#/definitions/SecretRevisionChange'},
                                                                                'type': 'array'}},
                                                     'required': ['changes'],
                                                     'type': 'object'},
                     'Macaroon': {'additionalProperties': False, 'type': 'object'},
                     'RemoteApplication': {'additionalProperties': False,
                                           'properties': {'consume-version': {'type': 'integer'},
                                                          'is-consumer-proxy': {'type': 'boolean'},
                                                          'life': {'type': 'string'},
                                                          'macaroon': {'$ref': '#/definitions/Macaroon'},
                                                          'model-uuid': {'type': 'string'},
                                                          'name': {'type': 'string'},
                                                          'offer-uuid': {'type': 'string'},
                                                          'status': {'type': 'string'}},
                                           'required': ['name',
                                                        'offer-uuid',
                                                        'model-uuid',
                                                        'is-consumer-proxy'],
                                           'type': 'object'},
                     'RemoteApplicationResult': {'additionalProperties': False,
                                                 'properties': {'error': {'$ref': '#/definitions/Error'},
                                                                'result': {'$ref': '#/definitions/RemoteApplication'}},
                                                 'type': 'object'},
                     'RemoteApplicationResults': {'additionalProperties': False,
                                                  'properties': {'results': {'items': {'$ref': '#/definitions/RemoteApplicationResult'},
                                                                             'type': 'array'}},
                                                  'type': 'object'},
                     'RemoteEndpoint': {'additionalProperties': False,
                                        'properties': {'interface': {'type': 'string'},
                                                       'limit': {'type': 'integer'},
                                                       'name': {'type': 'string'},
                                                       'role': {'type': 'string'}},
                                        'required': ['name',
                                                     'role',
                                                     'interface',
                                                     'limit'],
                                        'type': 'object'},
                     'RemoteEntityTokenArg': {'additionalProperties': False,
                                              'properties': {'tag': {'type': 'string'},
                                                             'token': {'type': 'string'}},
                                              'required': ['tag'],
                                              'type': 'object'},
                     'RemoteEntityTokenArgs': {'additionalProperties': False,
                                               'properties': {'Args': {'items': {'$ref': '#/definitions/RemoteEntityTokenArg'},
                                                                       'type': 'array'}},
                                               'required': ['Args'],
                                               'type': 'object'},
                     'RemoteRelation': {'additionalProperties': False,
                                        'properties': {'application-name': {'type': 'string'},
                                                       'endpoint': {'$ref': '#/definitions/RemoteEndpoint'},
                                                       'id': {'type': 'integer'},
                                                       'key': {'type': 'string'},
                                                       'life': {'type': 'string'},
                                                       'remote-application-name': {'type': 'string'},
                                                       'remote-endpoint-name': {'type': 'string'},
                                                       'source-model-uuid': {'type': 'string'},
                                                       'suspended': {'type': 'boolean'},
                                                       'unit-count': {'type': 'integer'}},
                                        'required': ['life',
                                                     'suspended',
                                                     'id',
                                                     'key',
                                                     'application-name',
                                                     'endpoint',
                                                     'unit-count',
                                                     'remote-application-name',
                                                     'remote-endpoint-name',
                                                     'source-model-uuid'],
                                        'type': 'object'},
                     'RemoteRelationChangeEvent': {'additionalProperties': False,
                                                   'properties': {'application-settings': {'patternProperties': {'.*': {'additionalProperties': True,
                                                                                                                        'type': 'object'}},
                                                                                           'type': 'object'},
                                                                  'application-token': {'type': 'string'},
                                                                  'bakery-version': {'type': 'integer'},
                                                                  'changed-units': {'items': {'$ref': '#/definitions/RemoteRelationUnitChange'},
                                                                                    'type': 'array'},
                                                                  'departed-units': {'items': {'type': 'integer'},
                                                                                     'type': 'array'},
                                                                  'force-cleanup': {'type': 'boolean'},
                                                                  'life': {'type': 'string'},
                                                                  'macaroons': {'items': {'$ref': '#/definitions/Macaroon'},
                                                                                'type': 'array'},
                                                                  'relation-token': {'type': 'string'},
                                                                  'suspended': {'type': 'boolean'},
                                                                  'suspended-reason': {'type': 'string'},
                                                                  'unit-count': {'type': 'integer'}},
                                                   'required': ['relation-token',
                                                                'application-token',
                                                                'life',
                                                                'unit-count'],
                                                   'type': 'object'},
                     'RemoteRelationResult': {'additionalProperties': False,
                                              'properties': {'error': {'$ref': '#/definitions/Error'},
                                                             'result': {'$ref': '#/definitions/RemoteRelation'}},
                                              'type': 'object'},
                     'RemoteRelationResults': {'additionalProperties': False,
                                               'properties': {'results': {'items': {'$ref': '#/definitions/RemoteRelationResult'},
                                                                          'type': 'array'}},
                                               'required': ['results'],
                                               'type': 'object'},
                     'RemoteRelationUnitChange': {'additionalProperties': False,
                                                  'properties': {'settings': {'patternProperties': {'.*': {'additionalProperties': True,
                                                                                                           'type': 'object'}},
                                                                              'type': 'object'},
                                                                 'unit-id': {'type': 'integer'}},
                                                  'required': ['unit-id'],
                                                  'type': 'object'},
                     'RemoteRelationWatchResult': {'additionalProperties': False,
                                                   'properties': {'changes': {'$ref': '#/definitions/RemoteRelationChangeEvent'},
                                                                  'error': {'$ref': '#/definitions/Error'},
                                                                  'watcher-id': {'type': 'string'}},
                                                   'required': ['watcher-id',
                                                                'changes'],
                                                   'type': 'object'},
                     'RemoteRelationWatchResults': {'additionalProperties': False,
                                                    'properties': {'results': {'items': {'$ref': '#/definitions/RemoteRelationWatchResult'},
                                                                               'type': 'array'}},
                                                    'required': ['results'],
                                                    'type': 'object'},
                     'RemoteRelationsChanges': {'additionalProperties': False,
                                                'properties': {'changes': {'items': {'$ref': '#/definitions/RemoteRelationChangeEvent'},
                                                                           'type': 'array'}},
                                                'type': 'object'},
                     'SecretRevisionChange': {'additionalProperties': False,
                                              'properties': {'revision': {'type': 'integer'},
                                                             'uri': {'type': 'string'}},
                                              'required': ['uri', 'revision'],
                                              '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'},
                     'StringsWatchResult': {'additionalProperties': False,
                                            'properties': {'changes': {'items': {'type': 'string'},
                                                                       'type': 'array'},
                                                           'error': {'$ref': '#/definitions/Error'},
                                                           'watcher-id': {'type': 'string'}},
                                            'required': ['watcher-id'],
                                            'type': 'object'},
                     'StringsWatchResults': {'additionalProperties': False,
                                             'properties': {'results': {'items': {'$ref': '#/definitions/StringsWatchResult'},
                                                                        'type': 'array'}},
                                             'required': ['results'],
                                             'type': 'object'},
                     'TokenResult': {'additionalProperties': False,
                                     'properties': {'error': {'$ref': '#/definitions/Error'},
                                                    'token': {'type': 'string'}},
                                     'type': 'object'},
                     'TokenResults': {'additionalProperties': False,
                                      'properties': {'results': {'items': {'$ref': '#/definitions/TokenResult'},
                                                                 'type': 'array'}},
                                      'type': 'object'},
                     'UpdateControllerForModel': {'additionalProperties': False,
                                                  'properties': {'info': {'$ref': '#/definitions/ExternalControllerInfo'},
                                                                 'model-tag': {'type': 'string'}},
                                                  'required': ['model-tag', 'info'],
                                                  'type': 'object'},
                     'UpdateControllersForModelsParams': {'additionalProperties': False,
                                                          'properties': {'changes': {'items': {'$ref': '#/definitions/UpdateControllerForModel'},
                                                                                     'type': 'array'}},
                                                          'required': ['changes'],
                                                          'type': 'object'}},
     'properties': {'ConsumeRemoteRelationChanges': {'description': 'ConsumeRemoteRelationChanges '
                                                                    'consumes '
                                                                    'changes to '
                                                                    'settings '
                                                                    'originating\n'
                                                                    'from the '
                                                                    'remote/offering '
                                                                    'side of '
                                                                    'relations.',
                                                     'properties': {'Params': {'$ref': '#/definitions/RemoteRelationsChanges'},
                                                                    'Result': {'$ref': '#/definitions/ErrorResults'}},
                                                     'type': 'object'},
                    'ConsumeRemoteSecretChanges': {'description': 'ConsumeRemoteSecretChanges '
                                                                  'updates the '
                                                                  'local model '
                                                                  'with secret '
                                                                  'revision '
                                                                  'changes\n'
                                                                  'originating '
                                                                  'from the '
                                                                  'remote/offering '
                                                                  'model.',
                                                   'properties': {'Params': {'$ref': '#/definitions/LatestSecretRevisionChanges'},
                                                                  'Result': {'$ref': '#/definitions/ErrorResults'}},
                                                   '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'},
                    'ExportEntities': {'description': 'ExportEntities allocates '
                                                      'unique, remote entity IDs '
                                                      'for the given entities in '
                                                      'the local model.',
                                       'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                      'Result': {'$ref': '#/definitions/TokenResults'}},
                                       'type': 'object'},
                    'GetTokens': {'description': 'GetTokens returns the token '
                                                 'associated with the entities '
                                                 'with the given tags for the '
                                                 'given models.',
                                  'properties': {'Params': {'$ref': '#/definitions/GetTokenArgs'},
                                                 'Result': {'$ref': '#/definitions/StringResults'}},
                                  'type': 'object'},
                    'ImportRemoteEntities': {'description': 'ImportRemoteEntities '
                                                            'adds entities to the '
                                                            'remote entities '
                                                            'collection with the '
                                                            'specified opaque '
                                                            'tokens.',
                                             'properties': {'Params': {'$ref': '#/definitions/RemoteEntityTokenArgs'},
                                                            'Result': {'$ref': '#/definitions/ErrorResults'}},
                                             'type': 'object'},
                    'Relations': {'description': 'Relations returns information '
                                                 'about the cross-model relations '
                                                 'with the specified keys\n'
                                                 'in the local model.',
                                  'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                 'Result': {'$ref': '#/definitions/RemoteRelationResults'}},
                                  'type': 'object'},
                    'RemoteApplications': {'description': 'RemoteApplications '
                                                          'returns the current '
                                                          'state of the remote '
                                                          'applications with\n'
                                                          'the specified names in '
                                                          'the local model.',
                                           'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                          'Result': {'$ref': '#/definitions/RemoteApplicationResults'}},
                                           'type': 'object'},
                    'SaveMacaroons': {'description': 'SaveMacaroons saves the '
                                                     'macaroons for the given '
                                                     'entities.',
                                      'properties': {'Params': {'$ref': '#/definitions/EntityMacaroonArgs'},
                                                     'Result': {'$ref': '#/definitions/ErrorResults'}},
                                      'type': 'object'},
                    'SetRemoteApplicationsStatus': {'description': 'SetRemoteApplicationsStatus '
                                                                   'sets the '
                                                                   'status for the '
                                                                   'specified '
                                                                   'remote '
                                                                   'applications.',
                                                    'properties': {'Params': {'$ref': '#/definitions/SetStatus'},
                                                                   'Result': {'$ref': '#/definitions/ErrorResults'}},
                                                    'type': 'object'},
                    'UpdateControllersForModels': {'description': 'UpdateControllersForModels '
                                                                  'changes the '
                                                                  'external '
                                                                  'controller '
                                                                  'records for '
                                                                  'the\n'
                                                                  'associated '
                                                                  'model entities. '
                                                                  'This is used '
                                                                  'when the remote '
                                                                  'relations '
                                                                  'worker gets\n'
                                                                  'redirected '
                                                                  'following '
                                                                  'migration of an '
                                                                  'offering model.',
                                                   'properties': {'Params': {'$ref': '#/definitions/UpdateControllersForModelsParams'},
                                                                  'Result': {'$ref': '#/definitions/ErrorResults'}},
                                                   'type': 'object'},
                    'WatchLocalRelationChanges': {'description': 'WatchLocalRelationChanges '
                                                                 'starts a '
                                                                 'RemoteRelationWatcher '
                                                                 'for each\n'
                                                                 'specified '
                                                                 'relation, '
                                                                 'returning the '
                                                                 'watcher IDs and '
                                                                 'initial values,\n'
                                                                 'or an error if '
                                                                 'the remote '
                                                                 'relations '
                                                                 "couldn't be "
                                                                 'watched.',
                                                  'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                                 'Result': {'$ref': '#/definitions/RemoteRelationWatchResults'}},
                                                  'type': 'object'},
                    'WatchRemoteApplicationRelations': {'description': 'WatchRemoteApplicationRelations '
                                                                       'starts a '
                                                                       'StringsWatcher '
                                                                       'for '
                                                                       'watching '
                                                                       'the '
                                                                       'relations '
                                                                       'of\n'
                                                                       'each '
                                                                       'specified '
                                                                       'application '
                                                                       'in the '
                                                                       'local '
                                                                       'model, and '
                                                                       'returns '
                                                                       'the '
                                                                       'watcher '
                                                                       'IDs\n'
                                                                       'and '
                                                                       'initial '
                                                                       'values, or '
                                                                       'an error '
                                                                       'if the '
                                                                       "services' "
                                                                       'relations '
                                                                       'could not '
                                                                       'be\n'
                                                                       'watched.',
                                                        'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                                       'Result': {'$ref': '#/definitions/StringsWatchResults'}},
                                                        'type': 'object'},
                    'WatchRemoteApplications': {'description': 'WatchRemoteApplications '
                                                               'starts a strings '
                                                               'watcher that '
                                                               'notifies of the '
                                                               'addition,\n'
                                                               'removal, and '
                                                               'lifecycle changes '
                                                               'of remote '
                                                               'applications in '
                                                               'the model; and\n'
                                                               'returns the '
                                                               'watcher ID and '
                                                               'initial IDs of '
                                                               'remote '
                                                               'applications, or '
                                                               'an error if\n'
                                                               'watching failed.',
                                                'properties': {'Result': {'$ref': '#/definitions/StringsWatchResult'}},
                                                'type': 'object'},
                    'WatchRemoteRelations': {'description': 'WatchRemoteRelations '
                                                            'starts a strings '
                                                            'watcher that notifies '
                                                            'of the addition,\n'
                                                            'removal, and '
                                                            'lifecycle changes of '
                                                            'remote relations in '
                                                            'the model; and\n'
                                                            'returns the watcher '
                                                            'ID and initial IDs of '
                                                            'remote relations, or '
                                                            'an error if\n'
                                                            'watching failed.',
                                             'properties': {'Result': {'$ref': '#/definitions/StringsWatchResult'}},
                                             'type': 'object'}},
     'type': 'object'}
    

    @ReturnMapping(ErrorResults)
    async def ConsumeRemoteRelationChanges(self, changes=None):
        '''
        ConsumeRemoteRelationChanges consumes changes to settings originating
        from the remote/offering side of relations.

        changes : typing.Sequence[~RemoteRelationChangeEvent]
        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='RemoteRelations',
                   request='ConsumeRemoteRelationChanges',
                   version=2,
                   params=_params)
        _params['changes'] = changes
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ErrorResults)
    async def ConsumeRemoteSecretChanges(self, changes=None):
        '''
        ConsumeRemoteSecretChanges updates the local model with secret revision changes
        originating from the remote/offering model.

        changes : typing.Sequence[~SecretRevisionChange]
        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='RemoteRelations',
                   request='ConsumeRemoteSecretChanges',
                   version=2,
                   params=_params)
        _params['changes'] = changes
        reply = await self.rpc(msg)
        return reply



    @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='RemoteRelations',
                   request='ControllerAPIInfoForModels',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @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='RemoteRelations',
                   request='ControllerConfig',
                   version=2,
                   params=_params)

        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(TokenResults)
    async def ExportEntities(self, entities=None):
        '''
        ExportEntities allocates unique, remote entity IDs for the given entities in the local model.

        entities : typing.Sequence[~Entity]
        Returns -> TokenResults
        '''
        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='RemoteRelations',
                   request='ExportEntities',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(StringResults)
    async def GetTokens(self, args=None):
        '''
        GetTokens returns the token associated with the entities with the given tags for the given models.

        args : typing.Sequence[~GetTokenArg]
        Returns -> StringResults
        '''
        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='RemoteRelations',
                   request='GetTokens',
                   version=2,
                   params=_params)
        _params['Args'] = args
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ErrorResults)
    async def ImportRemoteEntities(self, args=None):
        '''
        ImportRemoteEntities adds entities to the remote entities collection with the specified opaque tokens.

        args : typing.Sequence[~RemoteEntityTokenArg]
        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='RemoteRelations',
                   request='ImportRemoteEntities',
                   version=2,
                   params=_params)
        _params['Args'] = args
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(RemoteRelationResults)
    async def Relations(self, entities=None):
        '''
        Relations returns information about the cross-model relations with the specified keys
        in the local model.

        entities : typing.Sequence[~Entity]
        Returns -> RemoteRelationResults
        '''
        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='RemoteRelations',
                   request='Relations',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(RemoteApplicationResults)
    async def RemoteApplications(self, entities=None):
        '''
        RemoteApplications returns the current state of the remote applications with
        the specified names in the local model.

        entities : typing.Sequence[~Entity]
        Returns -> RemoteApplicationResults
        '''
        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='RemoteRelations',
                   request='RemoteApplications',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ErrorResults)
    async def SaveMacaroons(self, args=None):
        '''
        SaveMacaroons saves the macaroons for the given entities.

        args : typing.Sequence[~EntityMacaroonArg]
        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='RemoteRelations',
                   request='SaveMacaroons',
                   version=2,
                   params=_params)
        _params['Args'] = args
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ErrorResults)
    async def SetRemoteApplicationsStatus(self, entities=None):
        '''
        SetRemoteApplicationsStatus sets the status for the specified remote applications.

        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='RemoteRelations',
                   request='SetRemoteApplicationsStatus',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ErrorResults)
    async def UpdateControllersForModels(self, changes=None):
        '''
        UpdateControllersForModels changes the external controller records for the
        associated model entities. This is used when the remote relations worker gets
        redirected following migration of an offering model.

        changes : typing.Sequence[~UpdateControllerForModel]
        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='RemoteRelations',
                   request='UpdateControllersForModels',
                   version=2,
                   params=_params)
        _params['changes'] = changes
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(RemoteRelationWatchResults)
    async def WatchLocalRelationChanges(self, entities=None):
        '''
        WatchLocalRelationChanges starts a RemoteRelationWatcher for each
        specified relation, returning the watcher IDs and initial values,
        or an error if the remote relations couldn't be watched.

        entities : typing.Sequence[~Entity]
        Returns -> RemoteRelationWatchResults
        '''
        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='RemoteRelations',
                   request='WatchLocalRelationChanges',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(StringsWatchResults)
    async def WatchRemoteApplicationRelations(self, entities=None):
        '''
        WatchRemoteApplicationRelations starts a StringsWatcher for watching the relations of
        each specified application in the local model, and returns the watcher IDs
        and initial values, or an error if the services' relations could not be
        watched.

        entities : typing.Sequence[~Entity]
        Returns -> StringsWatchResults
        '''
        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='RemoteRelations',
                   request='WatchRemoteApplicationRelations',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(StringsWatchResult)
    async def WatchRemoteApplications(self):
        '''
        WatchRemoteApplications starts a strings watcher that notifies of the addition,
        removal, and lifecycle changes of remote applications in the model; and
        returns the watcher ID and initial IDs of remote applications, or an error if
        watching failed.


        Returns -> StringsWatchResult
        '''

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='RemoteRelations',
                   request='WatchRemoteApplications',
                   version=2,
                   params=_params)

        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(StringsWatchResult)
    async def WatchRemoteRelations(self):
        '''
        WatchRemoteRelations starts a strings watcher that notifies of the addition,
        removal, and lifecycle changes of remote relations in the model; and
        returns the watcher ID and initial IDs of remote relations, or an error if
        watching failed.


        Returns -> StringsWatchResult
        '''

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='RemoteRelations',
                   request='WatchRemoteRelations',
                   version=2,
                   params=_params)

        reply = await self.rpc(msg)
        return reply



class SecretsManagerFacade(Type):
    name = 'SecretsManager'
    version = 2
    schema =     {'definitions': {'CreateSecretArg': {'additionalProperties': False,
                                         'properties': {'UpsertSecretArg': {'$ref': '#/definitions/UpsertSecretArg'},
                                                        'content': {'$ref': '#/definitions/SecretContentParams'},
                                                        'description': {'type': 'string'},
                                                        'expire-time': {'format': 'date-time',
                                                                        'type': 'string'},
                                                        'label': {'type': 'string'},
                                                        'owner-tag': {'type': 'string'},
                                                        'params': {'patternProperties': {'.*': {'additionalProperties': True,
                                                                                                'type': 'object'}},
                                                                   'type': 'object'},
                                                        'rotate-policy': {'type': 'string'},
                                                        'uri': {'type': 'string'}},
                                         'required': ['UpsertSecretArg',
                                                      'owner-tag'],
                                         'type': 'object'},
                     'CreateSecretArgs': {'additionalProperties': False,
                                          'properties': {'args': {'items': {'$ref': '#/definitions/CreateSecretArg'},
                                                                  'type': 'array'}},
                                          'required': ['args'],
                                          'type': 'object'},
                     'CreateSecretURIsArg': {'additionalProperties': False,
                                             'properties': {'count': {'type': 'integer'}},
                                             'required': ['count'],
                                             'type': 'object'},
                     'DeleteSecretArg': {'additionalProperties': False,
                                         'properties': {'revisions': {'items': {'type': 'integer'},
                                                                      'type': 'array'},
                                                        'uri': {'type': 'string'}},
                                         'required': ['uri'],
                                         'type': 'object'},
                     'DeleteSecretArgs': {'additionalProperties': False,
                                          'properties': {'args': {'items': {'$ref': '#/definitions/DeleteSecretArg'},
                                                                  'type': 'array'}},
                                          'required': ['args'],
                                          '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'},
                     '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'},
                     'GetSecretConsumerInfoArgs': {'additionalProperties': False,
                                                   'properties': {'consumer-tag': {'type': 'string'},
                                                                  'uris': {'items': {'type': 'string'},
                                                                           'type': 'array'}},
                                                   'required': ['consumer-tag',
                                                                'uris'],
                                                   'type': 'object'},
                     'GetSecretContentArg': {'additionalProperties': False,
                                             'properties': {'label': {'type': 'string'},
                                                            'peek': {'type': 'boolean'},
                                                            'refresh': {'type': 'boolean'},
                                                            'uri': {'type': 'string'}},
                                             'required': ['uri'],
                                             'type': 'object'},
                     'GetSecretContentArgs': {'additionalProperties': False,
                                              'properties': {'args': {'items': {'$ref': '#/definitions/GetSecretContentArg'},
                                                                      'type': 'array'}},
                                              'required': ['args'],
                                              'type': 'object'},
                     'GrantRevokeSecretArg': {'additionalProperties': False,
                                              'properties': {'role': {'type': 'string'},
                                                             'scope-tag': {'type': 'string'},
                                                             'subject-tags': {'items': {'type': 'string'},
                                                                              'type': 'array'},
                                                             'uri': {'type': 'string'}},
                                              'required': ['uri',
                                                           'scope-tag',
                                                           'subject-tags',
                                                           'role'],
                                              'type': 'object'},
                     'GrantRevokeSecretArgs': {'additionalProperties': False,
                                               'properties': {'args': {'items': {'$ref': '#/definitions/GrantRevokeSecretArg'},
                                                                       'type': 'array'}},
                                               'required': ['args'],
                                               'type': 'object'},
                     'ListSecretResult': {'additionalProperties': False,
                                          'properties': {'create-time': {'format': 'date-time',
                                                                         'type': 'string'},
                                                         'description': {'type': 'string'},
                                                         'label': {'type': 'string'},
                                                         'latest-expire-time': {'format': 'date-time',
                                                                                'type': 'string'},
                                                         'latest-revision': {'type': 'integer'},
                                                         'next-rotate-time': {'format': 'date-time',
                                                                              'type': 'string'},
                                                         'owner-tag': {'type': 'string'},
                                                         'revisions': {'items': {'$ref': '#/definitions/SecretRevision'},
                                                                       'type': 'array'},
                                                         'rotate-policy': {'type': 'string'},
                                                         'update-time': {'format': 'date-time',
                                                                         'type': 'string'},
                                                         'uri': {'type': 'string'},
                                                         'value': {'$ref': '#/definitions/SecretValueResult'},
                                                         'version': {'type': 'integer'}},
                                          'required': ['uri',
                                                       'version',
                                                       'owner-tag',
                                                       'latest-revision',
                                                       'create-time',
                                                       'update-time',
                                                       'revisions'],
                                          'type': 'object'},
                     'ListSecretResults': {'additionalProperties': False,
                                           'properties': {'results': {'items': {'$ref': '#/definitions/ListSecretResult'},
                                                                      'type': 'array'}},
                                           'required': ['results'],
                                           'type': 'object'},
                     'SecretBackendArgs': {'additionalProperties': False,
                                           'properties': {'backend-ids': {'items': {'type': 'string'},
                                                                          'type': 'array'}},
                                           'required': ['backend-ids'],
                                           'type': 'object'},
                     'SecretBackendConfig': {'additionalProperties': False,
                                             'properties': {'params': {'patternProperties': {'.*': {'additionalProperties': True,
                                                                                                    'type': 'object'}},
                                                                       'type': 'object'},
                                                            'type': {'type': 'string'}},
                                             'required': ['type'],
                                             'type': 'object'},
                     'SecretBackendConfigResult': {'additionalProperties': False,
                                                   'properties': {'config': {'$ref': '#/definitions/SecretBackendConfig'},
                                                                  'draining': {'type': 'boolean'},
                                                                  'model-controller': {'type': 'string'},
                                                                  'model-name': {'type': 'string'},
                                                                  'model-uuid': {'type': 'string'}},
                                                   'required': ['model-controller',
                                                                'model-uuid',
                                                                'model-name',
                                                                'draining'],
                                                   'type': 'object'},
                     'SecretBackendConfigResults': {'additionalProperties': False,
                                                    'properties': {'active-id': {'type': 'string'},
                                                                   'results': {'patternProperties': {'.*': {'$ref': '#/definitions/SecretBackendConfigResult'}},
                                                                               'type': 'object'}},
                                                    'required': ['active-id'],
                                                    'type': 'object'},
                     'SecretConsumerInfoResult': {'additionalProperties': False,
                                                  'properties': {'error': {'$ref': '#/definitions/Error'},
                                                                 'label': {'type': 'string'},
                                                                 'revision': {'type': 'integer'}},
                                                  'required': ['revision', 'label'],
                                                  'type': 'object'},
                     'SecretConsumerInfoResults': {'additionalProperties': False,
                                                   'properties': {'results': {'items': {'$ref': '#/definitions/SecretConsumerInfoResult'},
                                                                              'type': 'array'}},
                                                   'required': ['results'],
                                                   'type': 'object'},
                     'SecretContentParams': {'additionalProperties': False,
                                             'properties': {'data': {'patternProperties': {'.*': {'type': 'string'}},
                                                                     'type': 'object'},
                                                            'value-ref': {'$ref': '#/definitions/SecretValueRef'}},
                                             'type': 'object'},
                     'SecretContentResult': {'additionalProperties': False,
                                             'properties': {'backend-config': {'$ref': '#/definitions/SecretBackendConfigResult'},
                                                            'content': {'$ref': '#/definitions/SecretContentParams'},
                                                            'error': {'$ref': '#/definitions/Error'},
                                                            'latest-revision': {'type': 'integer'}},
                                             'required': ['content'],
                                             'type': 'object'},
                     'SecretContentResults': {'additionalProperties': False,
                                              'properties': {'results': {'items': {'$ref': '#/definitions/SecretContentResult'},
                                                                         'type': 'array'}},
                                              'required': ['results'],
                                              'type': 'object'},
                     'SecretRevision': {'additionalProperties': False,
                                        'properties': {'backend-name': {'type': 'string'},
                                                       'create-time': {'format': 'date-time',
                                                                       'type': 'string'},
                                                       'expire-time': {'format': 'date-time',
                                                                       'type': 'string'},
                                                       'revision': {'type': 'integer'},
                                                       'update-time': {'format': 'date-time',
                                                                       'type': 'string'},
                                                       'value-ref': {'$ref': '#/definitions/SecretValueRef'}},
                                        'required': ['revision'],
                                        'type': 'object'},
                     'SecretRevisionArg': {'additionalProperties': False,
                                           'properties': {'pending-delete': {'type': 'boolean'},
                                                          'revisions': {'items': {'type': 'integer'},
                                                                        'type': 'array'},
                                                          'uri': {'type': 'string'}},
                                           'required': ['uri',
                                                        'revisions',
                                                        'pending-delete'],
                                           'type': 'object'},
                     'SecretRotatedArg': {'additionalProperties': False,
                                          'properties': {'original-revision': {'type': 'integer'},
                                                         'skip': {'type': 'boolean'},
                                                         'uri': {'type': 'string'}},
                                          'required': ['uri',
                                                       'original-revision',
                                                       'skip'],
                                          'type': 'object'},
                     'SecretRotatedArgs': {'additionalProperties': False,
                                           'properties': {'args': {'items': {'$ref': '#/definitions/SecretRotatedArg'},
                                                                   'type': 'array'}},
                                           'required': ['args'],
                                           'type': 'object'},
                     'SecretTriggerChange': {'additionalProperties': False,
                                             'properties': {'next-trigger-time': {'format': 'date-time',
                                                                                  'type': 'string'},
                                                            'revision': {'type': 'integer'},
                                                            'uri': {'type': 'string'}},
                                             'required': ['uri',
                                                          'next-trigger-time'],
                                             'type': 'object'},
                     'SecretTriggerWatchResult': {'additionalProperties': False,
                                                  'properties': {'changes': {'items': {'$ref': '#/definitions/SecretTriggerChange'},
                                                                             'type': 'array'},
                                                                 'error': {'$ref': '#/definitions/Error'},
                                                                 'watcher-id': {'type': 'string'}},
                                                  'required': ['watcher-id',
                                                               'changes'],
                                                  'type': 'object'},
                     'SecretValueRef': {'additionalProperties': False,
                                        'properties': {'backend-id': {'type': 'string'},
                                                       'revision-id': {'type': 'string'}},
                                        'required': ['backend-id', 'revision-id'],
                                        'type': 'object'},
                     'SecretValueResult': {'additionalProperties': False,
                                           'properties': {'data': {'patternProperties': {'.*': {'type': 'string'}},
                                                                   'type': 'object'},
                                                          'error': {'$ref': '#/definitions/Error'}},
                                           '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'},
                     'StringsWatchResult': {'additionalProperties': False,
                                            'properties': {'changes': {'items': {'type': 'string'},
                                                                       'type': 'array'},
                                                           'error': {'$ref': '#/definitions/Error'},
                                                           'watcher-id': {'type': 'string'}},
                                            'required': ['watcher-id'],
                                            'type': 'object'},
                     'StringsWatchResults': {'additionalProperties': False,
                                             'properties': {'results': {'items': {'$ref': '#/definitions/StringsWatchResult'},
                                                                        'type': 'array'}},
                                             'required': ['results'],
                                             'type': 'object'},
                     'UpdateSecretArg': {'additionalProperties': False,
                                         'properties': {'UpsertSecretArg': {'$ref': '#/definitions/UpsertSecretArg'},
                                                        'content': {'$ref': '#/definitions/SecretContentParams'},
                                                        'description': {'type': 'string'},
                                                        'expire-time': {'format': 'date-time',
                                                                        'type': 'string'},
                                                        'label': {'type': 'string'},
                                                        'params': {'patternProperties': {'.*': {'additionalProperties': True,
                                                                                                'type': 'object'}},
                                                                   'type': 'object'},
                                                        'rotate-policy': {'type': 'string'},
                                                        'uri': {'type': 'string'}},
                                         'required': ['UpsertSecretArg', 'uri'],
                                         'type': 'object'},
                     'UpdateSecretArgs': {'additionalProperties': False,
                                          'properties': {'args': {'items': {'$ref': '#/definitions/UpdateSecretArg'},
                                                                  'type': 'array'}},
                                          'required': ['args'],
                                          'type': 'object'},
                     'UpsertSecretArg': {'additionalProperties': False,
                                         'properties': {'content': {'$ref': '#/definitions/SecretContentParams'},
                                                        'description': {'type': 'string'},
                                                        'expire-time': {'format': 'date-time',
                                                                        'type': 'string'},
                                                        'label': {'type': 'string'},
                                                        'params': {'patternProperties': {'.*': {'additionalProperties': True,
                                                                                                'type': 'object'}},
                                                                   'type': 'object'},
                                                        'rotate-policy': {'type': 'string'}},
                                         'type': 'object'}},
     'properties': {'CreateSecretURIs': {'description': 'CreateSecretURIs creates '
                                                        'new secret URIs.',
                                         'properties': {'Params': {'$ref': '#/definitions/CreateSecretURIsArg'},
                                                        'Result': {'$ref': '#/definitions/StringResults'}},
                                         'type': 'object'},
                    'CreateSecrets': {'description': 'CreateSecrets creates new '
                                                     'secrets.',
                                      'properties': {'Params': {'$ref': '#/definitions/CreateSecretArgs'},
                                                     'Result': {'$ref': '#/definitions/StringResults'}},
                                      'type': 'object'},
                    'GetConsumerSecretsRevisionInfo': {'description': 'GetConsumerSecretsRevisionInfo '
                                                                      'returns the '
                                                                      'latest '
                                                                      'secret '
                                                                      'revisions '
                                                                      'for the '
                                                                      'specified '
                                                                      'secrets.\n'
                                                                      'This facade '
                                                                      'method is '
                                                                      'used for '
                                                                      'remote '
                                                                      'watcher to '
                                                                      'get the '
                                                                      'latest '
                                                                      'secret '
                                                                      'revisions '
                                                                      'and labels '
                                                                      'for a '
                                                                      'secret '
                                                                      'changed '
                                                                      'hook.',
                                                       'properties': {'Params': {'$ref': '#/definitions/GetSecretConsumerInfoArgs'},
                                                                      'Result': {'$ref': '#/definitions/SecretConsumerInfoResults'}},
                                                       'type': 'object'},
                    'GetSecretBackendConfigs': {'description': 'GetSecretBackendConfigs '
                                                               'gets the config '
                                                               'needed to create a '
                                                               'client to secret '
                                                               'backends.',
                                                'properties': {'Params': {'$ref': '#/definitions/SecretBackendArgs'},
                                                               'Result': {'$ref': '#/definitions/SecretBackendConfigResults'}},
                                                'type': 'object'},
                    'GetSecretContentInfo': {'description': 'GetSecretContentInfo '
                                                            'returns the secret '
                                                            'values for the '
                                                            'specified secrets.',
                                             'properties': {'Params': {'$ref': '#/definitions/GetSecretContentArgs'},
                                                            'Result': {'$ref': '#/definitions/SecretContentResults'}},
                                             'type': 'object'},
                    'GetSecretMetadata': {'description': 'GetSecretMetadata '
                                                         'returns metadata for the '
                                                         "caller's secrets.",
                                          'properties': {'Result': {'$ref': '#/definitions/ListSecretResults'}},
                                          'type': 'object'},
                    'GetSecretRevisionContentInfo': {'description': 'GetSecretRevisionContentInfo '
                                                                    'returns the '
                                                                    'secret values '
                                                                    'for the '
                                                                    'specified '
                                                                    'secret '
                                                                    'revisions.',
                                                     'properties': {'Params': {'$ref': '#/definitions/SecretRevisionArg'},
                                                                    'Result': {'$ref': '#/definitions/SecretContentResults'}},
                                                     'type': 'object'},
                    'RemoveSecrets': {'description': 'RemoveSecrets removes the '
                                                     'specified secrets.',
                                      'properties': {'Params': {'$ref': '#/definitions/DeleteSecretArgs'},
                                                     'Result': {'$ref': '#/definitions/ErrorResults'}},
                                      'type': 'object'},
                    'SecretsGrant': {'description': 'SecretsGrant grants access to '
                                                    'a secret for the specified '
                                                    'subjects.',
                                     'properties': {'Params': {'$ref': '#/definitions/GrantRevokeSecretArgs'},
                                                    'Result': {'$ref': '#/definitions/ErrorResults'}},
                                     'type': 'object'},
                    'SecretsRevoke': {'description': 'SecretsRevoke revokes access '
                                                     'to a secret for the '
                                                     'specified subjects.',
                                      'properties': {'Params': {'$ref': '#/definitions/GrantRevokeSecretArgs'},
                                                     'Result': {'$ref': '#/definitions/ErrorResults'}},
                                      'type': 'object'},
                    'SecretsRotated': {'description': 'SecretsRotated records when '
                                                      'secrets were last rotated.',
                                       'properties': {'Params': {'$ref': '#/definitions/SecretRotatedArgs'},
                                                      'Result': {'$ref': '#/definitions/ErrorResults'}},
                                       'type': 'object'},
                    'UpdateSecrets': {'description': 'UpdateSecrets updates the '
                                                     'specified secrets.',
                                      'properties': {'Params': {'$ref': '#/definitions/UpdateSecretArgs'},
                                                     'Result': {'$ref': '#/definitions/ErrorResults'}},
                                      'type': 'object'},
                    'WatchConsumedSecretsChanges': {'description': 'WatchConsumedSecretsChanges '
                                                                   'sets up a '
                                                                   'watcher to '
                                                                   'notify of '
                                                                   'changes to '
                                                                   'secret '
                                                                   'revisions for '
                                                                   'the specified '
                                                                   'consumers.',
                                                    'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                                   'Result': {'$ref': '#/definitions/StringsWatchResults'}},
                                                    'type': 'object'},
                    'WatchObsolete': {'description': 'WatchObsolete returns a '
                                                     'watcher for notifying when:\n'
                                                     '  - a secret owned by the '
                                                     'entity is deleted\n'
                                                     '  - a secret revision owed '
                                                     'by the entity no longer\n'
                                                     '    has any consumers\n'
                                                     '\n'
                                                     'Obsolete revisions results '
                                                     'are "uri/revno" and deleted\n'
                                                     'secret results are "uri".',
                                      'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                     'Result': {'$ref': '#/definitions/StringsWatchResult'}},
                                      'type': 'object'},
                    'WatchSecretRevisionsExpiryChanges': {'description': 'WatchSecretRevisionsExpiryChanges '
                                                                         'sets up '
                                                                         'a '
                                                                         'watcher '
                                                                         'to '
                                                                         'notify '
                                                                         'of '
                                                                         'changes '
                                                                         'to '
                                                                         'secret '
                                                                         'revision '
                                                                         'expiry '
                                                                         'config.',
                                                          'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                                         'Result': {'$ref': '#/definitions/SecretTriggerWatchResult'}},
                                                          'type': 'object'},
                    'WatchSecretsRotationChanges': {'description': 'WatchSecretsRotationChanges '
                                                                   'sets up a '
                                                                   'watcher to '
                                                                   'notify of '
                                                                   'changes to '
                                                                   'secret '
                                                                   'rotation '
                                                                   'config.',
                                                    'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                                                   'Result': {'$ref': '#/definitions/SecretTriggerWatchResult'}},
                                                    'type': 'object'}},
     'type': 'object'}
    

    @ReturnMapping(StringResults)
    async def CreateSecretURIs(self, count=None):
        '''
        CreateSecretURIs creates new secret URIs.

        count : int
        Returns -> StringResults
        '''
        if count is not None and not isinstance(count, int):
            raise Exception("Expected count to be a int, received: {}".format(type(count)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='SecretsManager',
                   request='CreateSecretURIs',
                   version=2,
                   params=_params)
        _params['count'] = count
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(StringResults)
    async def CreateSecrets(self, args=None):
        '''
        CreateSecrets creates new secrets.

        args : typing.Sequence[~CreateSecretArg]
        Returns -> StringResults
        '''
        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='SecretsManager',
                   request='CreateSecrets',
                   version=2,
                   params=_params)
        _params['args'] = args
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(SecretConsumerInfoResults)
    async def GetConsumerSecretsRevisionInfo(self, consumer_tag=None, uris=None):
        '''
        GetConsumerSecretsRevisionInfo returns the latest secret revisions for the specified secrets.
        This facade method is used for remote watcher to get the latest secret revisions and labels for a secret changed hook.

        consumer_tag : str
        uris : typing.Sequence[str]
        Returns -> SecretConsumerInfoResults
        '''
        if consumer_tag is not None and not isinstance(consumer_tag, (bytes, str)):
            raise Exception("Expected consumer_tag to be a str, received: {}".format(type(consumer_tag)))

        if uris is not None and not isinstance(uris, (bytes, str, list)):
            raise Exception("Expected uris to be a Sequence, received: {}".format(type(uris)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='SecretsManager',
                   request='GetConsumerSecretsRevisionInfo',
                   version=2,
                   params=_params)
        _params['consumer-tag'] = consumer_tag
        _params['uris'] = uris
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(SecretBackendConfigResults)
    async def GetSecretBackendConfigs(self, backend_ids=None):
        '''
        GetSecretBackendConfigs gets the config needed to create a client to secret backends.

        backend_ids : typing.Sequence[str]
        Returns -> SecretBackendConfigResults
        '''
        if backend_ids is not None and not isinstance(backend_ids, (bytes, str, list)):
            raise Exception("Expected backend_ids to be a Sequence, received: {}".format(type(backend_ids)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='SecretsManager',
                   request='GetSecretBackendConfigs',
                   version=2,
                   params=_params)
        _params['backend-ids'] = backend_ids
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(SecretContentResults)
    async def GetSecretContentInfo(self, args=None):
        '''
        GetSecretContentInfo returns the secret values for the specified secrets.

        args : typing.Sequence[~GetSecretContentArg]
        Returns -> SecretContentResults
        '''
        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='SecretsManager',
                   request='GetSecretContentInfo',
                   version=2,
                   params=_params)
        _params['args'] = args
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ListSecretResults)
    async def GetSecretMetadata(self):
        '''
        GetSecretMetadata returns metadata for the caller's secrets.


        Returns -> ListSecretResults
        '''

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='SecretsManager',
                   request='GetSecretMetadata',
                   version=2,
                   params=_params)

        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(SecretContentResults)
    async def GetSecretRevisionContentInfo(self, pending_delete=None, revisions=None, uri=None):
        '''
        GetSecretRevisionContentInfo returns the secret values for the specified secret revisions.

        pending_delete : bool
        revisions : typing.Sequence[int]
        uri : str
        Returns -> SecretContentResults
        '''
        if pending_delete is not None and not isinstance(pending_delete, bool):
            raise Exception("Expected pending_delete to be a bool, received: {}".format(type(pending_delete)))

        if revisions is not None and not isinstance(revisions, (bytes, str, list)):
            raise Exception("Expected revisions to be a Sequence, received: {}".format(type(revisions)))

        if uri is not None and not isinstance(uri, (bytes, str)):
            raise Exception("Expected uri to be a str, received: {}".format(type(uri)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='SecretsManager',
                   request='GetSecretRevisionContentInfo',
                   version=2,
                   params=_params)
        _params['pending-delete'] = pending_delete
        _params['revisions'] = revisions
        _params['uri'] = uri
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ErrorResults)
    async def RemoveSecrets(self, args=None):
        '''
        RemoveSecrets removes the specified secrets.

        args : typing.Sequence[~DeleteSecretArg]
        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='SecretsManager',
                   request='RemoveSecrets',
                   version=2,
                   params=_params)
        _params['args'] = args
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ErrorResults)
    async def SecretsGrant(self, args=None):
        '''
        SecretsGrant grants access to a secret for the specified subjects.

        args : typing.Sequence[~GrantRevokeSecretArg]
        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='SecretsManager',
                   request='SecretsGrant',
                   version=2,
                   params=_params)
        _params['args'] = args
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ErrorResults)
    async def SecretsRevoke(self, args=None):
        '''
        SecretsRevoke revokes access to a secret for the specified subjects.

        args : typing.Sequence[~GrantRevokeSecretArg]
        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='SecretsManager',
                   request='SecretsRevoke',
                   version=2,
                   params=_params)
        _params['args'] = args
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ErrorResults)
    async def SecretsRotated(self, args=None):
        '''
        SecretsRotated records when secrets were last rotated.

        args : typing.Sequence[~SecretRotatedArg]
        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='SecretsManager',
                   request='SecretsRotated',
                   version=2,
                   params=_params)
        _params['args'] = args
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ErrorResults)
    async def UpdateSecrets(self, args=None):
        '''
        UpdateSecrets updates the specified secrets.

        args : typing.Sequence[~UpdateSecretArg]
        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='SecretsManager',
                   request='UpdateSecrets',
                   version=2,
                   params=_params)
        _params['args'] = args
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(StringsWatchResults)
    async def WatchConsumedSecretsChanges(self, entities=None):
        '''
        WatchConsumedSecretsChanges sets up a watcher to notify of changes to secret revisions for the specified consumers.

        entities : typing.Sequence[~Entity]
        Returns -> StringsWatchResults
        '''
        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='SecretsManager',
                   request='WatchConsumedSecretsChanges',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(StringsWatchResult)
    async def WatchObsolete(self, entities=None):
        '''
        WatchObsolete returns a watcher for notifying when:
          - a secret owned by the entity is deleted
          - a secret revision owed by the entity no longer
            has any consumers

        Obsolete revisions results are "uri/revno" and deleted
        secret results are "uri".

        entities : typing.Sequence[~Entity]
        Returns -> StringsWatchResult
        '''
        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='SecretsManager',
                   request='WatchObsolete',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(SecretTriggerWatchResult)
    async def WatchSecretRevisionsExpiryChanges(self, entities=None):
        '''
        WatchSecretRevisionsExpiryChanges sets up a watcher to notify of changes to secret revision expiry config.

        entities : typing.Sequence[~Entity]
        Returns -> SecretTriggerWatchResult
        '''
        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='SecretsManager',
                   request='WatchSecretRevisionsExpiryChanges',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(SecretTriggerWatchResult)
    async def WatchSecretsRotationChanges(self, entities=None):
        '''
        WatchSecretsRotationChanges sets up a watcher to notify of changes to secret rotation config.

        entities : typing.Sequence[~Entity]
        Returns -> SecretTriggerWatchResult
        '''
        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='SecretsManager',
                   request='WatchSecretsRotationChanges',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



class SingularFacade(Type):
    name = 'Singular'
    version = 2
    schema =     {'definitions': {'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'},
                     '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'},
                     'SingularClaim': {'additionalProperties': False,
                                       'properties': {'claimant-tag': {'type': 'string'},
                                                      'duration': {'type': 'integer'},
                                                      'entity-tag': {'type': 'string'}},
                                       'required': ['entity-tag',
                                                    'claimant-tag',
                                                    'duration'],
                                       'type': 'object'},
                     'SingularClaims': {'additionalProperties': False,
                                        'properties': {'claims': {'items': {'$ref': '#/definitions/SingularClaim'},
                                                                  'type': 'array'}},
                                        'required': ['claims'],
                                        'type': 'object'}},
     'properties': {'Claim': {'description': 'Claim makes the supplied '
                                             'singular-controller lease requests. '
                                             '(In practice,\n'
                                             'any requests not for the '
                                             "connection's model or controller, or "
                                             'not on behalf\n'
                                             'of the connected ModelManager '
                                             'machine, will be rejected.)',
                              'properties': {'Params': {'$ref': '#/definitions/SingularClaims'},
                                             'Result': {'$ref': '#/definitions/ErrorResults'}},
                              'type': 'object'},
                    'Wait': {'description': 'Wait waits for the '
                                            'singular-controller lease to expire '
                                            'for all supplied\n'
                                            'entities. (In practice, any requests '
                                            'that do not refer to the '
                                            "connection's\n"
                                            'model or controller will be '
                                            'rejected.)',
                             'properties': {'Params': {'$ref': '#/definitions/Entities'},
                                            'Result': {'$ref': '#/definitions/ErrorResults'}},
                             'type': 'object'}},
     'type': 'object'}
    

    @ReturnMapping(ErrorResults)
    async def Claim(self, claims=None):
        '''
        Claim makes the supplied singular-controller lease requests. (In practice,
        any requests not for the connection's model or controller, or not on behalf
        of the connected ModelManager machine, will be rejected.)

        claims : typing.Sequence[~SingularClaim]
        Returns -> ErrorResults
        '''
        if claims is not None and not isinstance(claims, (bytes, str, list)):
            raise Exception("Expected claims to be a Sequence, received: {}".format(type(claims)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='Singular',
                   request='Claim',
                   version=2,
                   params=_params)
        _params['claims'] = claims
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ErrorResults)
    async def Wait(self, entities=None):
        '''
        Wait waits for the singular-controller lease to expire for all supplied
        entities. (In practice, any requests that do not refer to the connection's
        model or controller will be rejected.)

        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='Singular',
                   request='Wait',
                   version=2,
                   params=_params)
        _params['entities'] = entities
        reply = await self.rpc(msg)
        return reply



class StatusHistoryFacade(Type):
    name = 'StatusHistory'
    version = 2
    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'},
                     'ModelConfigResult': {'additionalProperties': False,
                                           'properties': {'config': {'patternProperties': {'.*': {'additionalProperties': True,
                                                                                                  'type': 'object'}},
                                                                     'type': 'object'}},
                                           'required': ['config'],
                                           'type': 'object'},
                     'NotifyWatchResult': {'additionalProperties': False,
                                           'properties': {'NotifyWatcherId': {'type': 'string'},
                                                          'error': {'$ref': '#/definitions/Error'}},
                                           'required': ['NotifyWatcherId'],
                                           'type': 'object'},
                     'StatusHistoryPruneArgs': {'additionalProperties': False,
                                                'properties': {'max-history-mb': {'type': 'integer'},
                                                               'max-history-time': {'type': 'integer'}},
                                                'required': ['max-history-time',
                                                             'max-history-mb'],
                                                'type': 'object'}},
     'properties': {'ModelConfig': {'description': 'ModelConfig returns the '
                                                   "current model's configuration.",
                                    'properties': {'Result': {'$ref': '#/definitions/ModelConfigResult'}},
                                    'type': 'object'},
                    'Prune': {'description': 'Prune endpoint removes status '
                                             'history entries until\n'
                                             'only the ones newer than now - '
                                             'p.MaxHistoryTime remain and\n'
                                             'the history is smaller than '
                                             'p.MaxHistoryMB.',
                              'properties': {'Params': {'$ref': '#/definitions/StatusHistoryPruneArgs'}},
                              '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'}
    

    @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='StatusHistory',
                   request='ModelConfig',
                   version=2,
                   params=_params)

        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(None)
    async def Prune(self, max_history_mb=None, max_history_time=None):
        '''
        Prune endpoint removes status history entries until
        only the ones newer than now - p.MaxHistoryTime remain and
        the history is smaller than p.MaxHistoryMB.

        max_history_mb : int
        max_history_time : int
        Returns -> None
        '''
        if max_history_mb is not None and not isinstance(max_history_mb, int):
            raise Exception("Expected max_history_mb to be a int, received: {}".format(type(max_history_mb)))

        if max_history_time is not None and not isinstance(max_history_time, int):
            raise Exception("Expected max_history_time to be a int, received: {}".format(type(max_history_time)))

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='StatusHistory',
                   request='Prune',
                   version=2,
                   params=_params)
        _params['max-history-mb'] = max_history_mb
        _params['max-history-time'] = max_history_time
        reply = await self.rpc(msg)
        return reply



    @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='StatusHistory',
                   request='WatchForModelConfigChanges',
                   version=2,
                   params=_params)

        reply = await self.rpc(msg)
        return reply



class UpgradeStepsFacade(Type):
    name = 'UpgradeSteps'
    version = 2
    schema =     {'definitions': {'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'},
                     'ErrorResults': {'additionalProperties': False,
                                      'properties': {'results': {'items': {'$ref': '#/definitions/ErrorResult'},
                                                                 'type': 'array'}},
                                      'required': ['results'],
                                      'type': 'object'},
                     'SetUnitStateArg': {'additionalProperties': False,
                                         'properties': {'charm-state': {'patternProperties': {'.*': {'type': 'string'}},
                                                                        'type': 'object'},
                                                        'meter-status-state': {'type': 'string'},
                                                        'relation-state': {'patternProperties': {'.*': {'type': 'string'}},
                                                                           'type': 'object'},
                                                        'secret-state': {'type': 'string'},
                                                        'storage-state': {'type': 'string'},
                                                        'tag': {'type': 'string'},
                                                        'uniter-state': {'type': 'string'}},
                                         'required': ['tag'],
                                         'type': 'object'},
                     'SetUnitStateArgs': {'additionalProperties': False,
                                          'properties': {'args': {'items': {'$ref': '#/definitions/SetUnitStateArg'},
                                                                  'type': 'array'}},
                                          'required': ['args'],
                                          'type': 'object'}},
     'properties': {'ResetKVMMachineModificationStatusIdle': {'description': 'ResetKVMMachineModificationStatusIdle '
                                                                             'sets '
                                                                             'the '
                                                                             'modification '
                                                                             'status\n'
                                                                             'of a '
                                                                             'kvm '
                                                                             'machine '
                                                                             'to '
                                                                             'idle '
                                                                             'if '
                                                                             'it '
                                                                             'is '
                                                                             'in '
                                                                             'an '
                                                                             'error '
                                                                             'state '
                                                                             'before '
                                                                             'upgrade.\n'
                                                                             'Related '
                                                                             'to '
                                                                             'lp:1829393.',
                                                              'properties': {'Params': {'$ref': '#/definitions/Entity'},
                                                                             'Result': {'$ref': '#/definitions/ErrorResult'}},
                                                              'type': 'object'},
                    'WriteAgentState': {'description': 'WriteAgentState writes the '
                                                       'agent state for the set of '
                                                       'units provided. This\n'
                                                       'call presently deals with '
                                                       'the state for the unit '
                                                       'agent.',
                                        'properties': {'Params': {'$ref': '#/definitions/SetUnitStateArgs'},
                                                       'Result': {'$ref': '#/definitions/ErrorResults'}},
                                        'type': 'object'}},
     'type': 'object'}
    

    @ReturnMapping(ErrorResult)
    async def ResetKVMMachineModificationStatusIdle(self, tag=None):
        '''
        ResetKVMMachineModificationStatusIdle sets the modification status
        of a kvm machine to idle if it is in an error state before upgrade.
        Related to lp:1829393.

        tag : str
        Returns -> ErrorResult
        '''
        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='UpgradeSteps',
                   request='ResetKVMMachineModificationStatusIdle',
                   version=2,
                   params=_params)
        _params['tag'] = tag
        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(ErrorResults)
    async def WriteAgentState(self, args=None):
        '''
        WriteAgentState writes the agent state for the set of units provided. This
        call presently deals with the state for the unit agent.

        args : typing.Sequence[~SetUnitStateArg]
        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='UpgradeSteps',
                   request='WriteAgentState',
                   version=2,
                   params=_params)
        _params['args'] = args
        reply = await self.rpc(msg)
        return reply



class VolumeAttachmentsWatcherFacade(Type):
    name = 'VolumeAttachmentsWatcher'
    version = 2
    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'},
                     'MachineStorageId': {'additionalProperties': False,
                                          'properties': {'attachment-tag': {'type': 'string'},
                                                         'machine-tag': {'type': 'string'}},
                                          'required': ['machine-tag',
                                                       'attachment-tag'],
                                          'type': 'object'},
                     'MachineStorageIdsWatchResult': {'additionalProperties': False,
                                                      'properties': {'changes': {'items': {'$ref': '#/definitions/MachineStorageId'},
                                                                                 'type': 'array'},
                                                                     'error': {'$ref': '#/definitions/Error'},
                                                                     'watcher-id': {'type': 'string'}},
                                                      'required': ['watcher-id',
                                                                   'changes'],
                                                      'type': 'object'}},
     'properties': {'Next': {'description': 'Next returns when a change has '
                                            'occurred to an entity of the\n'
                                            'collection being watched since the '
                                            'most recent call to Next\n'
                                            'or the Watch call that created the '
                                            'srvMachineStorageIdsWatcher.',
                             'properties': {'Result': {'$ref': '#/definitions/MachineStorageIdsWatchResult'}},
                             'type': 'object'},
                    'Stop': {'description': 'Stop stops the watcher.',
                             'type': 'object'}},
     'type': 'object'}
    

    @ReturnMapping(MachineStorageIdsWatchResult)
    async def Next(self):
        '''
        Next returns when a change has occurred to an entity of the
        collection being watched since the most recent call to Next
        or the Watch call that created the srvMachineStorageIdsWatcher.


        Returns -> MachineStorageIdsWatchResult
        '''

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='VolumeAttachmentsWatcher',
                   request='Next',
                   version=2,
                   params=_params)

        reply = await self.rpc(msg)
        return reply



    @ReturnMapping(None)
    async def Stop(self):
        '''
        Stop stops the watcher.


        Returns -> None
        '''

        # map input types to rpc msg
        _params = dict()
        msg = dict(type='VolumeAttachmentsWatcher',
                   request='Stop',
                   version=2,
                   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


