diff --git a/src/spring/azext_spring/_constant.py b/src/spring/azext_spring/_constant.py new file mode 100644 index 00000000000..a9635e05d97 --- /dev/null +++ b/src/spring/azext_spring/_constant.py @@ -0,0 +1,11 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=wrong-import-order +# pylint: disable=unused-argument, logging-format-interpolation, protected-access, wrong-import-order, too-many-lines + +MARKETPLACE_OFFER_ID = 'azure-spring-cloud-vmware-tanzu-2' +MARKETPLACE_PUBLISHER_ID = 'vmware-inc' +MARKETPLACE_PLAN_ID = 'asa-ent-hr-mtr' diff --git a/src/spring/azext_spring/_validators.py b/src/spring/azext_spring/_validators.py index e2482896f92..151952f2aab 100644 --- a/src/spring/azext_spring/_validators.py +++ b/src/spring/azext_spring/_validators.py @@ -20,6 +20,7 @@ from knack.log import get_logger from ._utils import (ApiType, _get_rg_location, _get_file_type, _get_sku_name) from .vendored_sdks.appplatform.v2020_07_01 import models +from ._constant import (MARKETPLACE_OFFER_ID, MARKETPLACE_PLAN_ID, MARKETPLACE_PUBLISHER_ID) logger = get_logger(__name__) @@ -70,14 +71,16 @@ def _validate_terms(cmd, namespace): from azure.cli.core.commands.client_factory import get_mgmt_service_client client = get_mgmt_service_client(cmd.cli_ctx, MarketplaceOrderingAgreements).marketplace_agreements term = client.get(offer_type="virtualmachine", - publisher_id='vmware-inc', - offer_id='azure-spring-cloud-vmware-tanzu-2', - plan_id='tanzu-asc-ent-mtr') + publisher_id=MARKETPLACE_PUBLISHER_ID, + offer_id=MARKETPLACE_OFFER_ID, + plan_id=MARKETPLACE_PLAN_ID) if not term.accepted: raise InvalidArgumentValueError('Terms for Azure Spring Apps Enterprise is not accepted.\n' - 'Run "az term accept --publisher vmware-inc ' - '--product azure-spring-cloud-vmware-tanzu-2 ' - '--plan tanzu-asc-ent-mtr" to accept the term.') + 'Run "az term accept --publisher {} ' + '--product {} ' + '--plan {}" to accept the term.'.format(MARKETPLACE_PUBLISHER_ID, + MARKETPLACE_OFFER_ID, + MARKETPLACE_PLAN_ID)) def _check_tanzu_components_not_enable(cmd, namespace):