@@ -11451,7 +11451,46 @@ async def rpc(self, msg):
1145111451class UndertakerFacade(Type):
1145211452 name = 'Undertaker'
1145311453 version = 1
11454- schema = {'definitions': {'EntityStatusArgs': {'additionalProperties': False,
11454+ schema = {'definitions': {'CloudCredential': {'additionalProperties': False,
11455+ 'properties': {'attrs': {'patternProperties': {'.*': {'type': 'string'}},
11456+ 'type': 'object'},
11457+ 'auth-type': {'type': 'string'},
11458+ 'redacted': {'items': {'type': 'string'},
11459+ 'type': 'array'}},
11460+ 'required': ['auth-type'],
11461+ 'type': 'object'},
11462+ 'CloudSpec': {'additionalProperties': False,
11463+ 'properties': {'cacertificates': {'items': {'type': 'string'},
11464+ 'type': 'array'},
11465+ 'credential': {'$ref': '#/definitions/CloudCredential'},
11466+ 'endpoint': {'type': 'string'},
11467+ 'identity-endpoint': {'type': 'string'},
11468+ 'is-controller-cloud': {'type': 'boolean'},
11469+ 'name': {'type': 'string'},
11470+ 'region': {'type': 'string'},
11471+ 'skip-tls-verify': {'type': 'boolean'},
11472+ 'storage-endpoint': {'type': 'string'},
11473+ 'type': {'type': 'string'}},
11474+ 'required': ['type', 'name'],
11475+ 'type': 'object'},
11476+ 'CloudSpecResult': {'additionalProperties': False,
11477+ 'properties': {'error': {'$ref': '#/definitions/Error'},
11478+ 'result': {'$ref': '#/definitions/CloudSpec'}},
11479+ 'type': 'object'},
11480+ 'CloudSpecResults': {'additionalProperties': False,
11481+ 'properties': {'results': {'items': {'$ref': '#/definitions/CloudSpecResult'},
11482+ 'type': 'array'}},
11483+ 'type': 'object'},
11484+ 'Entities': {'additionalProperties': False,
11485+ 'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
11486+ 'type': 'array'}},
11487+ 'required': ['entities'],
11488+ 'type': 'object'},
11489+ 'Entity': {'additionalProperties': False,
11490+ 'properties': {'tag': {'type': 'string'}},
11491+ 'required': ['tag'],
11492+ 'type': 'object'},
11493+ 'EntityStatusArgs': {'additionalProperties': False,
1145511494 'properties': {'data': {'patternProperties': {'.*': {'additionalProperties': True,
1145611495 'type': 'object'}},
1145711496 'type': 'object'},
@@ -11485,6 +11524,7 @@ class UndertakerFacade(Type):
1148511524 'type': 'object'}},
1148611525 'required': ['config'],
1148711526 'type': 'object'},
11527+ 'ModelTag': {'additionalProperties': False, 'type': 'object'},
1148811528 'NotifyWatchResult': {'additionalProperties': False,
1148911529 'properties': {'NotifyWatcherId': {'type': 'string'},
1149011530 'error': {'$ref': '#/definitions/Error'}},
@@ -11519,8 +11559,19 @@ class UndertakerFacade(Type):
1151911559 'result': {'$ref': '#/definitions/UndertakerModelInfo'}},
1152011560 'required': ['result'],
1152111561 'type': 'object'}},
11522- 'properties': {'ModelConfig': {'description': 'ModelConfig returns the '
11523- "model's configuration.",
11562+ 'properties': {'CloudSpec': {'description': "CloudSpec returns the model's "
11563+ 'cloud spec.',
11564+ 'properties': {'Params': {'$ref': '#/definitions/Entities'},
11565+ 'Result': {'$ref': '#/definitions/CloudSpecResults'}},
11566+ 'type': 'object'},
11567+ 'GetCloudSpec': {'description': 'GetCloudSpec constructs the '
11568+ 'CloudSpec for a validated and '
11569+ 'authorized model.',
11570+ 'properties': {'Params': {'$ref': '#/definitions/ModelTag'},
11571+ 'Result': {'$ref': '#/definitions/CloudSpecResult'}},
11572+ 'type': 'object'},
11573+ 'ModelConfig': {'description': 'ModelConfig returns the '
11574+ "current model's configuration.",
1152411575 'properties': {'Result': {'$ref': '#/definitions/ModelConfigResult'}},
1152511576 'type': 'object'},
1152611577 'ModelInfo': {'description': 'ModelInfo returns information on '
@@ -11545,6 +11596,39 @@ class UndertakerFacade(Type):
1154511596 'properties': {'Params': {'$ref': '#/definitions/SetStatus'},
1154611597 'Result': {'$ref': '#/definitions/ErrorResults'}},
1154711598 'type': 'object'},
11599+ 'WatchCloudSpecsChanges': {'description': 'WatchCloudSpecsChanges '
11600+ 'returns a watcher '
11601+ 'for cloud spec '
11602+ 'changes.',
11603+ 'properties': {'Params': {'$ref': '#/definitions/Entities'},
11604+ 'Result': {'$ref': '#/definitions/NotifyWatchResults'}},
11605+ 'type': 'object'},
11606+ 'WatchForModelConfigChanges': {'description': 'WatchForModelConfigChanges '
11607+ 'returns a '
11608+ 'NotifyWatcher '
11609+ 'that observes\n'
11610+ 'changes to the '
11611+ 'model '
11612+ 'configuration.\n'
11613+ 'Note that '
11614+ 'although the '
11615+ 'NotifyWatchResult '
11616+ 'contains an '
11617+ 'Error field,\n'
11618+ "it's not used "
11619+ 'because we are '
11620+ 'only returning '
11621+ 'a single '
11622+ 'watcher,\n'
11623+ 'so we use the '
11624+ 'regular error '
11625+ 'return.',
11626+ 'properties': {'Result': {'$ref': '#/definitions/NotifyWatchResult'}},
11627+ 'type': 'object'},
11628+ 'WatchModel': {'description': 'WatchModel creates a watcher '
11629+ 'for the current model.',
11630+ 'properties': {'Result': {'$ref': '#/definitions/NotifyWatchResults'}},
11631+ 'type': 'object'},
1154811632 'WatchModelResources': {'description': 'WatchModelResources '
1154911633 'creates watchers for '
1155011634 'changes to the '
@@ -11557,10 +11641,54 @@ class UndertakerFacade(Type):
1155711641 'type': 'object'}
1155811642
1155911643
11644+ @ReturnMapping(CloudSpecResults)
11645+ async def CloudSpec(self, entities=None):
11646+ '''
11647+ CloudSpec returns the model's cloud spec.
11648+
11649+ entities : typing.Sequence[~Entity]
11650+ Returns -> CloudSpecResults
11651+ '''
11652+ if entities is not None and not isinstance(entities, (bytes, str, list)):
11653+ raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities)))
11654+
11655+ # map input types to rpc msg
11656+ _params = dict()
11657+ msg = dict(type='Undertaker',
11658+ request='CloudSpec',
11659+ version=1,
11660+ params=_params)
11661+ _params['entities'] = entities
11662+ reply = await self.rpc(msg)
11663+ return reply
11664+
11665+
11666+
11667+ @ReturnMapping(CloudSpecResult)
11668+ async def GetCloudSpec(self):
11669+ '''
11670+ GetCloudSpec constructs the CloudSpec for a validated and authorized model.
11671+
11672+
11673+ Returns -> CloudSpecResult
11674+ '''
11675+
11676+ # map input types to rpc msg
11677+ _params = dict()
11678+ msg = dict(type='Undertaker',
11679+ request='GetCloudSpec',
11680+ version=1,
11681+ params=_params)
11682+
11683+ reply = await self.rpc(msg)
11684+ return reply
11685+
11686+
11687+
1156011688 @ReturnMapping(ModelConfigResult)
1156111689 async def ModelConfig(self):
1156211690 '''
11563- ModelConfig returns the model's configuration.
11691+ ModelConfig returns the current model's configuration.
1156411692
1156511693
1156611694 Returns -> ModelConfigResult
@@ -11665,6 +11793,75 @@ async def SetStatus(self, entities=None):
1166511793
1166611794
1166711795
11796+ @ReturnMapping(NotifyWatchResults)
11797+ async def WatchCloudSpecsChanges(self, entities=None):
11798+ '''
11799+ WatchCloudSpecsChanges returns a watcher for cloud spec changes.
11800+
11801+ entities : typing.Sequence[~Entity]
11802+ Returns -> NotifyWatchResults
11803+ '''
11804+ if entities is not None and not isinstance(entities, (bytes, str, list)):
11805+ raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities)))
11806+
11807+ # map input types to rpc msg
11808+ _params = dict()
11809+ msg = dict(type='Undertaker',
11810+ request='WatchCloudSpecsChanges',
11811+ version=1,
11812+ params=_params)
11813+ _params['entities'] = entities
11814+ reply = await self.rpc(msg)
11815+ return reply
11816+
11817+
11818+
11819+ @ReturnMapping(NotifyWatchResult)
11820+ async def WatchForModelConfigChanges(self):
11821+ '''
11822+ WatchForModelConfigChanges returns a NotifyWatcher that observes
11823+ changes to the model configuration.
11824+ Note that although the NotifyWatchResult contains an Error field,
11825+ it's not used because we are only returning a single watcher,
11826+ so we use the regular error return.
11827+
11828+
11829+ Returns -> NotifyWatchResult
11830+ '''
11831+
11832+ # map input types to rpc msg
11833+ _params = dict()
11834+ msg = dict(type='Undertaker',
11835+ request='WatchForModelConfigChanges',
11836+ version=1,
11837+ params=_params)
11838+
11839+ reply = await self.rpc(msg)
11840+ return reply
11841+
11842+
11843+
11844+ @ReturnMapping(NotifyWatchResults)
11845+ async def WatchModel(self):
11846+ '''
11847+ WatchModel creates a watcher for the current model.
11848+
11849+
11850+ Returns -> NotifyWatchResults
11851+ '''
11852+
11853+ # map input types to rpc msg
11854+ _params = dict()
11855+ msg = dict(type='Undertaker',
11856+ request='WatchModel',
11857+ version=1,
11858+ params=_params)
11859+
11860+ reply = await self.rpc(msg)
11861+ return reply
11862+
11863+
11864+
1166811865 @ReturnMapping(NotifyWatchResults)
1166911866 async def WatchModelResources(self):
1167011867 '''
0 commit comments