Skip to content

Commit 521b5ef

Browse files
authored
Merge pull request #895 from cderici/add-2.9.43-facades
#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 ```
2 parents d67be90 + 0556844 commit 521b5ef

7 files changed

Lines changed: 51840 additions & 84 deletions

File tree

juju/client/_client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ class AgentFacade(TypeFactory):
103103
pass
104104

105105

106+
class AgentLifeFlagFacade(TypeFactory):
107+
pass
108+
109+
106110
class AgentToolsFacade(TypeFactory):
107111
pass
108112

juju/client/_client1.py

Lines changed: 438 additions & 71 deletions
Large diffs are not rendered by default.

juju/client/_client2.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6866,16 +6866,14 @@ class CrossModelRelationsFacade(Type):
68666866
'required': ['results'],
68676867
'type': 'object'},
68686868
'IngressNetworksChangeEvent': {'additionalProperties': False,
6869-
'properties': {'application-token': {'type': 'string'},
6870-
'bakery-version': {'type': 'integer'},
6869+
'properties': {'bakery-version': {'type': 'integer'},
68716870
'ingress-required': {'type': 'boolean'},
68726871
'macaroons': {'items': {'$ref': '#/definitions/Macaroon'},
68736872
'type': 'array'},
68746873
'networks': {'items': {'type': 'string'},
68756874
'type': 'array'},
68766875
'relation-token': {'type': 'string'}},
68776876
'required': ['relation-token',
6878-
'application-token',
68796877
'ingress-required'],
68806878
'type': 'object'},
68816879
'IngressNetworksChanges': {'additionalProperties': False,

juju/client/_definitions.py

Lines changed: 75 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4593,6 +4593,78 @@ def __init__(self, results=None, **unknown_fields):
45934593

45944594

45954595

4596+
class CAASApplicationProvisioningState(Type):
4597+
_toSchema = {'scale_target': 'scale-target', 'scaling': 'scaling'}
4598+
_toPy = {'scale-target': 'scale_target', 'scaling': 'scaling'}
4599+
def __init__(self, scale_target=None, scaling=None, **unknown_fields):
4600+
'''
4601+
scale_target : int
4602+
scaling : bool
4603+
'''
4604+
scale_target_ = scale_target
4605+
scaling_ = scaling
4606+
4607+
# Validate arguments against known Juju API types.
4608+
if scale_target_ is not None and not isinstance(scale_target_, int):
4609+
raise Exception("Expected scale_target_ to be a int, received: {}".format(type(scale_target_)))
4610+
4611+
if scaling_ is not None and not isinstance(scaling_, bool):
4612+
raise Exception("Expected scaling_ to be a bool, received: {}".format(type(scaling_)))
4613+
4614+
self.scale_target = scale_target_
4615+
self.scaling = scaling_
4616+
self.unknown_fields = unknown_fields
4617+
4618+
4619+
4620+
class CAASApplicationProvisioningStateArg(Type):
4621+
_toSchema = {'application': 'application', 'provisioning_state': 'provisioning-state'}
4622+
_toPy = {'application': 'application', 'provisioning-state': 'provisioning_state'}
4623+
def __init__(self, application=None, provisioning_state=None, **unknown_fields):
4624+
'''
4625+
application : Entity
4626+
provisioning_state : CAASApplicationProvisioningState
4627+
'''
4628+
application_ = Entity.from_json(application) if application else None
4629+
provisioning_state_ = CAASApplicationProvisioningState.from_json(provisioning_state) if provisioning_state else None
4630+
4631+
# Validate arguments against known Juju API types.
4632+
if application_ is not None and not isinstance(application_, (dict, Entity)):
4633+
raise Exception("Expected application_ to be a Entity, received: {}".format(type(application_)))
4634+
4635+
if provisioning_state_ is not None and not isinstance(provisioning_state_, (dict, CAASApplicationProvisioningState)):
4636+
raise Exception("Expected provisioning_state_ to be a CAASApplicationProvisioningState, received: {}".format(type(provisioning_state_)))
4637+
4638+
self.application = application_
4639+
self.provisioning_state = provisioning_state_
4640+
self.unknown_fields = unknown_fields
4641+
4642+
4643+
4644+
class CAASApplicationProvisioningStateResult(Type):
4645+
_toSchema = {'error': 'error', 'provisioning_state': 'provisioning-state'}
4646+
_toPy = {'error': 'error', 'provisioning-state': 'provisioning_state'}
4647+
def __init__(self, error=None, provisioning_state=None, **unknown_fields):
4648+
'''
4649+
error : Error
4650+
provisioning_state : CAASApplicationProvisioningState
4651+
'''
4652+
error_ = Error.from_json(error) if error else None
4653+
provisioning_state_ = CAASApplicationProvisioningState.from_json(provisioning_state) if provisioning_state else None
4654+
4655+
# Validate arguments against known Juju API types.
4656+
if error_ is not None and not isinstance(error_, (dict, Error)):
4657+
raise Exception("Expected error_ to be a Error, received: {}".format(type(error_)))
4658+
4659+
if provisioning_state_ is not None and not isinstance(provisioning_state_, (dict, CAASApplicationProvisioningState)):
4660+
raise Exception("Expected provisioning_state_ to be a CAASApplicationProvisioningState, received: {}".format(type(provisioning_state_)))
4661+
4662+
self.error = error_
4663+
self.provisioning_state = provisioning_state_
4664+
self.unknown_fields = unknown_fields
4665+
4666+
4667+
45964668
class CAASUnitInfo(Type):
45974669
_toSchema = {'tag': 'tag', 'unit_status': 'unit-status'}
45984670
_toPy = {'tag': 'tag', 'unit-status': 'unit_status'}
@@ -12310,28 +12382,23 @@ def __init__(self, bundle=None, channel_map=None, charm=None, description=None,
1231012382

1231112383

1231212384
class IngressNetworksChangeEvent(Type):
12313-
_toSchema = {'application_token': 'application-token', 'bakery_version': 'bakery-version', 'ingress_required': 'ingress-required', 'macaroons': 'macaroons', 'networks': 'networks', 'relation_token': 'relation-token'}
12314-
_toPy = {'application-token': 'application_token', 'bakery-version': 'bakery_version', 'ingress-required': 'ingress_required', 'macaroons': 'macaroons', 'networks': 'networks', 'relation-token': 'relation_token'}
12315-
def __init__(self, application_token=None, bakery_version=None, ingress_required=None, macaroons=None, networks=None, relation_token=None, **unknown_fields):
12385+
_toSchema = {'bakery_version': 'bakery-version', 'ingress_required': 'ingress-required', 'macaroons': 'macaroons', 'networks': 'networks', 'relation_token': 'relation-token'}
12386+
_toPy = {'bakery-version': 'bakery_version', 'ingress-required': 'ingress_required', 'macaroons': 'macaroons', 'networks': 'networks', 'relation-token': 'relation_token'}
12387+
def __init__(self, bakery_version=None, ingress_required=None, macaroons=None, networks=None, relation_token=None, **unknown_fields):
1231612388
'''
12317-
application_token : str
1231812389
bakery_version : int
1231912390
ingress_required : bool
1232012391
macaroons : typing.Sequence[~Macaroon]
1232112392
networks : typing.Sequence[str]
1232212393
relation_token : str
1232312394
'''
12324-
application_token_ = application_token
1232512395
bakery_version_ = bakery_version
1232612396
ingress_required_ = ingress_required
1232712397
macaroons_ = [Macaroon.from_json(o) for o in macaroons or []]
1232812398
networks_ = networks
1232912399
relation_token_ = relation_token
1233012400

1233112401
# Validate arguments against known Juju API types.
12332-
if application_token_ is not None and not isinstance(application_token_, (bytes, str)):
12333-
raise Exception("Expected application_token_ to be a str, received: {}".format(type(application_token_)))
12334-
1233512402
if bakery_version_ is not None and not isinstance(bakery_version_, int):
1233612403
raise Exception("Expected bakery_version_ to be a int, received: {}".format(type(bakery_version_)))
1233712404

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

12350-
self.application_token = application_token_
1235112417
self.bakery_version = bakery_version_
1235212418
self.ingress_required = ingress_required_
1235312419
self.macaroons = macaroons_

juju/client/connection.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
'Action': {'versions': [2]},
2121
'ActionPruner': {'versions': [1]},
2222
'Agent': {'versions': [2]},
23+
'AgentLifeFlag': {'versions': [1]},
2324
'AgentTools': {'versions': [1]},
2425
'Annotations': {'versions': [2]},
2526
'Application': {'versions': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]},

0 commit comments

Comments
 (0)