@@ -2996,7 +2996,8 @@ class CAASUnitProvisionerFacade(Type):
29962996 'required': ['units'],
29972997 'type': 'object'},
29982998 'Value': {'additionalProperties': False,
2999- 'properties': {'arch': {'type': 'string'},
2999+ 'properties': {'allocate-public-ip': {'type': 'boolean'},
3000+ 'arch': {'type': 'string'},
30003001 'container': {'type': 'string'},
30013002 'cores': {'type': 'integer'},
30023003 'cpu-power': {'type': 'integer'},
@@ -3391,6 +3392,199 @@ async def WatchPodSpec(self, entities=None):
33913392
33923393
33933394
3395+ class CharmHubFacade(Type):
3396+ name = 'CharmHub'
3397+ version = 1
3398+ schema = {'definitions': {'BundleCharm': {'additionalProperties': False,
3399+ 'properties': {'name': {'type': 'string'},
3400+ 'revision': {'type': 'integer'}},
3401+ 'required': ['name', 'revision'],
3402+ 'type': 'object'},
3403+ 'Channel': {'additionalProperties': False,
3404+ 'properties': {'platforms': {'items': {'$ref': '#/definitions/Platform'},
3405+ 'type': 'array'},
3406+ 'released-at': {'type': 'string'},
3407+ 'revision': {'type': 'integer'},
3408+ 'risk': {'type': 'string'},
3409+ 'size': {'type': 'integer'},
3410+ 'track': {'type': 'string'},
3411+ 'version': {'type': 'string'}},
3412+ 'required': ['released-at',
3413+ 'track',
3414+ 'risk',
3415+ 'revision',
3416+ 'size',
3417+ 'version',
3418+ 'platforms'],
3419+ 'type': 'object'},
3420+ 'CharmHubBundle': {'additionalProperties': False,
3421+ 'properties': {'charms': {'items': {'$ref': '#/definitions/BundleCharm'},
3422+ 'type': 'array'}},
3423+ 'required': ['charms'],
3424+ 'type': 'object'},
3425+ 'CharmHubCharm': {'additionalProperties': False,
3426+ 'properties': {'config': {'patternProperties': {'.*': {'$ref': '#/definitions/CharmOption'}},
3427+ 'type': 'object'},
3428+ 'relations': {'patternProperties': {'.*': {'patternProperties': {'.*': {'type': 'string'}},
3429+ 'type': 'object'}},
3430+ 'type': 'object'},
3431+ 'subordinate': {'type': 'boolean'},
3432+ 'used-by': {'items': {'type': 'string'},
3433+ 'type': 'array'}},
3434+ 'required': ['config',
3435+ 'relations',
3436+ 'subordinate',
3437+ 'used-by'],
3438+ 'type': 'object'},
3439+ 'CharmHubEntityFindResult': {'additionalProperties': False,
3440+ 'properties': {'errors': {'$ref': '#/definitions/ErrorResponse'},
3441+ 'result': {'items': {'$ref': '#/definitions/FindResponse'},
3442+ 'type': 'array'}},
3443+ 'required': ['result', 'errors'],
3444+ 'type': 'object'},
3445+ 'CharmHubEntityInfoResult': {'additionalProperties': False,
3446+ 'properties': {'errors': {'$ref': '#/definitions/ErrorResponse'},
3447+ 'result': {'$ref': '#/definitions/InfoResponse'}},
3448+ 'required': ['result', 'errors'],
3449+ 'type': 'object'},
3450+ 'CharmHubError': {'additionalProperties': False,
3451+ 'properties': {'code': {'type': 'string'},
3452+ 'message': {'type': 'string'}},
3453+ 'required': ['code', 'message'],
3454+ 'type': 'object'},
3455+ 'CharmOption': {'additionalProperties': False,
3456+ 'properties': {'default': {'additionalProperties': True,
3457+ 'type': 'object'},
3458+ 'description': {'type': 'string'},
3459+ 'type': {'type': 'string'}},
3460+ 'required': ['type'],
3461+ 'type': 'object'},
3462+ 'Entity': {'additionalProperties': False,
3463+ 'properties': {'tag': {'type': 'string'}},
3464+ 'required': ['tag'],
3465+ 'type': 'object'},
3466+ 'ErrorResponse': {'additionalProperties': False,
3467+ 'properties': {'error-list': {'$ref': '#/definitions/CharmHubError'}},
3468+ 'required': ['error-list'],
3469+ 'type': 'object'},
3470+ 'FindResponse': {'additionalProperties': False,
3471+ 'properties': {'id': {'type': 'string'},
3472+ 'name': {'type': 'string'},
3473+ 'publisher': {'type': 'string'},
3474+ 'series': {'items': {'type': 'string'},
3475+ 'type': 'array'},
3476+ 'store-url': {'type': 'string'},
3477+ 'summary': {'type': 'string'},
3478+ 'type': {'type': 'string'},
3479+ 'version': {'type': 'string'}},
3480+ 'required': ['type',
3481+ 'id',
3482+ 'name',
3483+ 'publisher',
3484+ 'summary',
3485+ 'version',
3486+ 'series',
3487+ 'store-url'],
3488+ 'type': 'object'},
3489+ 'InfoResponse': {'additionalProperties': False,
3490+ 'properties': {'bundle': {'$ref': '#/definitions/CharmHubBundle'},
3491+ 'channel-map': {'patternProperties': {'.*': {'$ref': '#/definitions/Channel'}},
3492+ 'type': 'object'},
3493+ 'charm': {'$ref': '#/definitions/CharmHubCharm'},
3494+ 'description': {'type': 'string'},
3495+ 'id': {'type': 'string'},
3496+ 'name': {'type': 'string'},
3497+ 'publisher': {'type': 'string'},
3498+ 'series': {'items': {'type': 'string'},
3499+ 'type': 'array'},
3500+ 'store-url': {'type': 'string'},
3501+ 'summary': {'type': 'string'},
3502+ 'tags': {'items': {'type': 'string'},
3503+ 'type': 'array'},
3504+ 'tracks': {'items': {'type': 'string'},
3505+ 'type': 'array'},
3506+ 'type': {'type': 'string'}},
3507+ 'required': ['type',
3508+ 'id',
3509+ 'name',
3510+ 'description',
3511+ 'publisher',
3512+ 'summary',
3513+ 'series',
3514+ 'store-url',
3515+ 'tags',
3516+ 'channel-map',
3517+ 'tracks'],
3518+ 'type': 'object'},
3519+ 'Platform': {'additionalProperties': False,
3520+ 'properties': {'architecture': {'type': 'string'},
3521+ 'os': {'type': 'string'},
3522+ 'series': {'type': 'string'}},
3523+ 'required': ['architecture', 'os', 'series'],
3524+ 'type': 'object'},
3525+ 'Query': {'additionalProperties': False,
3526+ 'properties': {'query': {'type': 'string'}},
3527+ 'required': ['query'],
3528+ 'type': 'object'}},
3529+ 'properties': {'Find': {'description': 'Find queries the CharmHub API with a '
3530+ 'given entity ID.',
3531+ 'properties': {'Params': {'$ref': '#/definitions/Query'},
3532+ 'Result': {'$ref': '#/definitions/CharmHubEntityFindResult'}},
3533+ 'type': 'object'},
3534+ 'Info': {'description': 'Info queries the CharmHub API with a '
3535+ 'given entity ID.',
3536+ 'properties': {'Params': {'$ref': '#/definitions/Entity'},
3537+ 'Result': {'$ref': '#/definitions/CharmHubEntityInfoResult'}},
3538+ 'type': 'object'}},
3539+ 'type': 'object'}
3540+
3541+
3542+ @ReturnMapping(CharmHubEntityFindResult)
3543+ async def Find(self, query=None):
3544+ '''
3545+ Find queries the CharmHub API with a given entity ID.
3546+
3547+ query : str
3548+ Returns -> CharmHubEntityFindResult
3549+ '''
3550+ if query is not None and not isinstance(query, (bytes, str)):
3551+ raise Exception("Expected query to be a str, received: {}".format(type(query)))
3552+
3553+ # map input types to rpc msg
3554+ _params = dict()
3555+ msg = dict(type='CharmHub',
3556+ request='Find',
3557+ version=1,
3558+ params=_params)
3559+ _params['query'] = query
3560+ reply = await self.rpc(msg)
3561+ return reply
3562+
3563+
3564+
3565+ @ReturnMapping(CharmHubEntityInfoResult)
3566+ async def Info(self, tag=None):
3567+ '''
3568+ Info queries the CharmHub API with a given entity ID.
3569+
3570+ tag : str
3571+ Returns -> CharmHubEntityInfoResult
3572+ '''
3573+ if tag is not None and not isinstance(tag, (bytes, str)):
3574+ raise Exception("Expected tag to be a str, received: {}".format(type(tag)))
3575+
3576+ # map input types to rpc msg
3577+ _params = dict()
3578+ msg = dict(type='CharmHub',
3579+ request='Info',
3580+ version=1,
3581+ params=_params)
3582+ _params['tag'] = tag
3583+ reply = await self.rpc(msg)
3584+ return reply
3585+
3586+
3587+
33943588class ClientFacade(Type):
33953589 name = 'Client'
33963590 version = 1
0 commit comments