in marketplace/deployer_util/config_helper.py [0:0]
def __init__(self, dictionary):
self._app_api_version = None
self._published_version = None
self._published_version_meta = None
self._partner_id = None
self._solution_id = None
self._images = None
self._cluster_constraints = None
self._deployer_service_account = None
self._schema_version = dictionary.get('schemaVersion', _SCHEMA_VERSION_1)
if self._schema_version not in _SCHEMA_VERSIONS:
raise InvalidSchema('Invalid schema version {}'.format(
self._schema_version))
self._partner_id = dictionary.get('partnerId', None)
self._solution_id = dictionary.get('solutionId', None)
if self._partner_id or self._solution_id:
if not self._partner_id or not self._solution_id:
raise InvalidSchema(
'x-google-marketplace.partnerId and x-google-marketplace.solutionId'
' must be specified or missing together')
if 'clusterConstraints' in dictionary:
self._cluster_constraints = SchemaClusterConstraints(
dictionary['clusterConstraints'])
if not self.is_v2():
return
self._app_api_version = _must_get(
dictionary, 'applicationApiVersion',
'x-google-marketplace.applicationApiVersion is required')
self._published_version = _must_get(
dictionary, 'publishedVersion',
'x-google-marketplace.publishedVersion is required')
if not SEMVER_RE.match(self._published_version):
raise InvalidSchema(
'Invalid schema publishedVersion "{}"; must be semver including patch version'
.format(self._published_version))
self._published_version_meta = _must_get_and_apply(
dictionary, 'publishedVersionMetadata', lambda v: SchemaVersionMeta(v),
'x-google-marketplace.publishedVersionMetadata is required')
self._managed_updates = SchemaManagedUpdates(
dictionary.get('managedUpdates', {}))
images = _must_get(dictionary, 'images',
'x-google-marketplace.images is required')
self._images = {k: SchemaImage(k, v) for k, v in images.items()}
if 'deployerServiceAccount' in dictionary:
self._deployer_service_account = SchemaXServiceAccount(
dictionary['deployerServiceAccount'])