Skip to content

Commit

Permalink
Merge pull request #895 from cderici/add-2.9.43-facades
Browse files Browse the repository at this point in the history
#895

#### Description

Updates the facades with the latest schema from Juju 2.9 branch, regenerates the clients, and adds the `AgentLifeFlag` facade to the facades list.


#### QA Steps

Pretty straightforward console connection should suffice (as the `m.connect()` is doing a bunch of stuff with the facades under the hood to establish a connection):

```sh
$ python -m asyncio
asyncio REPL 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] on linux
Use "await" directly instead of "asyncio.run()".
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio
>>> from juju import model;m = model.Model();await m.connect()
>>>
```

Without this change you'd see additional output saying:

```sh
unknown facade AgentLifeFlag
unexpected facade AgentLifeFlag found, unable to decipher version to use
```
  • Loading branch information
jujubot authored Jul 6, 2023
2 parents d67be90 + 0556844 commit 521b5ef
Show file tree
Hide file tree
Showing 7 changed files with 51,840 additions and 84 deletions.
4 changes: 4 additions & 0 deletions juju/client/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ class AgentFacade(TypeFactory):
pass


class AgentLifeFlagFacade(TypeFactory):
pass


class AgentToolsFacade(TypeFactory):
pass

Expand Down
509 changes: 438 additions & 71 deletions juju/client/_client1.py

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions juju/client/_client2.py
Original file line number Diff line number Diff line change
Expand Up @@ -6866,16 +6866,14 @@ class CrossModelRelationsFacade(Type):
'required': ['results'],
'type': 'object'},
'IngressNetworksChangeEvent': {'additionalProperties': False,
'properties': {'application-token': {'type': 'string'},
'bakery-version': {'type': 'integer'},
'properties': {'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,
Expand Down
84 changes: 75 additions & 9 deletions juju/client/_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4593,6 +4593,78 @@ def __init__(self, results=None, **unknown_fields):



class CAASApplicationProvisioningState(Type):
_toSchema = {'scale_target': 'scale-target', 'scaling': 'scaling'}
_toPy = {'scale-target': 'scale_target', 'scaling': 'scaling'}
def __init__(self, scale_target=None, scaling=None, **unknown_fields):
'''
scale_target : int
scaling : bool
'''
scale_target_ = scale_target
scaling_ = scaling

# Validate arguments against known Juju API types.
if scale_target_ is not None and not isinstance(scale_target_, int):
raise Exception("Expected scale_target_ to be a int, received: {}".format(type(scale_target_)))

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

self.scale_target = scale_target_
self.scaling = scaling_
self.unknown_fields = unknown_fields



class CAASApplicationProvisioningStateArg(Type):
_toSchema = {'application': 'application', 'provisioning_state': 'provisioning-state'}
_toPy = {'application': 'application', 'provisioning-state': 'provisioning_state'}
def __init__(self, application=None, provisioning_state=None, **unknown_fields):
'''
application : Entity
provisioning_state : CAASApplicationProvisioningState
'''
application_ = Entity.from_json(application) if application else None
provisioning_state_ = CAASApplicationProvisioningState.from_json(provisioning_state) if provisioning_state else None

# Validate arguments against known Juju API types.
if application_ is not None and not isinstance(application_, (dict, Entity)):
raise Exception("Expected application_ to be a Entity, received: {}".format(type(application_)))

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

self.application = application_
self.provisioning_state = provisioning_state_
self.unknown_fields = unknown_fields



class CAASApplicationProvisioningStateResult(Type):
_toSchema = {'error': 'error', 'provisioning_state': 'provisioning-state'}
_toPy = {'error': 'error', 'provisioning-state': 'provisioning_state'}
def __init__(self, error=None, provisioning_state=None, **unknown_fields):
'''
error : Error
provisioning_state : CAASApplicationProvisioningState
'''
error_ = Error.from_json(error) if error else None
provisioning_state_ = CAASApplicationProvisioningState.from_json(provisioning_state) if provisioning_state else None

# Validate arguments against known Juju API types.
if error_ is not None and not isinstance(error_, (dict, Error)):
raise Exception("Expected error_ to be a Error, received: {}".format(type(error_)))

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

self.error = error_
self.provisioning_state = provisioning_state_
self.unknown_fields = unknown_fields



class CAASUnitInfo(Type):
_toSchema = {'tag': 'tag', 'unit_status': 'unit-status'}
_toPy = {'tag': 'tag', 'unit-status': 'unit_status'}
Expand Down Expand Up @@ -12310,28 +12382,23 @@ def __init__(self, bundle=None, channel_map=None, charm=None, description=None,


class IngressNetworksChangeEvent(Type):
_toSchema = {'application_token': 'application-token', 'bakery_version': 'bakery-version', 'ingress_required': 'ingress-required', 'macaroons': 'macaroons', 'networks': 'networks', 'relation_token': 'relation-token'}
_toPy = {'application-token': 'application_token', 'bakery-version': 'bakery_version', 'ingress-required': 'ingress_required', 'macaroons': 'macaroons', 'networks': 'networks', 'relation-token': 'relation_token'}
def __init__(self, application_token=None, bakery_version=None, ingress_required=None, macaroons=None, networks=None, relation_token=None, **unknown_fields):
_toSchema = {'bakery_version': 'bakery-version', 'ingress_required': 'ingress-required', 'macaroons': 'macaroons', 'networks': 'networks', 'relation_token': 'relation-token'}
_toPy = {'bakery-version': 'bakery_version', 'ingress-required': 'ingress_required', 'macaroons': 'macaroons', 'networks': 'networks', 'relation-token': 'relation_token'}
def __init__(self, bakery_version=None, ingress_required=None, macaroons=None, networks=None, relation_token=None, **unknown_fields):
'''
application_token : str
bakery_version : int
ingress_required : bool
macaroons : typing.Sequence[~Macaroon]
networks : typing.Sequence[str]
relation_token : str
'''
application_token_ = application_token
bakery_version_ = bakery_version
ingress_required_ = ingress_required
macaroons_ = [Macaroon.from_json(o) for o in macaroons or []]
networks_ = networks
relation_token_ = relation_token

# Validate arguments against known Juju API types.
if application_token_ is not None and not isinstance(application_token_, (bytes, str)):
raise Exception("Expected application_token_ to be a str, received: {}".format(type(application_token_)))

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

Expand All @@ -12347,7 +12414,6 @@ def __init__(self, application_token=None, bakery_version=None, ingress_required
if relation_token_ is not None and not isinstance(relation_token_, (bytes, str)):
raise Exception("Expected relation_token_ to be a str, received: {}".format(type(relation_token_)))

self.application_token = application_token_
self.bakery_version = bakery_version_
self.ingress_required = ingress_required_
self.macaroons = macaroons_
Expand Down
1 change: 1 addition & 0 deletions juju/client/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
'Action': {'versions': [2]},
'ActionPruner': {'versions': [1]},
'Agent': {'versions': [2]},
'AgentLifeFlag': {'versions': [1]},
'AgentTools': {'versions': [1]},
'Annotations': {'versions': [2]},
'Application': {'versions': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]},
Expand Down
Loading

0 comments on commit 521b5ef

Please sign in to comment.