Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/spring/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ Release History
---
* Command `az spring create` has new argument "--ingress-read-timeout" to set ingress read timeout when create Azure Spring Apps.
* Command `az spring update` has new argument "--ingress-read-timeout" to update ingress read timeout for Azure Spring Apps.
* Command `az spring create` has new argument "--marketplace-plan-id" to purchase SaaS resource against given plan for Azure Spring Apps.
* Command `az spring create` and `az spring update` has new argument "--enable-log-stream-public-endpoint" to set whether assign public endpoint for log streaming in vnet injection instance.
* Command `az spring app create` and `az spring app update` has new argument "--assign_public_endpoint" to set whether assign endpoint URL which could be accessed out of virtual network for vnet injection instance app.
* Command `az spring app create` and `az spring app update` has new argument "--assign-public-endpoint" to set whether assign endpoint URL which could be accessed out of virtual network for vnet injection instance app.
* Command `az spring app deploy` and `az spring app deployment create` has new argument "--build-cpu" and "--build-memory" to set cpu and memory during build process.
* Commands `az spring app create`, `az spring app update`, `az spring app deploy`, `spring app deployment create`
and `spring app deployment update` have new arguments "--enable-liveness-probe", "--enable-readiness-probe", "--enable-startup-probe", "--liveness-probe-config", "--readiness-probe-config", "--startup-probe-config" to customize the probe settings of user applications
Expand Down
11 changes: 0 additions & 11 deletions src/spring/azext_spring/_constant.py

This file was deleted.

8 changes: 0 additions & 8 deletions src/spring/azext_spring/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@
az spring create -n MyService -g MyResourceGroup --sku Enterprise --enable-application-configuration-service --enable-service-registry --enable-gateway --enable-api-portal
"""

helps['spring list-marketplace-plan'] = """
type: command
short-summary: (Enterprise Tier Only) List Marketplace plan to be purchased.
examples:
- name: List all plans.
text: az spring list-marketplace-plan -o table
"""

helps['spring update'] = """
type: command
short-summary: Update an Azure Spring Apps.
Expand Down
38 changes: 0 additions & 38 deletions src/spring/azext_spring/_marketplace.py

This file was deleted.

4 changes: 0 additions & 4 deletions src/spring/azext_spring/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,6 @@ def load_arguments(self, _):
is_preview=True,
options_list=['--api-portal-instance-count', '--ap-instance'],
help='(Enterprise Tier Only) Number of API portal instances.')
c.argument('marketplace_plan_id',
is_preview=True,
help='(Enterprise Tier Only) Specify a different Marketplace plan to purchase with Spring instance. '
'List all plans by running `az spring list-marketplace-plan -o table`.')

with self.argument_context('spring update') as c:
c.argument('sku', arg_type=sku_type, validator=normalize_sku)
Expand Down
22 changes: 6 additions & 16 deletions src/spring/azext_spring/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
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__)

Expand Down Expand Up @@ -48,7 +47,6 @@ def validate_sku(cmd, namespace):
_validate_saas_provider(cmd, namespace)
_validate_terms(cmd, namespace)
else:
_check_saas_not_set(cmd, namespace)
_check_tanzu_components_not_enable(cmd, namespace)
normalize_sku(cmd, namespace)

Expand All @@ -58,11 +56,6 @@ def normalize_sku(cmd, namespace):
namespace.sku = models.Sku(name=_get_sku_name(namespace.sku), tier=namespace.sku)


def _check_saas_not_set(cmd, namespace):
if namespace.marketplace_plan_id:
raise InvalidArgumentValueError('--marketplace-plan-id is supported only when --sku=Enterprise')


def _validate_saas_provider(cmd, namespace):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azure.cli.core.profiles import ResourceType
Expand All @@ -76,18 +69,15 @@ def _validate_terms(cmd, namespace):
from azure.mgmt.marketplaceordering import MarketplaceOrderingAgreements
from azure.cli.core.commands.client_factory import get_mgmt_service_client
client = get_mgmt_service_client(cmd.cli_ctx, MarketplaceOrderingAgreements).marketplace_agreements
plan_id = namespace.marketplace_plan_id or MARKETPLACE_PLAN_ID
term = client.get(offer_type="virtualmachine",
publisher_id=MARKETPLACE_PUBLISHER_ID,
offer_id=MARKETPLACE_OFFER_ID,
plan_id=plan_id)
publisher_id='vmware-inc',
offer_id='azure-spring-cloud-vmware-tanzu-2',
plan_id='tanzu-asc-ent-mtr')
if not term.accepted:
raise InvalidArgumentValueError('Terms for Azure Spring Apps Enterprise is not accepted.\n'
'Run "az term accept --publisher {} '
'--product {} '
'--plan {}" to accept the term.'.format(MARKETPLACE_PUBLISHER_ID,
MARKETPLACE_OFFER_ID,
plan_id))
'Run "az term accept --publisher vmware-inc '
'--product azure-spring-cloud-vmware-tanzu-2 '
'--plan tanzu-asc-ent-mtr" to accept the term.')


def _check_tanzu_components_not_enable(cmd, namespace):
Expand Down
4 changes: 0 additions & 4 deletions src/spring/azext_spring/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
transform_service_registry_output,
transform_spring_cloud_gateway_output,
transform_api_portal_output)
from ._marketplace import (transform_marketplace_plan_output)
from ._validators_enterprise import (validate_gateway_update, validate_api_portal_update)
from ._app_managed_identity_validator import (validate_app_identity_remove_or_warning,
validate_app_identity_assign_or_warning)
Expand Down Expand Up @@ -92,9 +91,6 @@ def load_command_table(self, _):
with self.command_group('spring', custom_command_type=spring_routing_util,
exception_handler=handle_asc_exception) as g:
g.custom_command('create', 'spring_create', supports_no_wait=True)
g.custom_command('list-marketplace-plan', 'spring_list_marketplace_plan',
is_preview=True,
table_transformer=transform_marketplace_plan_output)

