Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 3.2 facade clients #931

Merged
merged 3 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
205 changes: 201 additions & 4 deletions juju/client/_client1.py
Original file line number Diff line number Diff line change
Expand Up @@ -11451,7 +11451,46 @@ async def rpc(self, msg):
class UndertakerFacade(Type):
name = 'Undertaker'
version = 1
schema = {'definitions': {'EntityStatusArgs': {'additionalProperties': False,
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'},
'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type': 'array'}},
'required': ['entities'],
'type': 'object'},
'Entity': {'additionalProperties': False,
'properties': {'tag': {'type': 'string'}},
'required': ['tag'],
'type': 'object'},
'EntityStatusArgs': {'additionalProperties': False,
'properties': {'data': {'patternProperties': {'.*': {'additionalProperties': True,
'type': 'object'}},
'type': 'object'},
Expand Down Expand Up @@ -11485,6 +11524,7 @@ class UndertakerFacade(Type):
'type': 'object'}},
'required': ['config'],
'type': 'object'},
'ModelTag': {'additionalProperties': False, 'type': 'object'},
'NotifyWatchResult': {'additionalProperties': False,
'properties': {'NotifyWatcherId': {'type': 'string'},
'error': {'$ref': '#/definitions/Error'}},
Expand Down Expand Up @@ -11519,8 +11559,19 @@ class UndertakerFacade(Type):
'result': {'$ref': '#/definitions/UndertakerModelInfo'}},
'required': ['result'],
'type': 'object'}},
'properties': {'ModelConfig': {'description': 'ModelConfig returns the '
"model's configuration.",
'properties': {'CloudSpec': {'description': "CloudSpec returns the model's "
'cloud spec.',
'properties': {'Params': {'$ref': '#/definitions/Entities'},
'Result': {'$ref': '#/definitions/CloudSpecResults'}},
'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'},
'ModelInfo': {'description': 'ModelInfo returns information on '
Expand All @@ -11545,6 +11596,39 @@ class UndertakerFacade(Type):
'properties': {'Params': {'$ref': '#/definitions/SetStatus'},
'Result': {'$ref': '#/definitions/ErrorResults'}},
'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'},
'WatchModel': {'description': 'WatchModel creates a watcher '
'for the current model.',
'properties': {'Result': {'$ref': '#/definitions/NotifyWatchResults'}},
'type': 'object'},
'WatchModelResources': {'description': 'WatchModelResources '
'creates watchers for '
'changes to the '
Expand All @@ -11557,10 +11641,54 @@ class UndertakerFacade(Type):
'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='Undertaker',
request='CloudSpec',
version=1,
params=_params)
_params['entities'] = entities
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='Undertaker',
request='GetCloudSpec',
version=1,
params=_params)

reply = await self.rpc(msg)
return reply



@ReturnMapping(ModelConfigResult)
async def ModelConfig(self):
'''
ModelConfig returns the model's configuration.
ModelConfig returns the current model's configuration.


Returns -> ModelConfigResult
Expand Down Expand Up @@ -11665,6 +11793,75 @@ async def SetStatus(self, entities=None):



@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='Undertaker',
request='WatchCloudSpecsChanges',
version=1,
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='Undertaker',
request='WatchForModelConfigChanges',
version=1,
params=_params)

reply = await self.rpc(msg)
return reply



@ReturnMapping(NotifyWatchResults)
async def WatchModel(self):
'''
WatchModel creates a watcher for the current model.


Returns -> NotifyWatchResults
'''

# map input types to rpc msg
_params = dict()
msg = dict(type='Undertaker',
request='WatchModel',
version=1,
params=_params)

reply = await self.rpc(msg)
return reply



@ReturnMapping(NotifyWatchResults)
async def WatchModelResources(self):
'''
Expand Down
13 changes: 9 additions & 4 deletions juju/client/_client18.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ class ApplicationFacade(Type):
'properties': {'ApplicationOfferDetails': {'$ref': '#/definitions/ApplicationOfferDetails'},
'application-alias': {'type': 'string'},
'application-description': {'type': 'string'},
'auth-token': {'type': 'string'},
'bindings': {'patternProperties': {'.*': {'type': 'string'}},
'type': 'object'},
'endpoints': {'items': {'$ref': '#/definitions/RemoteEndpoint'},
Expand Down Expand Up @@ -2539,8 +2538,9 @@ class UniterFacade(Type):
'type': 'object'},
'SecretBackendArgs': {'additionalProperties': False,
'properties': {'backend-ids': {'items': {'type': 'string'},
'type': 'array'}},
'required': ['backend-ids'],
'type': 'array'},
'for-drain': {'type': 'boolean'}},
'required': ['for-drain', 'backend-ids'],
'type': 'object'},
'SecretBackendConfig': {'additionalProperties': False,
'properties': {'params': {'patternProperties': {'.*': {'additionalProperties': True,
Expand Down Expand Up @@ -4597,23 +4597,28 @@ async def GetRawK8sSpec(self, entities=None):


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

backend_ids : typing.Sequence[str]
for_drain : bool
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)))

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

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

Expand Down
Loading