with self.command_group('spring', client_factory=cf_spring_20220501preview,
exception_handler=handle_asc_exception) as g:
Expand Down
16 changes: 0 additions & 16 deletions src/spring/azext_spring/spring_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

from ._validators import (_parse_sku_name)
from knack.log import get_logger
from ._marketplace import _spring_list_marketplace_plan
from ._constant import (MARKETPLACE_OFFER_ID, MARKETPLACE_PUBLISHER_ID)

logger = get_logger(__name__)

Expand Down Expand Up @@ -59,7 +57,6 @@ def create_service(self,
sku=None,
tags=None,
ingress_read_timeout=None,
marketplace_plan_id=None,
**_):
properties = models.ClusterResourceProperties(
zone_redundant=zone_redundant
Expand All @@ -72,13 +69,6 @@ def create_service(self,
else:
properties.vnet_addons = None

if marketplace_plan_id:
properties.marketplace_resource = models.MarketplaceResource(
plan=marketplace_plan_id,
product=MARKETPLACE_OFFER_ID,
publisher=MARKETPLACE_PUBLISHER_ID
)

if service_runtime_subnet or app_subnet or reserved_cidr_range:
properties.network_profile = models.NetworkProfile(
service_runtime_subnet_id=service_runtime_subnet,
Expand Down Expand Up @@ -154,7 +144,6 @@ def spring_create(cmd, client, resource_group, name,
api_portal_instance_count=None,
enable_log_stream_public_endpoint=None,
ingress_read_timeout=None,
marketplace_plan_id=None,
no_wait=False):
"""
Because Standard/Basic tier vs. Enterprise tier creation are very different. Here routes the command to different
Expand Down Expand Up @@ -184,7 +173,6 @@ def spring_create(cmd, client, resource_group, name,
'enable_api_portal': enable_api_portal,
'api_portal_instance_count': api_portal_instance_count,
'enable_log_stream_public_endpoint': enable_log_stream_public_endpoint,
'marketplace_plan_id': marketplace_plan_id,
'no_wait': no_wait
}

Expand All @@ -200,7 +188,3 @@ def _enable_app_insights(cmd, client, resource_group, name, location, app_insigh
return create_default_buildpack_binding_for_application_insights(cmd, client, resource_group, name,
location, app_insights_key, app_insights,
sampling_rate)


def spring_list_marketplace_plan(cmd, client):
return _spring_list_marketplace_plan(cmd, client)
11 changes: 0 additions & 11 deletions src/spring/azext_spring/tests/latest/test_asa_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,6 @@ def test_asc_create_enterprise(self):
self.assertEqual('E0', resource.sku.name)
self.assertEqual('Enterprise', resource.sku.tier)
self.assertEqual(False, resource.properties.zone_redundant)
self.assertIsNone(resource.properties.marketplace_resource)

def test_asc_create_enterprise_with_plan(self):
self._execute('rg', 'asc', sku=self._get_sku('Enterprise'), disable_app_insights=True, marketplace_plan_id='my-plan')
resource = self.created_resource
self.assertEqual('E0', resource.sku.name)
self.assertEqual('Enterprise', resource.sku.tier)
self.assertEqual(False, resource.properties.zone_redundant)
self.assertEqual('my-plan', resource.properties.marketplace_resource.plan)
self.assertEqual('azure-spring-cloud-vmware-tanzu-2', resource.properties.marketplace_resource.product)
self.assertEqual('vmware-inc', resource.properties.marketplace_resource.publisher)


class TestSpringCloudCreateWithAI(BasicTest):
Expand Down
6 changes: 3 additions & 3 deletions src/spring/azext_spring/tests/latest/test_asa_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,20 +308,20 @@ def _mock_not_registered_client(cli_ctx, client_type, **kwargs):
class TestSkuValidator(unittest.TestCase):
@mock.patch('azure.cli.core.commands.client_factory.get_mgmt_service_client', _mock_happy_client)
def test_happy_path(self):
ns = Namespace(sku='Enterprise', marketplace_plan_id=None)
ns = Namespace(sku='Enterprise')
validate_sku(_get_test_cmd(), ns)
self.assertEqual('Enterprise', ns.sku.tier)

@mock.patch('azure.cli.core.commands.client_factory.get_mgmt_service_client', _mock_not_accepted_term_client)
def test_term_not_accept(self):
ns = Namespace(sku='Enterprise', marketplace_plan_id=None)
ns = Namespace(sku='Enterprise')
with self.assertRaises(InvalidArgumentValueError) as context:
validate_sku(_get_test_cmd(), ns)
self.assertTrue('Terms for Azure Spring Apps Enterprise is not accepted.' in str(context.exception))

@mock.patch('azure.cli.core.commands.client_factory.get_mgmt_service_client', _mock_not_registered_client)
def test_provider_not_registered(self):
ns = Namespace(sku='Enterprise', marketplace_plan_id=None)
ns = Namespace(sku='Enterprise')
with self.assertRaises(InvalidArgumentValueError) as context:
validate_sku(_get_test_cmd(), ns)
self.assertTrue('Microsoft.SaaS resource provider is not registered.' in str(context.exception))
Expand Down
16 changes: 0 additions & 16 deletions src/spring/azext_spring/vendored_sdks/marketplace/__init__.py

This file was deleted.

This file was deleted.

Loading