From dd893875d2946439695935633a75b88c3157b251 Mon Sep 17 00:00:00 2001 From: Pan Li Date: Fri, 7 Jan 2022 10:22:11 +0800 Subject: [PATCH 01/19] [Spring-Cloud] Add buildpack-binding command for Enterprise tier. * Add create, show, set, delete and list for buildpack-binding. * Add enable app insights when create Enterprise tier. Signed-off-by: Pan Li --- src/spring-cloud/azext_spring_cloud/_help.py | 51 ++++++ .../azext_spring_cloud/_params.py | 58 +++++- .../_validators_enterprise.py | 51 +++++- .../azext_spring_cloud/buildpack_binding.py | 172 ++++++++++++++++++ .../azext_spring_cloud/commands.py | 14 ++ .../spring_cloud_instance.py | 12 ++ 6 files changed, 356 insertions(+), 2 deletions(-) create mode 100644 src/spring-cloud/azext_spring_cloud/buildpack_binding.py diff --git a/src/spring-cloud/azext_spring_cloud/_help.py b/src/spring-cloud/azext_spring_cloud/_help.py index ee8e057f877..7f65f646d48 100644 --- a/src/spring-cloud/azext_spring_cloud/_help.py +++ b/src/spring-cloud/azext_spring_cloud/_help.py @@ -607,3 +607,54 @@ - name: Unbind an app from Service Registry. text: az spring-cloud service-registry unbind --app MyApp -s MyService -g MyResourceGroup """ + +helps['spring-cloud build-service buildpacks-binding'] = """ + type: group + short-summary: (Enterprise Tier Only) Commands to manage buildpack Binding +""" + +helps['spring-cloud build-service builder buildpack-binding create'] = """ + type: command + short-summary: Create a buildpack binding. + examples: + - name: Create a buildpack binding without properties or secrets. + text: az spring-cloud build-service builder buildpack-binding create --name first-binding --builder-name first-builder --type ApplicationInsights + - name: Create a buildpack binding with only secrets. + text: az spring-cloud build-service builder buildpack-binding create --name first-binding --builder-name first-builder --type ApplicationInsights --secrets k1=v1 k2=v2 + - name: Create a buildpack binding with only properties. + text: az spring-cloud build-service builder buildpack-binding create --name first-binding --builder-name first-builder --type ApplicationInsights --properties a=b c=d + - name: Create a buildpack binding with properties and secrets. + text: az spring-cloud build-service builder buildpack-binding create --name first-binding --builder-name first-builder --type ApplicationInsights --properties a=b c=d --secrets k1=v1 k2=v2 +""" + +helps['spring-cloud build-service builder buildpack-binding set'] = """ + type: command + short-summary: Set a buildpack binding. + examples: + - name: Set a buildpack binding with properties and secrets. + text: az spring-cloud build-service builder buildpack-binding set --name first-binding --builder-name first-builder --type ApplicationInsights --properties a=b c=d --secrets k1=v1 k2=v2 +""" + +helps['spring-cloud build-service builder buildpack-binding show'] = """ + type: command + short-summary: Show a buildpack binding. The secrets will be masked. + examples: + - name: Show a buildpack binding. + text: az spring-cloud build-service builder buildpack-binding show --name first-binding --builder-name first-builder +""" + +helps['spring-cloud build-service builder buildpack-binding list'] = """ + type: command + short-summary: List all buildpack binding in a builder. The secrets will be masked. + examples: + - name: Show a buildpack binding. + text: az spring-cloud build-service builder buildpack-binding list --builder-name first-builder +""" + +helps['spring-cloud build-service builder buildpack-binding delete'] = """ + type: command + short-summary: Delete a buildpack binding. + examples: + - name: Delete a buildpack binding. + text: az spring-cloud build-service builder buildpack-binding delete --name first-binding --builder-name first-builder +""" \ No newline at end of file diff --git a/src/spring-cloud/azext_spring_cloud/_params.py b/src/spring-cloud/azext_spring_cloud/_params.py index 733e0942250..29868a0770d 100644 --- a/src/spring-cloud/azext_spring_cloud/_params.py +++ b/src/spring-cloud/azext_spring_cloud/_params.py @@ -14,13 +14,16 @@ validate_tracing_parameters_asc_create, validate_tracing_parameters_asc_update, validate_app_insights_parameters, validate_instance_count, validate_java_agent_parameters, validate_jar) -from ._validators_enterprise import only_support_enterprise +from ._validators_enterprise import (only_support_enterprise, validate_buildpack_binding_exist, validate_buildpack_binding_not_exist, + validate_buildpack_binding_properties, validate_buildpack_binding_secrets) from ._app_validator import (fulfill_deployment_param, active_deployment_exist, active_deployment_exist_under_app, ensure_not_active_deployment, validate_deloy_path, validate_deloyment_create_path, validate_cpu, validate_memory) from ._utils import ApiType from .vendored_sdks.appplatform.v2020_07_01.models import RuntimeVersion, TestKeyType +from .vendored_sdks.appplatform.v2022_01_01_preview.models \ + import _app_platform_management_client_enums as v20220101_preview_AppPlatformEnums name_type = CLIArgumentType(options_list=[ '--name', '-n'], help='The primary resource name', validator=validate_name) @@ -426,3 +429,56 @@ def prepare_logs_argument(c): with self.argument_context('spring-cloud service-registry unbind') as c: c.argument('app', app_name_type, help='Name of app.', validator=validate_app_name) + + + for scope in ['spring-cloud build-service builder buildpack-binding create']: + with self.argument_context(scope) as c: + c.argument('type', + arg_type=get_enum_type(v20220101_preview_AppPlatformEnums.BindingType), + help='Required type for buildpack binding.') + c.argument('properties', + help='Non-sensitive properties for launchProperties. Format "key[=value]".', + nargs='*', + validator=validate_buildpack_binding_properties) + c.argument('secrets', + help='Sensitive properties for launchProperties. ' + 'Once put, it will be encrypted and never return to user. ' + 'Format "key[=value]".', + nargs='*', + validator=validate_buildpack_binding_secrets) + c.argument('name', help='Name for buildpack binding.', validator=validate_buildpack_binding_not_exist) + c.argument('builder_name', help='The name for builder.', default="default") + c.argument('service', service_name_type, validator=only_support_enterprise) + + + for scope in ['spring-cloud build-service builder buildpack-binding set']: + with self.argument_context(scope) as c: + c.argument('type', + arg_type=get_enum_type(v20220101_preview_AppPlatformEnums.BindingType), + help='Required type for buildpack binding.') + c.argument('properties', + help='Non-sensitive properties for launchProperties. Format "key[=value]".', + nargs='*', + validator=validate_buildpack_binding_properties) + c.argument('secrets', + help='Sensitive properties for launchProperties. ' + 'Once put, it will be encrypted and never return to user. ' + 'Format "key[=value]".', + nargs='*', + validator=validate_buildpack_binding_secrets) + c.argument('name', help='Name for buildpack binding.', validator=validate_buildpack_binding_exist) + c.argument('builder_name', help='The name for builder.', default="default") + c.argument('service', service_name_type, validator=only_support_enterprise) + + + for scope in ['spring-cloud build-service builder buildpack-binding show', + 'spring-cloud build-service builder buildpack-binding delete']: + with self.argument_context(scope) as c: + c.argument('name', help='Name for buildpack binding.', validator=validate_buildpack_binding_exist) + c.argument('builder_name', help='The name for builder.', default="default") + c.argument('service', service_name_type, validator=only_support_enterprise) + + for scope in ['spring-cloud build-service builder buildpack-binding list']: + with self.argument_context(scope) as c: + c.argument('builder_name', help='The name for builder.', default="default") + c.argument('service', service_name_type, validator=only_support_enterprise) \ No newline at end of file diff --git a/src/spring-cloud/azext_spring_cloud/_validators_enterprise.py b/src/spring-cloud/azext_spring_cloud/_validators_enterprise.py index b7d37af2b6b..0b0a2459164 100644 --- a/src/spring-cloud/azext_spring_cloud/_validators_enterprise.py +++ b/src/spring-cloud/azext_spring_cloud/_validators_enterprise.py @@ -6,7 +6,13 @@ # pylint: disable=too-few-public-methods, unused-argument, redefined-builtin from azure.cli.core.azclierror import ClientRequestError -from ._util_enterprise import is_enterprise_tier +from azure.cli.core.util import CLIError +from azure.cli.core.commands.validators import validate_tag +from azure.core.exceptions import ResourceNotFoundError +from .buildpack_binding import (DEFAULT_BUILD_SERVICE_NAME) +from ._util_enterprise import ( + is_enterprise_tier, get_client +) def only_support_enterprise(cmd, namespace): @@ -17,3 +23,46 @@ def only_support_enterprise(cmd, namespace): def not_support_enterprise(cmd, namespace): if namespace.resource_group and namespace.service and is_enterprise_tier(cmd, namespace.resource_group, namespace.service): raise ClientRequestError("'{}' doesn't support for Enterprise tier Spring instance.".format(namespace.command)) + +def validate_buildpack_binding_properties(namespace): + """ Extracts multiple space-separated properties in key[=value] format """ + if isinstance(namespace.properties, list): + properties_dict = {} + for item in namespace.properties: + properties_dict.update(validate_tag(item)) + namespace.properties = properties_dict + + +def validate_buildpack_binding_secrets(namespace): + """ Extracts multiple space-separated secrets in key[=value] format """ + if isinstance(namespace.secrets, list): + secrets_dict = {} + for item in namespace.secrets: + secrets_dict.update(validate_tag(item)) + namespace.secrets = secrets_dict + + +def validate_buildpack_binding_not_exist(cmd, namespace): + client = get_client(cmd) + try: + binding_resource = client.buildpack_binding.get(namespace.resource_group, + namespace.service, + DEFAULT_BUILD_SERVICE_NAME, + namespace.builder_name, + namespace.name) + if binding_resource is not None: + raise CLIError('buildpack Binding {} in builder {} already exists ' + 'in resource group {}, service {}. You can edit it by set command.' + .format(namespace.name, namespace.resource_group, namespace.service, namespace.builder_name)) + except ResourceNotFoundError: + # Excepted case + pass + +def validate_buildpack_binding_exist(cmd, namespace): + client = get_client(cmd) + # If not exists exception will be raised + client.buildpack_binding.get(namespace.resource_group, + namespace.service, + DEFAULT_BUILD_SERVICE_NAME, + namespace.builder_name, + namespace.name) \ No newline at end of file diff --git a/src/spring-cloud/azext_spring_cloud/buildpack_binding.py b/src/spring-cloud/azext_spring_cloud/buildpack_binding.py new file mode 100644 index 00000000000..c55802f4f41 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/buildpack_binding.py @@ -0,0 +1,172 @@ +# -------------------------------------------------------------------------------------------- +# 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 +from .vendored_sdks.appplatform.v2022_01_01_preview import models +from azure.cli.core.util import sdk_no_wait +from ._utils import get_portal_uri +from msrestazure.tools import parse_resource_id, is_valid_resource_id +from azure.cli.core.commands.client_factory import get_mgmt_service_client +from azure.cli.core.azclierror import InvalidArgumentValueError +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.core.exceptions import ResourceNotFoundError +from knack.log import get_logger + +logger = get_logger(__name__) + +DEFAULT_BUILDER_NAME = "default" +DEFAULT_BINDING_NAME = "default" +DEFAULT_BUILD_SERVICE_NAME = "default" + + +def create_or_update_buildpack_binding(cmd, client, resource_group, service, + name, type, builder_name=None, properties=None, secrets=None): + if not builder_name: + builder_name = DEFAULT_BUILDER_NAME + logger.warning('Option --builder-name is not provided, will use default builder name "{}".'.format(builder_name)) + + logger.warning('[1/1] Creating or updating to buildpack binding for builder "{}", (this operation can take a while to complete).'.format(builder_name)) + + binding_resource = _build_buildpack_binding_resource(type, properties, secrets) + return sdk_no_wait(False, client.buildpack_binding.begin_create_or_update, resource_group, + service, DEFAULT_BUILD_SERVICE_NAME, builder_name, name, binding_resource) + + +def buildpack_binding_show(cmd, client, resource_group, service, name, builder_name=None): + if not builder_name: + builder_name = DEFAULT_BUILDER_NAME + logger.warning('Option --builder-name is not provided, will use default builder name "{}".'.format(builder_name)) + + return client.buildpack_binding.get(resource_group, service, DEFAULT_BUILD_SERVICE_NAME, + builder_name, name) + + +def buildpack_binding_list(cmd, client, resource_group, service, builder_name=None): + if not builder_name: + builder_name = DEFAULT_BUILDER_NAME + logger.warning('Option --builder-name is not provided, will use default builder name "{}".'.format(builder_name)) + + return client.buildpack_binding.list(resource_group, service, DEFAULT_BUILD_SERVICE_NAME, builder_name) + + +def buildpack_binding_delete(cmd, client, resource_group, service, name, builder_name=None): + if not builder_name: + builder_name = DEFAULT_BUILDER_NAME + logger.warning('Option --builder-name is not provided, will use default builder name "{}".'.format(builder_name)) + + logger.warning('[1/1] Deleting buildpack binding for builder "{}", (this operation can take a while to complete).'.format(builder_name)) + + return sdk_no_wait(False, client.buildpack_binding.begin_delete, resource_group, + service, DEFAULT_BUILD_SERVICE_NAME, builder_name, name) + + +def create_default_buildpack_binding_for_application_insights(cmd, client, resource_group, name, location, + app_insights_key, app_insights, sampling_rate): + logger.warning("Start configure Application Insights") + binding_resource = models.BuildpackBindingResource() + binding_resource.properties = _get_buildpack_binding_properties(cmd, resource_group, name, location, app_insights_key, app_insights, sampling_rate) + + if binding_resource.properties: + return client.buildpack_binding.begin_create_or_update(resource_group, name, DEFAULT_BUILD_SERVICE_NAME, + DEFAULT_BUILDER_NAME, DEFAULT_BINDING_NAME, binding_resource) + +def _build_buildpack_binding_resource(binding_type, properties_dict, secrets_dict): + launch_properties = models.BuildpackBindingLaunchProperties(properties=properties_dict, + secrets=secrets_dict) + binding_properties = models.BuildpackBindingProperties(binding_type=binding_type, + launch_properties=launch_properties) + return models.BuildpackBindingResource(properties=binding_properties) + + +def _get_buildpack_binding_properties(cmd, resource_group, service_name, location, + app_insights_key, app_insights, sampling_rate): + + sampling_rate = sampling_rate or 10 + connection_string = app_insights_key or \ + _get_connection_string_from_app_insights(cmd, resource_group, app_insights) or \ + _create_app_insights_and_get_connection_string(cmd, resource_group, service_name, location) + + if not connection_string: + raise InvalidArgumentValueError('Error while trying to get the ConnectionString of Application Insights for the Azure Spring Cloud. ' + 'Please use the Azure Portal to create and configure the Application Insights, if needed.') + + launch_properties = models.BuildpackBindingLaunchProperties(properties={ + "connection-string": connection_string, + "sampling-percentage": sampling_rate, + }) + + return models.BuildpackBindingProperties(binding_type="ApplicationInsights", launch_properties=launch_properties) + +def _create_app_insights_and_get_connection_string(cmd, resource_group, service_name, location): + try: + created_app_insights = _try_create_application_insights(cmd, resource_group, service_name, location) + if created_app_insights: + return created_app_insights.connection_string + except Exception: # pylint: disable=broad-except + logger.warning( + 'Error while trying to create and configure an Application Insights for the Azure Spring Cloud. ' + 'Please use the Azure Portal to create and configure the Application Insights, if needed.') + return None + +def _get_connection_string_from_app_insights(cmd, resource_group, app_insights): + """Get connection string from: + 1) application insights name + 2) application insights resource id + """ + + if not app_insights: + return None + + if is_valid_resource_id(app_insights): + resource_id_dict = parse_resource_id(app_insights) + connection_string = _get_app_insights_connection_string( + cmd.cli_ctx, resource_id_dict['resource_group'], resource_id_dict['resource_name']) + else: + connection_string = _get_app_insights_connection_string(cmd.cli_ctx, resource_group, app_insights) + + if not connection_string: + logger.warning( + "Cannot find Connection string from application insights:{}".format(app_insights)) + + return connection_string + +def _get_app_insights_connection_string(cli_ctx, resource_group, name): + appinsights_client = get_mgmt_service_client(cli_ctx, ApplicationInsightsManagementClient) + appinsights = appinsights_client.components.get(resource_group, name) + if not appinsights or not appinsights.connection_string: + raise ResourceNotFoundError("App Insights {} under resource group {} was not found." + .format(name, resource_group)) + return appinsights.connection_string + +def _try_create_application_insights(cmd, resource_group, name, location): + creation_failed_warn = 'Unable to create the Application Insights for the Azure Spring Cloud. ' \ + 'Please use the Azure Portal to manually create and configure the Application Insights, ' \ + 'if needed.' + + ai_resource_group_name = resource_group + ai_name = name + ai_location = location + + app_insights_client = get_mgmt_service_client(cmd.cli_ctx, ApplicationInsightsManagementClient) + ai_properties = { + "name": ai_name, + "location": ai_location, + "kind": "web", + "properties": { + "Application_Type": "web" + } + } + appinsights = app_insights_client.components.create_or_update(ai_resource_group_name, ai_name, ai_properties) + if not appinsights or not appinsights.connection_string: + logger.warning(creation_failed_warn) + return None + + portal_url = get_portal_uri(cmd.cli_ctx) + # We make this success message as a warning to no interfere with regular JSON output in stdout + logger.warning('Application Insights \"%s\" was created for this Azure Spring Cloud. ' + 'You can visit %s/#resource%s/overview to view your ' + 'Application Insights component', appinsights.name, portal_url, appinsights.id) + + return appinsights \ No newline at end of file diff --git a/src/spring-cloud/azext_spring_cloud/commands.py b/src/spring-cloud/azext_spring_cloud/commands.py index 9608643d05b..ff199dbd0cd 100644 --- a/src/spring-cloud/azext_spring_cloud/commands.py +++ b/src/spring-cloud/azext_spring_cloud/commands.py @@ -35,6 +35,11 @@ def load_command_table(self, _): client_factory=cf_spring_cloud_20220101preview ) + buildpack_binding_cmd_group = CliCommandType( + operations_tmpl="azext_spring_cloud.buildpack_binding#{}", + client_factory=cf_spring_cloud_20220101preview + ) + with self.command_group('spring-cloud', custom_command_type=spring_cloud_routing_util, exception_handler=handle_asc_exception) as g: g.custom_command('create', 'spring_cloud_create', supports_no_wait=True) @@ -174,3 +179,12 @@ def load_command_table(self, _): with self.command_group('spring-cloud', exception_handler=handle_asc_exception): pass + + with self.command_group('spring-cloud build-service builder buildpack-binding', + custom_command_type=buildpack_binding_cmd_group, + exception_handler=handle_asc_exception, is_preview=True) as g: + g.custom_command('create', 'create_or_update_buildpack_binding') + g.custom_command('set', 'create_or_update_buildpack_binding') + g.custom_command('show', 'buildpack_binding_show') + g.custom_command('list', 'buildpack_binding_list') + g.custom_command('delete', 'buildpack_binding_delete') diff --git a/src/spring-cloud/azext_spring_cloud/spring_cloud_instance.py b/src/spring-cloud/azext_spring_cloud/spring_cloud_instance.py index 10a067b5d92..a0aed9dd5ba 100644 --- a/src/spring-cloud/azext_spring_cloud/spring_cloud_instance.py +++ b/src/spring-cloud/azext_spring_cloud/spring_cloud_instance.py @@ -9,6 +9,7 @@ from .vendored_sdks.appplatform.v2022_01_01_preview import models from knack.log import get_logger from .custom import (_warn_enable_java_agent, _update_application_insights_asc_create) +from .buildpack_binding import create_default_buildpack_binding_for_application_insights from ._validators import (_parse_sku_name) from knack.log import get_logger @@ -78,6 +79,7 @@ def before_create(self, **_): def after_create(self, no_wait=None, **kwargs): pollers = [ # create sub components like Service registry, ACS, build service, etc. + _enable_app_insights(self.cmd, self.client, self.resource_group, self.name, self.location, **kwargs) ] pollers = [x for x in pollers if x] if not no_wait: @@ -131,3 +133,13 @@ def spring_cloud_create(cmd, client, resource_group, name, spring_cloud_factory = _get_factory(cmd, client, resource_group, name, location=location, sku=sku) return spring_cloud_factory.create(**kwargs) + + +def _enable_app_insights(cmd, client, resource_group, name, location, app_insights_key, app_insights, + sampling_rate, disable_app_insights, **_): + if disable_app_insights: + return + + return create_default_buildpack_binding_for_application_insights(cmd, client, resource_group, name, + location, app_insights_key, app_insights, + sampling_rate) \ No newline at end of file From e384b9b19f7cfe75bcc5a9109fa5e11954aed91f Mon Sep 17 00:00:00 2001 From: Pan Li Date: Fri, 7 Jan 2022 11:00:54 +0800 Subject: [PATCH 02/19] Minor change. Signed-off-by: Pan Li --- src/spring-cloud/azext_spring_cloud/_params.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/spring-cloud/azext_spring_cloud/_params.py b/src/spring-cloud/azext_spring_cloud/_params.py index bd708f868b4..2dc94700d57 100644 --- a/src/spring-cloud/azext_spring_cloud/_params.py +++ b/src/spring-cloud/azext_spring_cloud/_params.py @@ -429,8 +429,7 @@ def prepare_logs_argument(c): with self.argument_context('spring-cloud service-registry bind') as c: c.argument('app', app_name_type, help='Name of app.', validator=validate_app_name) - with self.argument_context(' - unbind') as c: + with self.argument_context('spring-cloud service-registry unbind') as c: c.argument('app', app_name_type, help='Name of app.', validator=validate_app_name) for scope in ['bind', 'unbind']: From b18fecc49faf0c7124aa182a414155be01bfaf55 Mon Sep 17 00:00:00 2001 From: Pan Li Date: Fri, 7 Jan 2022 11:04:38 +0800 Subject: [PATCH 03/19] format. Signed-off-by: Pan Li --- src/spring-cloud/azext_spring_cloud/spring_cloud_instance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spring-cloud/azext_spring_cloud/spring_cloud_instance.py b/src/spring-cloud/azext_spring_cloud/spring_cloud_instance.py index a0aed9dd5ba..aa54338df01 100644 --- a/src/spring-cloud/azext_spring_cloud/spring_cloud_instance.py +++ b/src/spring-cloud/azext_spring_cloud/spring_cloud_instance.py @@ -142,4 +142,4 @@ 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) \ No newline at end of file + sampling_rate) From 5226d73fec23f9d779ee96d5c4122a6f6b3bbd89 Mon Sep 17 00:00:00 2001 From: Pan Li Date: Fri, 7 Jan 2022 11:31:22 +0800 Subject: [PATCH 04/19] Make linter happy. Signed-off-by: Pan Li --- src/spring-cloud/azext_spring_cloud/_help.py | 40 ++++++++++++------- .../azext_spring_cloud/commands.py | 2 +- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/spring-cloud/azext_spring_cloud/_help.py b/src/spring-cloud/azext_spring_cloud/_help.py index b362fd543af..68ad799bbc7 100644 --- a/src/spring-cloud/azext_spring_cloud/_help.py +++ b/src/spring-cloud/azext_spring_cloud/_help.py @@ -847,53 +847,63 @@ short-summary: Unbind a custom-domain of the API portal. """ -helps['spring-cloud build-service buildpacks-binding'] = """ +helps['spring-cloud build-service'] = """ type: group - short-summary: (Enterprise Tier Only) Commands to manage buildpack Binding + short-summary: (Support Enterprise Tier Only) Commands to manage build service in Azure Spring Cloud. +""" + +helps['spring-cloud build-service builder'] = """ + type: group + short-summary: (Support Enterprise Tier Only) Commands to manage builder of build service. +""" + +helps['spring-cloud build-service builder buildpack-binding'] = """ + type: group + short-summary: (Support Enterprise Tier Only) Commands to manage buildpack-binding of builder. """ helps['spring-cloud build-service builder buildpack-binding create'] = """ type: command - short-summary: Create a buildpack binding. + short-summary: (Support Enterprise Tier Only) Create a buildpack binding. examples: - name: Create a buildpack binding without properties or secrets. - text: az spring-cloud build-service builder buildpack-binding create --name first-binding --builder-name first-builder --type ApplicationInsights + text: az spring-cloud build-service builder buildpack-binding create --name first-binding --builder-name first-builder --type ApplicationInsights --service MyCluster --resource-group MyResourceGroup - name: Create a buildpack binding with only secrets. - text: az spring-cloud build-service builder buildpack-binding create --name first-binding --builder-name first-builder --type ApplicationInsights --secrets k1=v1 k2=v2 + text: az spring-cloud build-service builder buildpack-binding create --name first-binding --builder-name first-builder --type ApplicationInsights --secrets k1=v1 k2=v2 --service MyCluster --resource-group MyResourceGroup - name: Create a buildpack binding with only properties. - text: az spring-cloud build-service builder buildpack-binding create --name first-binding --builder-name first-builder --type ApplicationInsights --properties a=b c=d + text: az spring-cloud build-service builder buildpack-binding create --name first-binding --builder-name first-builder --type ApplicationInsights --properties a=b c=d --service MyCluster --resource-group MyResourceGroup - name: Create a buildpack binding with properties and secrets. - text: az spring-cloud build-service builder buildpack-binding create --name first-binding --builder-name first-builder --type ApplicationInsights --properties a=b c=d --secrets k1=v1 k2=v2 + text: az spring-cloud build-service builder buildpack-binding create --name first-binding --builder-name first-builder --type ApplicationInsights --properties a=b c=d --secrets k1=v1 k2=v2 --service MyCluster --resource-group MyResourceGroup """ helps['spring-cloud build-service builder buildpack-binding set'] = """ type: command - short-summary: Set a buildpack binding. + short-summary: (Support Enterprise Tier Only) Set a buildpack binding. examples: - name: Set a buildpack binding with properties and secrets. - text: az spring-cloud build-service builder buildpack-binding set --name first-binding --builder-name first-builder --type ApplicationInsights --properties a=b c=d --secrets k1=v1 k2=v2 + text: az spring-cloud build-service builder buildpack-binding set --name first-binding --builder-name first-builder --type ApplicationInsights --properties a=b c=d --secrets k1=v1 k2=v2 --service MyCluster --resource-group MyResourceGroup """ helps['spring-cloud build-service builder buildpack-binding show'] = """ type: command - short-summary: Show a buildpack binding. The secrets will be masked. + short-summary: (Support Enterprise Tier Only) Show a buildpack binding. The secrets will be masked. examples: - name: Show a buildpack binding. - text: az spring-cloud build-service builder buildpack-binding show --name first-binding --builder-name first-builder + text: az spring-cloud build-service builder buildpack-binding show --name first-binding --builder-name first-builder --service MyCluster --resource-group MyResourceGroup """ helps['spring-cloud build-service builder buildpack-binding list'] = """ type: command - short-summary: List all buildpack binding in a builder. The secrets will be masked. + short-summary: (Support Enterprise Tier Only) List all buildpack binding in a builder. The secrets will be masked. examples: - name: Show a buildpack binding. - text: az spring-cloud build-service builder buildpack-binding list --builder-name first-builder + text: az spring-cloud build-service builder buildpack-binding list --builder-name first-builder --service MyCluster --resource-group MyResourceGroup """ helps['spring-cloud build-service builder buildpack-binding delete'] = """ type: command - short-summary: Delete a buildpack binding. + short-summary: (Support Enterprise Tier Only) Delete a buildpack binding. examples: - name: Delete a buildpack binding. - text: az spring-cloud build-service builder buildpack-binding delete --name first-binding --builder-name first-builder + text: az spring-cloud build-service builder buildpack-binding delete --name first-binding --builder-name first-builder --service MyCluster --resource-group MyResourceGroup """ diff --git a/src/spring-cloud/azext_spring_cloud/commands.py b/src/spring-cloud/azext_spring_cloud/commands.py index 0917b21603e..41e44ffb4ca 100644 --- a/src/spring-cloud/azext_spring_cloud/commands.py +++ b/src/spring-cloud/azext_spring_cloud/commands.py @@ -285,6 +285,6 @@ def load_command_table(self, _): exception_handler=handle_asc_exception, is_preview=True) as g: g.custom_command('create', 'create_or_update_buildpack_binding') g.custom_command('set', 'create_or_update_buildpack_binding') - g.custom_command('show', 'buildpack_binding_show') + g.custom_show_command('show', 'buildpack_binding_show') g.custom_command('list', 'buildpack_binding_list') g.custom_command('delete', 'buildpack_binding_delete') From 0a7aa27d56eb463edc4fecbfd49998a23caee628 Mon Sep 17 00:00:00 2001 From: Pan Li Date: Fri, 7 Jan 2022 11:34:05 +0800 Subject: [PATCH 05/19] Reset help.py. Signed-off-by: Pan Li --- src/spring-cloud/azext_spring_cloud/_help.py | 1518 +++++++----------- 1 file changed, 609 insertions(+), 909 deletions(-) diff --git a/src/spring-cloud/azext_spring_cloud/_help.py b/src/spring-cloud/azext_spring_cloud/_help.py index 68ad799bbc7..ee8e057f877 100644 --- a/src/spring-cloud/azext_spring_cloud/_help.py +++ b/src/spring-cloud/azext_spring_cloud/_help.py @@ -1,909 +1,609 @@ -# coding=utf-8 -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -from knack.help_files import helps # pylint: disable=unused-import - -helps['spring-cloud'] = """ - type: group - short-summary: Commands to manage Azure Spring Cloud. -""" - -helps['spring-cloud create'] = """ - type: command - short-summary: Create an Azure Spring Cloud. - examples: - - name: Create a new Azure Spring Cloud in westus. - text: az spring-cloud create -n MyService -g MyResourceGroup -l westus - - name: Create a new Azure Spring Cloud in westus with an existing Application Insights by using the Connection string (recommended) or Instrumentation key. - text: az spring-cloud create -n MyService -g MyResourceGroup -l westus --app-insights-key \"MyConnectionString\" - - name: Create a new Azure Spring Cloud in westus with an existing Application Insights. - text: az spring-cloud create -n MyService -g MyResourceGroup -l westus --app-insights appInsightsName - - name: Create a new Azure Spring Cloud in westus with an existing Application Insights and specify the sampling rate. - text: az spring-cloud create -n MyService -g MyResourceGroup -l westus --app-insights appInsightsName --sampling-rate 10 - - name: Create a new Azure Spring Cloud with Application Insights disabled. - text: az spring-cloud create -n MyService -g MyResourceGroup --disable-app-insights - - name: Create a new Azure Spring Cloud with VNet-injected via giving VNet name in current resource group - text: az spring-cloud create -n MyService -g MyResourceGroup --vnet MyVNet --app-subnet MyAppSubnet --service-runtime-subnet MyServiceRuntimeSubnet - - name: Create a new Azure Spring Cloud with VNet-injected via giving subnets resource ID - text: az spring-cloud create -n MyService -g MyResourceGroup --app-subnet /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyVnetRg/providers/Microsoft.Network/VirtualNetworks/test-vnet/subnets/app --service-runtime-subnet /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyVnetRg/providers/Microsoft.Network/VirtualNetworks/test-vnet/subnets/svc --reserved-cidr-range 10.0.0.0/16,10.1.0.0/16,10.2.0.1/16 - - name: Create a Azure Spring Cloud Enterprise instance if the Azure Subscription never hosts Azure Spring Cloud Enterprise instance - text: | - az provider register -n Microsoft.SaaS - az term accept --publisher vmware-inc --product azure-spring-cloud-vmware-tanzu-2 --plan tanzu-asc-ent-mtr - az spring-cloud create -n MyService -g MyResourceGroup --sku Enterprise -""" - -helps['spring-cloud update'] = """ - type: command - short-summary: Update an Azure Spring Cloud. - examples: - - name: Update pricing tier. - text: az spring-cloud update -n MyService --sku Standard -g MyResourceGroup - - name: Update the tags of the existing Azure Spring Cloud. - text: az spring-cloud update -n MyService -g MyResourceGroup --tags key1=value1 key2=value2 -""" - -helps['spring-cloud delete'] = """ - type: command - short-summary: Delete an Azure Spring Cloud. -""" - -helps['spring-cloud start'] = """ - type: command - short-summary: Start an Azure Spring Cloud. -""" - -helps['spring-cloud stop'] = """ - type: command - short-summary: Stop an Azure Spring Cloud. -""" - -helps['spring-cloud list'] = """ - type: command - short-summary: List all Azure Spring Cloud in the given resource group, otherwise list the subscription's. -""" - -helps['spring-cloud show'] = """ - type: command - short-summary: Show the details for an Azure Spring Cloud. -""" - -helps['spring-cloud test-endpoint'] = """ - type: group - short-summary: Commands to manage test endpoint in Azure Spring Cloud. -""" - -helps['spring-cloud test-endpoint enable'] = """ - type: command - short-summary: Enable test endpoint of the Azure Spring Cloud. -""" - -helps['spring-cloud test-endpoint disable'] = """ - type: command - short-summary: Disable test endpoint of the Azure Spring Cloud. -""" - -helps['spring-cloud test-endpoint list'] = """ - type: command - short-summary: List test endpoint keys of the Azure Spring Cloud. -""" - -helps['spring-cloud test-endpoint renew-key'] = """ - type: command - short-summary: Regenerate a test-endpoint key for the Azure Spring Cloud. -""" - -helps['spring-cloud storage'] = """ - type: group - short-summary: Commands to manage Storages in Azure Spring Cloud. -""" - -helps['spring-cloud storage add'] = """ - type: command - short-summary: Create a new storage in the Azure Spring Cloud. - examples: - - name: Create a Storage resource with your own storage account. - text: az spring-cloud storage add --storage-type StorageAccount --account-name MyAccountName --account-key MyAccountKey -g MyResourceGroup -s MyService -n MyStorageName -""" - -helps['spring-cloud storage update'] = """ - type: command - short-summary: Update an existing storage in the Azure Spring Cloud. - examples: - - name: Update a Storage resource with new name or new key. - text: az spring-cloud storage update --storage-type StorageAccount --account-name MyAccountName --account-key MyAccountKey -g MyResourceGroup -s MyService -n MyStorageName -""" - -helps['spring-cloud storage show'] = """ - type: command - short-summary: Get an existing storage in the Azure Spring Cloud. - examples: - - name: Get a Storage resource. - text: az spring-cloud storage show -g MyResourceGroup -s MyService -n MyStorageName -""" - -helps['spring-cloud storage list'] = """ - type: command - short-summary: List all existing storages in the Azure Spring Cloud. - examples: - - name: List all Storage resources. - text: az spring-cloud storage list -g MyResourceGroup -s MyService -""" - -helps['spring-cloud storage remove'] = """ - type: command - short-summary: Remove an existing storage in the Azure Spring Cloud. - examples: - - name: Remove a Storage resource. - text: az spring-cloud storage remove -g MyResourceGroup -s MyService -n MyStorageName -""" - -helps['spring-cloud storage list-persistent-storage'] = """ - type: command - short-summary: List all the persistent storages related to an existing storage in the Azure Spring Cloud. - examples: - - name: list all the persistent-storage related to an existing storage. - text: az spring-cloud storage list-persistent-storage -g MyResourceGroup -s MyService -n MyStorageName -""" - -helps['spring-cloud app'] = """ - type: group - short-summary: Commands to manage apps in Azure Spring Cloud. -""" - -helps['spring-cloud app create'] = """ - type: command - short-summary: Create a new app with a default deployment in the Azure Spring Cloud. - examples: - - name: Create an app with the default configuration. - text: az spring-cloud app create -n MyApp -s MyCluster -g MyResourceGroup - - name: Create an public accessible app with 3 instances and 2 cpu cores and 3 GB of memory per instance. - text: az spring-cloud app create -n MyApp -s MyCluster -g MyResourceGroup --assign-endpoint true --cpu 2 --memory 3 --instance-count 3 -""" - -helps['spring-cloud app append-persistent-storage'] = """ - type: command - short-summary: Append a new persistent storage to an app in the Azure Spring Cloud. - examples: - - name: Append a new persistent storage to an app. - text: az spring-cloud app append-persistent-storage --persistent-storage-type AzureFileVolume --share-name MyShareName --mount-path /MyMountPath --storage-name MyStorageName -n MyApp -g MyResourceGroup -s MyService -""" - -helps['spring-cloud app update'] = """ - type: command - short-summary: Update configurations of an app. - examples: - - name: Add an environment variable for the app. - text: az spring-cloud app update -n MyApp -s MyCluster -g MyResourceGroup --env foo=bar -""" - -helps['spring-cloud app delete'] = """ - type: command - short-summary: Delete an app in the Azure Spring Cloud. -""" - -helps['spring-cloud app list'] = """ - type: command - short-summary: List all apps in the Azure Spring Cloud. - examples: - - name: Query status of persistent storage of all apps - text: az spring-cloud app list -s MyCluster -g MyResourceGroup -o json --query '[].{Name:name, PersistentStorage:properties.persistentDisk}' -""" - -helps['spring-cloud app show'] = """ - type: command - short-summary: Show the details of an app in the Azure Spring Cloud. -""" - -helps['spring-cloud app start'] = """ - type: command - short-summary: Start instances of the app, default to production deployment. -""" - -helps['spring-cloud app stop'] = """ - type: command - short-summary: Stop instances of the app, default to production deployment. -""" - -helps['spring-cloud app restart'] = """ - type: command - short-summary: Restart instances of the app, default to production deployment. -""" - -helps['spring-cloud app deploy'] = """ - type: command - short-summary: Deploy source code or pre-built binary to an app and update related configurations. - examples: - - name: Deploy source code to an app. This will pack current directory, build binary with Pivotal Build Service and then deploy to the app. - text: az spring-cloud app deploy -n MyApp -s MyCluster -g MyResourceGroup - - name: Deploy a pre-built jar to an app with jvm options and environment variables. - text: az spring-cloud app deploy -n MyApp -s MyCluster -g MyResourceGroup --jar-path app.jar --jvm-options="-XX:+UseG1GC -XX:+UseStringDeduplication" --env foo=bar - - name: Deploy source code to a specific deployment of an app. - text: az spring-cloud app deploy -n MyApp -s MyCluster -g MyResourceGroup -d green-deployment - - name: Deploy a container image on Docker Hub to an app. - text: az spring-cloud app deploy -n MyApp -s MyCluster -g MyResourceGroup --container-image contoso/your-app:v1 - - name: Deploy a container image on a private registry to an app. - text: az spring-cloud app deploy -n MyApp -s MyCluster -g MyResourceGroup --container-image contoso/your-app:v1 --container-registry myacr.azurecr.io --registry-username --registry-password -""" - -helps['spring-cloud app scale'] = """ - type: command - short-summary: Manually scale an app or its deployments. - examples: - - name: Scale up an app to 4 cpu cores and 8 Gb of memory per instance. - text: az spring-cloud app scale -n MyApp -s MyCluster -g MyResourceGroup --cpu 3 --memory 8 - - name: Scale out a deployment of the app to 5 instances. - text: az spring-cloud app scale -n MyApp -s MyCluster -g MyResourceGroup -d green-deployment --instance-count 5 -""" - -helps['spring-cloud app show-deploy-log'] = """ - type: command - short-summary: Show build log of the last deploy, only apply to source code deploy, default to production deployment. -""" - -helps['spring-cloud app log tail'] = """ - type: command - short-summary: Show logs of an app instance, logs will be streamed when setting '-f/--follow'. -""" - -helps['spring-cloud app identity'] = """ - type: group - short-summary: Manage an app's managed service identity. -""" - -helps['spring-cloud app identity assign'] = """ - type: command - short-summary: Enable managed service identity on an app. - examples: - - name: Enable the system assigned identity. - text: az spring-cloud app identity assign -n MyApp -s MyCluster -g MyResourceGroup - - name: Enable the system assigned identity on an app with the 'Reader' role. - text: az spring-cloud app identity assign -n MyApp -s MyCluster -g MyResourceGroup --role Reader --scope /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/xxxxx/providers/Microsoft.KeyVault/vaults/xxxxx -""" - -helps['spring-cloud app identity remove'] = """ - type: command - short-summary: Remove managed service identity from an app. - examples: - - name: Remove the system assigned identity from an app. - text: az spring-cloud app identity remove -n MyApp -s MyCluster -g MyResourceGroup -""" - -helps['spring-cloud app identity show'] = """ - type: command - short-summary: Display app's managed identity info. - examples: - - name: Display an app's managed identity info. - text: az spring-cloud app identity show -n MyApp -s MyCluster -g MyResourceGroup -""" - -helps['spring-cloud app set-deployment'] = """ - type: command - short-summary: Set production deployment of an app. - examples: - - name: Swap a staging deployment of an app to production. - text: az spring-cloud app set-deployment -d green-deployment -n MyApp -s MyCluster -g MyResourceGroup -""" - -helps['spring-cloud app unset-deployment'] = """ - type: command - short-summary: Unset production deployment of an app. - examples: - - name: Swap the production deployment of an app to staging if the app has the production deployment. - text: az spring-cloud app unset-deployment -n MyApp -s MyCluster -g MyResourceGroup -""" - -helps['spring-cloud app log'] = """ - type: group - short-summary: Commands to tail app instances logs with multiple options. If the app has only one instance, the instance name is optional. -""" - -helps['spring-cloud app logs'] = """ - type: command - short-summary: Show logs of an app instance, logs will be streamed when setting '-f/--follow'. -""" - -helps['spring-cloud app deployment'] = """ - type: group - short-summary: Commands to manage life cycle of deployments of an app in Azure Spring Cloud. More operations on deployments can be done on app level with parameter --deployment. e.g. az spring-cloud app deploy --deployment -""" - -helps['spring-cloud app deployment list'] = """ - type: command - short-summary: List all deployments in an app. -""" - -helps['spring-cloud app deployment show'] = """ - type: command - short-summary: Show details of a deployment. -""" - -helps['spring-cloud app deployment delete'] = """ - type: command - short-summary: Delete a deployment of the app. -""" - -helps['spring-cloud app deployment create'] = """ - type: command - short-summary: Create a staging deployment for the app. To deploy code or update setting to an existing deployment, use `az spring-cloud app deploy/update --deployment `. - examples: - - name: Deploy source code to a new deployment of an app. This will pack current directory, build binary with Pivotal Build Service and then deploy. - text: az spring-cloud app deployment create -n green-deployment --app MyApp -s MyCluster -g MyResourceGroup - - name: Deploy a pre-built jar to an app with jvm options and environment variables. - text: az spring-cloud app deployment create -n green-deployment --app MyApp -s MyCluster -g MyResourceGroup --jar-path app.jar --jvm-options="-XX:+UseG1GC -XX:+UseStringDeduplication" --env foo=bar - - name: Deploy a container image on Docker Hub to an app. - text: az spring-cloud app deployment create -n green-deployment --app MyApp -s MyCluster -g MyResourceGroup --container-image contoso/your-app:v1 - - name: Deploy a container image on a private registry to an app. - text: az spring-cloud app deployment create -n green-deployment --app MyApp -s MyCluster -g MyResourceGroup --container-image contoso/your-app:v1 --container-registry myacr.azurecr.io --registry-username --registry-password -""" - -helps['spring-cloud app deployment generate-heap-dump'] = """ - type: command - short-summary: Generate a heap dump of your target app instance to given file path. -""" - -helps['spring-cloud app deployment generate-thread-dump'] = """ - type: command - short-summary: Generate a thread dump of your target app instance to given file path. -""" - -helps['spring-cloud app deployment start-jfr'] = """ - type: command - short-summary: Start a JFR on your target app instance to given file path. -""" - -helps['spring-cloud config-server'] = """ - type: group - short-summary: (Support Standard Tier and Basic Tier) Commands to manage Config Server in Azure Spring Cloud. -""" - -helps['spring-cloud config-server show'] = """ - type: command - short-summary: Show Config Server. -""" - -helps['spring-cloud config-server set'] = """ - type: command - short-summary: Set Config Server from a yaml file. -""" - -helps['spring-cloud config-server clear'] = """ - type: command - short-summary: Erase all settings in Config Server. -""" - -helps['spring-cloud config-server git'] = """ - type: group - short-summary: Commands to manage Config Server git property in Azure Spring Cloud. -""" - -helps['spring-cloud config-server git repo'] = """ - type: group - short-summary: Commands to manage Config Server git repository in Azure Spring Cloud. -""" - -helps['spring-cloud config-server git set'] = """ - type: command - short-summary: Set git property of Config Server, will totally override the old one. -""" - -helps['spring-cloud config-server git repo add'] = """ - type: command - short-summary: Add a new repository of git property of Config Server. -""" - -helps['spring-cloud config-server git repo remove'] = """ - type: command - short-summary: Remove an existing repository of git property of Config Server. -""" - -helps['spring-cloud config-server git repo update'] = """ - type: command - short-summary: Override an existing repository of git property of Config Server, will totally override the old one. -""" - -helps['spring-cloud config-server git repo list'] = """ - type: command - short-summary: List all repositories of git property of Config Server. -""" - -helps['spring-cloud app binding'] = """ - type: group - short-summary: Commands to manage bindings with Azure Data Services, you need to manually restart app to make settings take effect. -""" - -helps['spring-cloud app binding cosmos'] = """ - type: group - short-summary: Commands to manage Azure Cosmos DB bindings. -""" - -helps['spring-cloud app binding mysql'] = """ - type: group - short-summary: Commands to manage Azure Database for MySQL bindings. -""" - -helps['spring-cloud app binding redis'] = """ - type: group - short-summary: Commands to manage Azure Cache for Redis bindings. -""" -helps['spring-cloud app binding list'] = """ - type: command - short-summary: List all service bindings in an app. -""" - -helps['spring-cloud app binding show'] = """ - type: command - short-summary: Show the details of a service binding. -""" -helps['spring-cloud app binding remove'] = """ - type: command - short-summary: Remove a service binding of the app. -""" - -helps['spring-cloud app binding cosmos add'] = """ - type: command - short-summary: Bind an Azure Cosmos DB with the app. - examples: - - name: Bind an Azure Cosmos DB. - text: az spring-cloud app binding cosmos add -n cosmosProduction --app MyApp --resource-id ${COSMOSDB_ID} --api-type mongo --database mymongo -g MyResourceGroup -s MyService -""" - -helps['spring-cloud app binding cosmos update'] = """ - type: command - short-summary: Update an Azure Cosmos DB service binding of the app. -""" - -helps['spring-cloud app binding mysql add'] = """ - type: command - short-summary: Bind an Azure Database for MySQL with the app. -""" - -helps['spring-cloud app binding mysql update'] = """ - type: command - short-summary: Update an Azure Database for MySQL service binding of the app. -""" - -helps['spring-cloud app binding redis add'] = """ - type: command - short-summary: Bind an Azure Cache for Redis with the app. -""" - -helps['spring-cloud app binding redis update'] = """ - type: command - short-summary: Update an Azure Cache for Redis service binding of the app. -""" - -helps['spring-cloud app append-loaded-public-certificate'] = """ - type: command - short-summary: Append a new loaded public certificate to an app in the Azure Spring Cloud. - examples: - - name: Append a new loaded public certificate to an app. - text: az spring-cloud app append-loaded-public-certificate --name MyApp --service MyCluster --resource-group MyResourceGroup --certificate-name MyCertName --load-trust-store true -""" - -helps['spring-cloud certificate'] = """ - type: group - short-summary: Commands to manage certificates. -""" - -helps['spring-cloud certificate add'] = """ - type: command - short-summary: Add a certificate in Azure Spring Cloud. - examples: - - name: Import certificate from key vault. - text: az spring-cloud certificate add --name MyCertName --vault-uri MyKeyVaultUri --vault-certificate-name MyKeyVaultCertName --service MyCluster --resource-group MyResourceGroup -""" - -helps['spring-cloud certificate show'] = """ - type: command - short-summary: Show a certificate in Azure Spring Cloud. -""" - -helps['spring-cloud certificate list'] = """ - type: command - short-summary: List all certificates in Azure Spring Cloud. - examples: - - name: List all certificates in spring cloud service. - text: az spring-cloud certificate list --service MyCluster --resource-group MyResourceGroup -o table -""" - -helps['spring-cloud certificate remove'] = """ - type: command - short-summary: Remove a certificate in Azure Spring Cloud. -""" - -helps['spring-cloud certificate list-reference-app'] = """ - type: command - short-summary: List all the apps reference an existing certificate in the Azure Spring Cloud. - examples: - - name: List all the apps reference an existing certificate in spring cloud service. - text: az spring-cloud certificate list-reference-app --service MyCluster --resource-group MyResourceGroup --name MyCertName -""" - -helps['spring-cloud app custom-domain'] = """ - type: group - short-summary: Commands to manage custom domains. -""" - -helps['spring-cloud app custom-domain bind'] = """ - type: command - short-summary: Bind a custom domain with the app. - examples: - - name: Bind a custom domain to app. - text: az spring-cloud app custom-domain bind --domain-name MyDomainName --certificate MyCertName --app MyAppName --service MyCluster --resource-group MyResourceGroup -""" - -helps['spring-cloud app custom-domain show'] = """ - type: command - short-summary: Show details of a custom domain. -""" - -helps['spring-cloud app custom-domain list'] = """ - type: command - short-summary: List all custom domains of the app. - examples: - - name: List all custom domains of the app. - text: az spring-cloud app custom-domain list --app MyAppName --service MyCluster --resource-group MyResourceGroup -o table -""" - -helps['spring-cloud app custom-domain update'] = """ - type: command - short-summary: Update a custom domain of the app. - examples: - - name: Bind custom domain with a specified certificate. - text: az spring-cloud app custom-domain update --domain-name MyDomainName --certificate MCertName --app MyAppName --service MyCluster --resource-group MyResourceGroup -""" - -helps['spring-cloud app custom-domain unbind'] = """ - type: command - short-summary: Unbind a custom-domain of the app. -""" - -helps['spring-cloud app-insights'] = """ - type: group - short-summary: Commands to management Application Insights in Azure Spring Cloud. -""" - -helps['spring-cloud app-insights show'] = """ - type: command - short-summary: Show Application Insights settings. -""" - -helps['spring-cloud app-insights update'] = """ - type: command - short-summary: Update Application Insights settings. - examples: - - name: Enable Application Insights by using the Connection string (recommended) or Instrumentation key. - text: az spring-cloud app-insights update -n MyService -g MyResourceGroup --app-insights-key \"MyConnectionString\" --sampling-rate 100 - - name: Disable Application Insights. - text: az spring-cloud app-insights update -n MyService -g MyResourceGroup --disable -""" - -helps['spring-cloud service-registry'] = """ - type: group - short-summary: (Support Enterprise Tier Only) Commands to manage Service Registry in Azure Spring Cloud. -""" - -helps['spring-cloud service-registry show'] = """ - type: command - short-summary: Show the provisioning status and runtime status of Service Registry. -""" - -helps['spring-cloud service-registry bind'] = """ - type: command - short-summary: Bind an app to Service Registry. - examples: - - name: Bind an app to Service Registry. - text: az spring-cloud service-registry bind --app MyApp -s MyService -g MyResourceGroup -""" - -helps['spring-cloud service-registry unbind'] = """ - type: command - short-summary: Unbind an app from Service Registry. - examples: - - name: Unbind an app from Service Registry. - text: az spring-cloud service-registry unbind --app MyApp -s MyService -g MyResourceGroup -""" - -helps['spring-cloud application-configuration-service'] = """ - type: group - short-summary: (Support Enterprise Tier Only) Commands to manage Application Configuration Service in Azure Spring Cloud. -""" - -helps['spring-cloud application-configuration-service show'] = """ - type: command - short-summary: Show the provisioning status, runtime status, and settings of Application Configuration Service. -""" - -helps['spring-cloud application-configuration-service clear'] = """ - type: command - short-summary: Reset all Application Configuration Service settings. -""" - -helps['spring-cloud application-configuration-service git'] = """ - type: group - short-summary: Commands to manage Application Configuration Service git property in Azure Spring Cloud. -""" - -helps['spring-cloud application-configuration-service git repo'] = """ - type: group - short-summary: Commands to manage Application Configuration Service git repository in Azure Spring Cloud. -""" - -helps['spring-cloud application-configuration-service git repo add'] = """ - type: command - short-summary: Add a Git property to the Application Configuration Service settings. - examples: - - name: Add a Git property. - text: az spring-cloud application-configuration-service git repo add -s MyService -g MyResourceGroup --name MyName --patterns MyPattern --uri https://MyURI --label master -""" - -helps['spring-cloud application-configuration-service git repo update'] = """ - type: command - short-summary: Update an existing Git property in the Application Configuration Service settings. - examples: - - name: Update a Git property. - text: az spring-cloud application-configuration-service git repo update -s MyService -g MyResourceGroup --name MyName --patterns MyPattern -""" - -helps['spring-cloud application-configuration-service git repo remove'] = """ - type: command - short-summary: Delete an existing Git property from the Application Configuration Service settings. - examples: - - name: Delete a Git property. - text: az spring-cloud application-configuration-service git repo remove -s MyService -g MyResourceGroup --name MyName -""" - -helps['spring-cloud application-configuration-service git repo list'] = """ - type: command - short-summary: List all Git settings of Application Configuration Service. -""" - -helps['spring-cloud application-configuration-service bind'] = """ - type: command - short-summary: Bind an app to Application Configuration Service. - examples: - - name: Bind an app to Application Configuration Service. - text: az spring-cloud application-configuration-service bind --app MyApp -s MyService -g MyResourceGroup -""" - -helps['spring-cloud application-configuration-service unbind'] = """ - type: command - short-summary: Unbind an app from Application Configuration Service. - examples: - - name: Unbind an app from Application Configuration Service. - text: az spring-cloud application-configuration-service unbind --app MyApp -s MyService -g MyResourceGroup -""" - -helps['spring-cloud gateway'] = """ - type: group - short-summary: (Support Enterprise Tier Only) Commands to manage gateway in Azure Spring Cloud. -""" - -helps['spring-cloud gateway clear'] = """ - type: command - short-summary: Clear all settings of gateway. -""" - -helps['spring-cloud gateway show'] = """ - type: command - short-summary: Show the settings, provisioning status and runtime status of gateway. -""" - -helps['spring-cloud gateway update'] = """ - type: command - short-summary: Update an existing gateway properties. - examples: - - name: Update gateway property. - text: az spring-cloud gateway update -s MyService -g MyResourceGroup --assign-endpoint true --https-only true -""" - -helps['spring-cloud gateway route-config'] = """ - type: group - short-summary: Commands to manage gateway route configs in Azure Spring Cloud. -""" - -helps['spring-cloud gateway route-config create'] = """ - type: command - short-summary: Create a gateway route config with routing rules of Json array format. - examples: - - name: Create a gateway route config targeting the app in Azure Spring Cloud. - text: az spring-cloud gateway route-config create -s MyService -g MyResourceGroup --name MyName --app-name MyApp --routes-file MyJson.json -""" - -helps['spring-cloud gateway route-config update'] = """ - type: command - short-summary: Update an existing gateway route config with routing rules of Json array format. - examples: - - name: Update an existing gateway route config targeting the app in Azure Spring Cloud. - text: az spring-cloud gateway route-config update -s MyService -g MyResourceGroup --name MyName --app-name MyApp --routes-file MyJson.json -""" - -helps['spring-cloud gateway route-config remove'] = """ - type: command - short-summary: Delete an existing gateway route config. - examples: - - name: Delete an existing gateway route config. - text: az spring-cloud gateway route-config remove -s MyService -g MyResourceGroup --name MyName -""" - -helps['spring-cloud gateway route-config show'] = """ - type: command - short-summary: Get an existing gateway route config. - examples: - - name: Get an existing gateway route config. - text: az spring-cloud gateway route-config show -s MyService -g MyResourceGroup --name MyName -""" - -helps['spring-cloud gateway route-config list'] = """ - type: command - short-summary: List all existing gateway route configs. - examples: - - name: List all existing gateway route configs. - text: az spring-cloud gateway route-config list -s MyService -g MyResourceGroup -""" - -helps['spring-cloud gateway custom-domain'] = """ - type: group - short-summary: Commands to manage custom domains for gateway. -""" - -helps['spring-cloud gateway custom-domain bind'] = """ - type: command - short-summary: Bind a custom domain with the gateway. - examples: - - name: Bind a custom domain to gateway. - text: az spring-cloud gateway custom-domain bind --domain-name MyDomainName --certificate MyCertName --service MyCluster --resource-group MyResourceGroup -""" - -helps['spring-cloud gateway custom-domain show'] = """ - type: command - short-summary: Show details of a custom domain. -""" - -helps['spring-cloud gateway custom-domain list'] = """ - type: command - short-summary: List all custom domains of the gateway. - examples: - - name: List all custom domains of the gateway. - text: az spring-cloud gateway custom-domain list --service MyCluster --resource-group MyResourceGroup -""" - -helps['spring-cloud gateway custom-domain update'] = """ - type: command - short-summary: Update a custom domain of the gateway. - examples: - - name: Bind custom domain with a specified certificate. - text: az spring-cloud gateway custom-domain update --domain-name MyDomainName --certificate MCertName --service MyCluster --resource-group MyResourceGroup -""" - -helps['spring-cloud gateway custom-domain unbind'] = """ - type: command - short-summary: Unbind a custom-domain of the gateway. -""" - -helps['spring-cloud api-portal'] = """ - type: group - short-summary: (Support Enterprise Tier Only) Commands to manage API portal in Azure Spring Cloud. -""" - -helps['spring-cloud api-portal clear'] = """ - type: command - short-summary: Clear all settings of API portal. -""" - -helps['spring-cloud api-portal show'] = """ - type: command - short-summary: Show the settings, provisioning status and runtime status of API portal. -""" - -helps['spring-cloud api-portal update'] = """ - type: command - short-summary: Update an existing API portal properties. - examples: - - name: Update API portal property. - text: az spring-cloud api-portal update -s MyService -g MyResourceGroup --assign-endpoint true --https-only true -""" - -helps['spring-cloud api-portal custom-domain'] = """ - type: group - short-summary: Commands to manage custom domains for API portal. -""" - -helps['spring-cloud api-portal custom-domain bind'] = """ - type: command - short-summary: Bind a custom domain with the API portal. - examples: - - name: Bind a custom domain to API portal. - text: az spring-cloud api-portal custom-domain bind --domain-name MyDomainName --certificate MyCertName --service MyCluster --resource-group MyResourceGroup -""" - -helps['spring-cloud api-portal custom-domain show'] = """ - type: command - short-summary: Show details of a custom domain. -""" - -helps['spring-cloud api-portal custom-domain list'] = """ - type: command - short-summary: List all custom domains of the API portal. - examples: - - name: List all custom domains of the API portal. - text: az spring-cloud api-portal custom-domain list --service MyCluster --resource-group MyResourceGroup -""" - -helps['spring-cloud api-portal custom-domain update'] = """ - type: command - short-summary: Update a custom domain of the API portal. - examples: - - name: Bind custom domain with a specified certificate. - text: az spring-cloud api-portal custom-domain update --domain-name MyDomainName --certificate MCertName --service MyCluster --resource-group MyResourceGroup -""" - -helps['spring-cloud api-portal custom-domain unbind'] = """ - type: command - short-summary: Unbind a custom-domain of the API portal. -""" - -helps['spring-cloud build-service'] = """ - type: group - short-summary: (Support Enterprise Tier Only) Commands to manage build service in Azure Spring Cloud. -""" - -helps['spring-cloud build-service builder'] = """ - type: group - short-summary: (Support Enterprise Tier Only) Commands to manage builder of build service. -""" - -helps['spring-cloud build-service builder buildpack-binding'] = """ - type: group - short-summary: (Support Enterprise Tier Only) Commands to manage buildpack-binding of builder. -""" - -helps['spring-cloud build-service builder buildpack-binding create'] = """ - type: command - short-summary: (Support Enterprise Tier Only) Create a buildpack binding. - examples: - - name: Create a buildpack binding without properties or secrets. - text: az spring-cloud build-service builder buildpack-binding create --name first-binding --builder-name first-builder --type ApplicationInsights --service MyCluster --resource-group MyResourceGroup - - name: Create a buildpack binding with only secrets. - text: az spring-cloud build-service builder buildpack-binding create --name first-binding --builder-name first-builder --type ApplicationInsights --secrets k1=v1 k2=v2 --service MyCluster --resource-group MyResourceGroup - - name: Create a buildpack binding with only properties. - text: az spring-cloud build-service builder buildpack-binding create --name first-binding --builder-name first-builder --type ApplicationInsights --properties a=b c=d --service MyCluster --resource-group MyResourceGroup - - name: Create a buildpack binding with properties and secrets. - text: az spring-cloud build-service builder buildpack-binding create --name first-binding --builder-name first-builder --type ApplicationInsights --properties a=b c=d --secrets k1=v1 k2=v2 --service MyCluster --resource-group MyResourceGroup -""" - -helps['spring-cloud build-service builder buildpack-binding set'] = """ - type: command - short-summary: (Support Enterprise Tier Only) Set a buildpack binding. - examples: - - name: Set a buildpack binding with properties and secrets. - text: az spring-cloud build-service builder buildpack-binding set --name first-binding --builder-name first-builder --type ApplicationInsights --properties a=b c=d --secrets k1=v1 k2=v2 --service MyCluster --resource-group MyResourceGroup -""" - -helps['spring-cloud build-service builder buildpack-binding show'] = """ - type: command - short-summary: (Support Enterprise Tier Only) Show a buildpack binding. The secrets will be masked. - examples: - - name: Show a buildpack binding. - text: az spring-cloud build-service builder buildpack-binding show --name first-binding --builder-name first-builder --service MyCluster --resource-group MyResourceGroup -""" - -helps['spring-cloud build-service builder buildpack-binding list'] = """ - type: command - short-summary: (Support Enterprise Tier Only) List all buildpack binding in a builder. The secrets will be masked. - examples: - - name: Show a buildpack binding. - text: az spring-cloud build-service builder buildpack-binding list --builder-name first-builder --service MyCluster --resource-group MyResourceGroup -""" - -helps['spring-cloud build-service builder buildpack-binding delete'] = """ - type: command - short-summary: (Support Enterprise Tier Only) Delete a buildpack binding. - examples: - - name: Delete a buildpack binding. - text: az spring-cloud build-service builder buildpack-binding delete --name first-binding --builder-name first-builder --service MyCluster --resource-group MyResourceGroup -""" +# coding=utf-8 +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from knack.help_files import helps # pylint: disable=unused-import + +helps['spring-cloud'] = """ + type: group + short-summary: Commands to manage Azure Spring Cloud. +""" + +helps['spring-cloud create'] = """ + type: command + short-summary: Create an Azure Spring Cloud. + examples: + - name: Create a new Azure Spring Cloud in westus. + text: az spring-cloud create -n MyService -g MyResourceGroup -l westus + - name: Create a new Azure Spring Cloud in westus with an existing Application Insights by using the Connection string (recommended) or Instrumentation key. + text: az spring-cloud create -n MyService -g MyResourceGroup -l westus --app-insights-key \"MyConnectionString\" + - name: Create a new Azure Spring Cloud in westus with an existing Application Insights. + text: az spring-cloud create -n MyService -g MyResourceGroup -l westus --app-insights appInsightsName + - name: Create a new Azure Spring Cloud in westus with an existing Application Insights and specify the sampling rate. + text: az spring-cloud create -n MyService -g MyResourceGroup -l westus --app-insights appInsightsName --sampling-rate 10 + - name: Create a new Azure Spring Cloud with Application Insights disabled. + text: az spring-cloud create -n MyService -g MyResourceGroup --disable-app-insights + - name: Create a new Azure Spring Cloud with VNet-injected via giving VNet name in current resource group + text: az spring-cloud create -n MyService -g MyResourceGroup --vnet MyVNet --app-subnet MyAppSubnet --service-runtime-subnet MyServiceRuntimeSubnet + - name: Create a new Azure Spring Cloud with VNet-injected via giving subnets resource ID + text: az spring-cloud create -n MyService -g MyResourceGroup --app-subnet /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyVnetRg/providers/Microsoft.Network/VirtualNetworks/test-vnet/subnets/app --service-runtime-subnet /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyVnetRg/providers/Microsoft.Network/VirtualNetworks/test-vnet/subnets/svc --reserved-cidr-range 10.0.0.0/16,10.1.0.0/16,10.2.0.1/16 + - name: Create a Azure Spring Cloud Enterprise instance if the Azure Subscription never hosts Azure Spring Cloud Enterprise instance + text: | + az provider register -n Microsoft.SaaS + az term accept --publisher vmware-inc --product azure-spring-cloud-vmware-tanzu-2 --plan tanzu-asc-ent-mtr + az spring-cloud create -n MyService -g MyResourceGroup --sku Enterprise +""" + +helps['spring-cloud update'] = """ + type: command + short-summary: Update an Azure Spring Cloud. + examples: + - name: Update pricing tier. + text: az spring-cloud update -n MyService --sku Standard -g MyResourceGroup + - name: Update the tags of the existing Azure Spring Cloud. + text: az spring-cloud update -n MyService -g MyResourceGroup --tags key1=value1 key2=value2 +""" + +helps['spring-cloud delete'] = """ + type: command + short-summary: Delete an Azure Spring Cloud. +""" + +helps['spring-cloud start'] = """ + type: command + short-summary: Start an Azure Spring Cloud. +""" + +helps['spring-cloud stop'] = """ + type: command + short-summary: Stop an Azure Spring Cloud. +""" + +helps['spring-cloud list'] = """ + type: command + short-summary: List all Azure Spring Cloud in the given resource group, otherwise list the subscription's. +""" + +helps['spring-cloud show'] = """ + type: command + short-summary: Show the details for an Azure Spring Cloud. +""" + +helps['spring-cloud test-endpoint'] = """ + type: group + short-summary: Commands to manage test endpoint in Azure Spring Cloud. +""" + +helps['spring-cloud test-endpoint enable'] = """ + type: command + short-summary: Enable test endpoint of the Azure Spring Cloud. +""" + +helps['spring-cloud test-endpoint disable'] = """ + type: command + short-summary: Disable test endpoint of the Azure Spring Cloud. +""" + +helps['spring-cloud test-endpoint list'] = """ + type: command + short-summary: List test endpoint keys of the Azure Spring Cloud. +""" + +helps['spring-cloud test-endpoint renew-key'] = """ + type: command + short-summary: Regenerate a test-endpoint key for the Azure Spring Cloud. +""" + +helps['spring-cloud storage'] = """ + type: group + short-summary: Commands to manage Storages in Azure Spring Cloud. +""" + +helps['spring-cloud storage add'] = """ + type: command + short-summary: Create a new storage in the Azure Spring Cloud. + examples: + - name: Create a Storage resource with your own storage account. + text: az spring-cloud storage add --storage-type StorageAccount --account-name MyAccountName --account-key MyAccountKey -g MyResourceGroup -s MyService -n MyStorageName +""" + +helps['spring-cloud storage update'] = """ + type: command + short-summary: Update an existing storage in the Azure Spring Cloud. + examples: + - name: Update a Storage resource with new name or new key. + text: az spring-cloud storage update --storage-type StorageAccount --account-name MyAccountName --account-key MyAccountKey -g MyResourceGroup -s MyService -n MyStorageName +""" + +helps['spring-cloud storage show'] = """ + type: command + short-summary: Get an existing storage in the Azure Spring Cloud. + examples: + - name: Get a Storage resource. + text: az spring-cloud storage show -g MyResourceGroup -s MyService -n MyStorageName +""" + +helps['spring-cloud storage list'] = """ + type: command + short-summary: List all existing storages in the Azure Spring Cloud. + examples: + - name: List all Storage resources. + text: az spring-cloud storage list -g MyResourceGroup -s MyService +""" + +helps['spring-cloud storage remove'] = """ + type: command + short-summary: Remove an existing storage in the Azure Spring Cloud. + examples: + - name: Remove a Storage resource. + text: az spring-cloud storage remove -g MyResourceGroup -s MyService -n MyStorageName +""" + +helps['spring-cloud storage list-persistent-storage'] = """ + type: command + short-summary: List all the persistent storages related to an existing storage in the Azure Spring Cloud. + examples: + - name: list all the persistent-storage related to an existing storage. + text: az spring-cloud storage list-persistent-storage -g MyResourceGroup -s MyService -n MyStorageName +""" + +helps['spring-cloud app'] = """ + type: group + short-summary: Commands to manage apps in Azure Spring Cloud. +""" + +helps['spring-cloud app create'] = """ + type: command + short-summary: Create a new app with a default deployment in the Azure Spring Cloud. + examples: + - name: Create an app with the default configuration. + text: az spring-cloud app create -n MyApp -s MyCluster -g MyResourceGroup + - name: Create an public accessible app with 3 instances and 2 cpu cores and 3 GB of memory per instance. + text: az spring-cloud app create -n MyApp -s MyCluster -g MyResourceGroup --assign-endpoint true --cpu 2 --memory 3 --instance-count 3 +""" + +helps['spring-cloud app append-persistent-storage'] = """ + type: command + short-summary: Append a new persistent storage to an app in the Azure Spring Cloud. + examples: + - name: Append a new persistent storage to an app. + text: az spring-cloud app append-persistent-storage --persistent-storage-type AzureFileVolume --share-name MyShareName --mount-path /MyMountPath --storage-name MyStorageName -n MyApp -g MyResourceGroup -s MyService +""" + +helps['spring-cloud app update'] = """ + type: command + short-summary: Update configurations of an app. + examples: + - name: Add an environment variable for the app. + text: az spring-cloud app update -n MyApp -s MyCluster -g MyResourceGroup --env foo=bar +""" + +helps['spring-cloud app delete'] = """ + type: command + short-summary: Delete an app in the Azure Spring Cloud. +""" + +helps['spring-cloud app list'] = """ + type: command + short-summary: List all apps in the Azure Spring Cloud. + examples: + - name: Query status of persistent storage of all apps + text: az spring-cloud app list -s MyCluster -g MyResourceGroup -o json --query '[].{Name:name, PersistentStorage:properties.persistentDisk}' +""" + +helps['spring-cloud app show'] = """ + type: command + short-summary: Show the details of an app in the Azure Spring Cloud. +""" + +helps['spring-cloud app start'] = """ + type: command + short-summary: Start instances of the app, default to production deployment. +""" + +helps['spring-cloud app stop'] = """ + type: command + short-summary: Stop instances of the app, default to production deployment. +""" + +helps['spring-cloud app restart'] = """ + type: command + short-summary: Restart instances of the app, default to production deployment. +""" + +helps['spring-cloud app deploy'] = """ + type: command + short-summary: Deploy source code or pre-built binary to an app and update related configurations. + examples: + - name: Deploy source code to an app. This will pack current directory, build binary with Pivotal Build Service and then deploy to the app. + text: az spring-cloud app deploy -n MyApp -s MyCluster -g MyResourceGroup + - name: Deploy a pre-built jar to an app with jvm options and environment variables. + text: az spring-cloud app deploy -n MyApp -s MyCluster -g MyResourceGroup --jar-path app.jar --jvm-options="-XX:+UseG1GC -XX:+UseStringDeduplication" --env foo=bar + - name: Deploy source code to a specific deployment of an app. + text: az spring-cloud app deploy -n MyApp -s MyCluster -g MyResourceGroup -d green-deployment + - name: Deploy a container image on Docker Hub to an app. + text: az spring-cloud app deploy -n MyApp -s MyCluster -g MyResourceGroup --container-image contoso/your-app:v1 + - name: Deploy a container image on a private registry to an app. + text: az spring-cloud app deploy -n MyApp -s MyCluster -g MyResourceGroup --container-image contoso/your-app:v1 --container-registry myacr.azurecr.io --registry-username --registry-password +""" + +helps['spring-cloud app scale'] = """ + type: command + short-summary: Manually scale an app or its deployments. + examples: + - name: Scale up an app to 4 cpu cores and 8 Gb of memory per instance. + text: az spring-cloud app scale -n MyApp -s MyCluster -g MyResourceGroup --cpu 3 --memory 8 + - name: Scale out a deployment of the app to 5 instances. + text: az spring-cloud app scale -n MyApp -s MyCluster -g MyResourceGroup -d green-deployment --instance-count 5 +""" + +helps['spring-cloud app show-deploy-log'] = """ + type: command + short-summary: Show build log of the last deploy, only apply to source code deploy, default to production deployment. +""" + +helps['spring-cloud app log tail'] = """ + type: command + short-summary: Show logs of an app instance, logs will be streamed when setting '-f/--follow'. +""" + +helps['spring-cloud app identity'] = """ + type: group + short-summary: Manage an app's managed service identity. +""" + +helps['spring-cloud app identity assign'] = """ + type: command + short-summary: Enable managed service identity on an app. + examples: + - name: Enable the system assigned identity. + text: az spring-cloud app identity assign -n MyApp -s MyCluster -g MyResourceGroup + - name: Enable the system assigned identity on an app with the 'Reader' role. + text: az spring-cloud app identity assign -n MyApp -s MyCluster -g MyResourceGroup --role Reader --scope /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/xxxxx/providers/Microsoft.KeyVault/vaults/xxxxx +""" + +helps['spring-cloud app identity remove'] = """ + type: command + short-summary: Remove managed service identity from an app. + examples: + - name: Remove the system assigned identity from an app. + text: az spring-cloud app identity remove -n MyApp -s MyCluster -g MyResourceGroup +""" + +helps['spring-cloud app identity show'] = """ + type: command + short-summary: Display app's managed identity info. + examples: + - name: Display an app's managed identity info. + text: az spring-cloud app identity show -n MyApp -s MyCluster -g MyResourceGroup +""" + +helps['spring-cloud app set-deployment'] = """ + type: command + short-summary: Set production deployment of an app. + examples: + - name: Swap a staging deployment of an app to production. + text: az spring-cloud app set-deployment -d green-deployment -n MyApp -s MyCluster -g MyResourceGroup +""" + +helps['spring-cloud app unset-deployment'] = """ + type: command + short-summary: Unset production deployment of an app. + examples: + - name: Swap the production deployment of an app to staging if the app has the production deployment. + text: az spring-cloud app unset-deployment -n MyApp -s MyCluster -g MyResourceGroup +""" + +helps['spring-cloud app log'] = """ + type: group + short-summary: Commands to tail app instances logs with multiple options. If the app has only one instance, the instance name is optional. +""" + +helps['spring-cloud app logs'] = """ + type: command + short-summary: Show logs of an app instance, logs will be streamed when setting '-f/--follow'. +""" + +helps['spring-cloud app deployment'] = """ + type: group + short-summary: Commands to manage life cycle of deployments of an app in Azure Spring Cloud. More operations on deployments can be done on app level with parameter --deployment. e.g. az spring-cloud app deploy --deployment +""" + +helps['spring-cloud app deployment list'] = """ + type: command + short-summary: List all deployments in an app. +""" + +helps['spring-cloud app deployment show'] = """ + type: command + short-summary: Show details of a deployment. +""" + +helps['spring-cloud app deployment delete'] = """ + type: command + short-summary: Delete a deployment of the app. +""" + +helps['spring-cloud app deployment create'] = """ + type: command + short-summary: Create a staging deployment for the app. To deploy code or update setting to an existing deployment, use `az spring-cloud app deploy/update --deployment `. + examples: + - name: Deploy source code to a new deployment of an app. This will pack current directory, build binary with Pivotal Build Service and then deploy. + text: az spring-cloud app deployment create -n green-deployment --app MyApp -s MyCluster -g MyResourceGroup + - name: Deploy a pre-built jar to an app with jvm options and environment variables. + text: az spring-cloud app deployment create -n green-deployment --app MyApp -s MyCluster -g MyResourceGroup --jar-path app.jar --jvm-options="-XX:+UseG1GC -XX:+UseStringDeduplication" --env foo=bar + - name: Deploy a container image on Docker Hub to an app. + text: az spring-cloud app deployment create -n green-deployment --app MyApp -s MyCluster -g MyResourceGroup --container-image contoso/your-app:v1 + - name: Deploy a container image on a private registry to an app. + text: az spring-cloud app deployment create -n green-deployment --app MyApp -s MyCluster -g MyResourceGroup --container-image contoso/your-app:v1 --container-registry myacr.azurecr.io --registry-username --registry-password +""" + +helps['spring-cloud app deployment generate-heap-dump'] = """ + type: command + short-summary: Generate a heap dump of your target app instance to given file path. +""" + +helps['spring-cloud app deployment generate-thread-dump'] = """ + type: command + short-summary: Generate a thread dump of your target app instance to given file path. +""" + +helps['spring-cloud app deployment start-jfr'] = """ + type: command + short-summary: Start a JFR on your target app instance to given file path. +""" + +helps['spring-cloud config-server'] = """ + type: group + short-summary: (Support Standard Tier and Basic Tier) Commands to manage Config Server in Azure Spring Cloud. +""" + +helps['spring-cloud config-server show'] = """ + type: command + short-summary: Show Config Server. +""" + +helps['spring-cloud config-server set'] = """ + type: command + short-summary: Set Config Server from a yaml file. +""" + +helps['spring-cloud config-server clear'] = """ + type: command + short-summary: Erase all settings in Config Server. +""" + +helps['spring-cloud config-server git'] = """ + type: group + short-summary: Commands to manage Config Server git property in Azure Spring Cloud. +""" + +helps['spring-cloud config-server git repo'] = """ + type: group + short-summary: Commands to manage Config Server git repository in Azure Spring Cloud. +""" + +helps['spring-cloud config-server git set'] = """ + type: command + short-summary: Set git property of Config Server, will totally override the old one. +""" + +helps['spring-cloud config-server git repo add'] = """ + type: command + short-summary: Add a new repository of git property of Config Server. +""" + +helps['spring-cloud config-server git repo remove'] = """ + type: command + short-summary: Remove an existing repository of git property of Config Server. +""" + +helps['spring-cloud config-server git repo update'] = """ + type: command + short-summary: Override an existing repository of git property of Config Server, will totally override the old one. +""" + +helps['spring-cloud config-server git repo list'] = """ + type: command + short-summary: List all repositories of git property of Config Server. +""" + +helps['spring-cloud app binding'] = """ + type: group + short-summary: Commands to manage bindings with Azure Data Services, you need to manually restart app to make settings take effect. +""" + +helps['spring-cloud app binding cosmos'] = """ + type: group + short-summary: Commands to manage Azure Cosmos DB bindings. +""" + +helps['spring-cloud app binding mysql'] = """ + type: group + short-summary: Commands to manage Azure Database for MySQL bindings. +""" + +helps['spring-cloud app binding redis'] = """ + type: group + short-summary: Commands to manage Azure Cache for Redis bindings. +""" +helps['spring-cloud app binding list'] = """ + type: command + short-summary: List all service bindings in an app. +""" + +helps['spring-cloud app binding show'] = """ + type: command + short-summary: Show the details of a service binding. +""" +helps['spring-cloud app binding remove'] = """ + type: command + short-summary: Remove a service binding of the app. +""" + +helps['spring-cloud app binding cosmos add'] = """ + type: command + short-summary: Bind an Azure Cosmos DB with the app. + examples: + - name: Bind an Azure Cosmos DB. + text: az spring-cloud app binding cosmos add -n cosmosProduction --app MyApp --resource-id ${COSMOSDB_ID} --api-type mongo --database mymongo -g MyResourceGroup -s MyService +""" + +helps['spring-cloud app binding cosmos update'] = """ + type: command + short-summary: Update an Azure Cosmos DB service binding of the app. +""" + +helps['spring-cloud app binding mysql add'] = """ + type: command + short-summary: Bind an Azure Database for MySQL with the app. +""" + +helps['spring-cloud app binding mysql update'] = """ + type: command + short-summary: Update an Azure Database for MySQL service binding of the app. +""" + +helps['spring-cloud app binding redis add'] = """ + type: command + short-summary: Bind an Azure Cache for Redis with the app. +""" + +helps['spring-cloud app binding redis update'] = """ + type: command + short-summary: Update an Azure Cache for Redis service binding of the app. +""" + +helps['spring-cloud app append-loaded-public-certificate'] = """ + type: command + short-summary: Append a new loaded public certificate to an app in the Azure Spring Cloud. + examples: + - name: Append a new loaded public certificate to an app. + text: az spring-cloud app append-loaded-public-certificate --name MyApp --service MyCluster --resource-group MyResourceGroup --certificate-name MyCertName --load-trust-store true +""" + +helps['spring-cloud certificate'] = """ + type: group + short-summary: Commands to manage certificates. +""" + +helps['spring-cloud certificate add'] = """ + type: command + short-summary: Add a certificate in Azure Spring Cloud. + examples: + - name: Import certificate from key vault. + text: az spring-cloud certificate add --name MyCertName --vault-uri MyKeyVaultUri --vault-certificate-name MyKeyVaultCertName --service MyCluster --resource-group MyResourceGroup +""" + +helps['spring-cloud certificate show'] = """ + type: command + short-summary: Show a certificate in Azure Spring Cloud. +""" + +helps['spring-cloud certificate list'] = """ + type: command + short-summary: List all certificates in Azure Spring Cloud. + examples: + - name: List all certificates in spring cloud service. + text: az spring-cloud certificate list --service MyCluster --resource-group MyResourceGroup -o table +""" + +helps['spring-cloud certificate remove'] = """ + type: command + short-summary: Remove a certificate in Azure Spring Cloud. +""" + +helps['spring-cloud certificate list-reference-app'] = """ + type: command + short-summary: List all the apps reference an existing certificate in the Azure Spring Cloud. + examples: + - name: List all the apps reference an existing certificate in spring cloud service. + text: az spring-cloud certificate list-reference-app --service MyCluster --resource-group MyResourceGroup --name MyCertName +""" + +helps['spring-cloud app custom-domain'] = """ + type: group + short-summary: Commands to manage custom domains. +""" + +helps['spring-cloud app custom-domain bind'] = """ + type: command + short-summary: Bind a custom domain with the app. + examples: + - name: Bind a custom domain to app. + text: az spring-cloud app custom-domain bind --domain-name MyDomainName --certificate MyCertName --app MyAppName --service MyCluster --resource-group MyResourceGroup +""" + +helps['spring-cloud app custom-domain show'] = """ + type: command + short-summary: Show details of a custom domain. +""" + +helps['spring-cloud app custom-domain list'] = """ + type: command + short-summary: List all custom domains of the app. + examples: + - name: List all custom domains of the app. + text: az spring-cloud app custom-domain list --app MyAppName --service MyCluster --resource-group MyResourceGroup -o table +""" + +helps['spring-cloud app custom-domain update'] = """ + type: command + short-summary: Update a custom domain of the app. + examples: + - name: Bind custom domain with a specified certificate. + text: az spring-cloud app custom-domain update --domain-name MyDomainName --certificate MCertName --app MyAppName --service MyCluster --resource-group MyResourceGroup +""" + +helps['spring-cloud app custom-domain unbind'] = """ + type: command + short-summary: Unbind a custom-domain of the app. +""" + +helps['spring-cloud app-insights'] = """ + type: group + short-summary: Commands to management Application Insights in Azure Spring Cloud. +""" + +helps['spring-cloud app-insights show'] = """ + type: command + short-summary: Show Application Insights settings. +""" + +helps['spring-cloud app-insights update'] = """ + type: command + short-summary: Update Application Insights settings. + examples: + - name: Enable Application Insights by using the Connection string (recommended) or Instrumentation key. + text: az spring-cloud app-insights update -n MyService -g MyResourceGroup --app-insights-key \"MyConnectionString\" --sampling-rate 100 + - name: Disable Application Insights. + text: az spring-cloud app-insights update -n MyService -g MyResourceGroup --disable +""" + +helps['spring-cloud service-registry'] = """ + type: group + short-summary: (Support Enterprise Tier Only) Commands to manage Service Registry in Azure Spring Cloud. +""" + +helps['spring-cloud service-registry show'] = """ + type: command + short-summary: Show the provisioning status and runtime status of Service Registry. +""" + +helps['spring-cloud service-registry bind'] = """ + type: command + short-summary: Bind an app to Service Registry. + examples: + - name: Bind an app to Service Registry. + text: az spring-cloud service-registry bind --app MyApp -s MyService -g MyResourceGroup +""" + +helps['spring-cloud service-registry unbind'] = """ + type: command + short-summary: Unbind an app from Service Registry. + examples: + - name: Unbind an app from Service Registry. + text: az spring-cloud service-registry unbind --app MyApp -s MyService -g MyResourceGroup +""" From d015c880ced94ec6e4c843ccb2b9e9abb851920e Mon Sep 17 00:00:00 2001 From: Pan Li Date: Fri, 7 Jan 2022 11:35:26 +0800 Subject: [PATCH 06/19] Re-add help.py Signed-off-by: Pan Li --- src/spring-cloud/azext_spring_cloud/_help.py | 300 +++++++++++++++++++ 1 file changed, 300 insertions(+) diff --git a/src/spring-cloud/azext_spring_cloud/_help.py b/src/spring-cloud/azext_spring_cloud/_help.py index ee8e057f877..fc36a351101 100644 --- a/src/spring-cloud/azext_spring_cloud/_help.py +++ b/src/spring-cloud/azext_spring_cloud/_help.py @@ -607,3 +607,303 @@ - name: Unbind an app from Service Registry. text: az spring-cloud service-registry unbind --app MyApp -s MyService -g MyResourceGroup """ + +helps['spring-cloud application-configuration-service'] = """ + type: group + short-summary: (Support Enterprise Tier Only) Commands to manage Application Configuration Service in Azure Spring Cloud. +""" + +helps['spring-cloud application-configuration-service show'] = """ + type: command + short-summary: Show the provisioning status, runtime status, and settings of Application Configuration Service. +""" + +helps['spring-cloud application-configuration-service clear'] = """ + type: command + short-summary: Reset all Application Configuration Service settings. +""" + +helps['spring-cloud application-configuration-service git'] = """ + type: group + short-summary: Commands to manage Application Configuration Service git property in Azure Spring Cloud. +""" + +helps['spring-cloud application-configuration-service git repo'] = """ + type: group + short-summary: Commands to manage Application Configuration Service git repository in Azure Spring Cloud. +""" + +helps['spring-cloud application-configuration-service git repo add'] = """ + type: command + short-summary: Add a Git property to the Application Configuration Service settings. + examples: + - name: Add a Git property. + text: az spring-cloud application-configuration-service git repo add -s MyService -g MyResourceGroup --name MyName --patterns MyPattern --uri https://MyURI --label master +""" + +helps['spring-cloud application-configuration-service git repo update'] = """ + type: command + short-summary: Update an existing Git property in the Application Configuration Service settings. + examples: + - name: Update a Git property. + text: az spring-cloud application-configuration-service git repo update -s MyService -g MyResourceGroup --name MyName --patterns MyPattern +""" + +helps['spring-cloud application-configuration-service git repo remove'] = """ + type: command + short-summary: Delete an existing Git property from the Application Configuration Service settings. + examples: + - name: Delete a Git property. + text: az spring-cloud application-configuration-service git repo remove -s MyService -g MyResourceGroup --name MyName +""" + +helps['spring-cloud application-configuration-service git repo list'] = """ + type: command + short-summary: List all Git settings of Application Configuration Service. +""" + +helps['spring-cloud application-configuration-service bind'] = """ + type: command + short-summary: Bind an app to Application Configuration Service. + examples: + - name: Bind an app to Application Configuration Service. + text: az spring-cloud application-configuration-service bind --app MyApp -s MyService -g MyResourceGroup +""" + +helps['spring-cloud application-configuration-service unbind'] = """ + type: command + short-summary: Unbind an app from Application Configuration Service. + examples: + - name: Unbind an app from Application Configuration Service. + text: az spring-cloud application-configuration-service unbind --app MyApp -s MyService -g MyResourceGroup +""" + +helps['spring-cloud gateway'] = """ + type: group + short-summary: (Support Enterprise Tier Only) Commands to manage gateway in Azure Spring Cloud. +""" + +helps['spring-cloud gateway clear'] = """ + type: command + short-summary: Clear all settings of gateway. +""" + +helps['spring-cloud gateway show'] = """ + type: command + short-summary: Show the settings, provisioning status and runtime status of gateway. +""" + +helps['spring-cloud gateway update'] = """ + type: command + short-summary: Update an existing gateway properties. + examples: + - name: Update gateway property. + text: az spring-cloud gateway update -s MyService -g MyResourceGroup --assign-endpoint true --https-only true +""" + +helps['spring-cloud gateway route-config'] = """ + type: group + short-summary: Commands to manage gateway route configs in Azure Spring Cloud. +""" + +helps['spring-cloud gateway route-config create'] = """ + type: command + short-summary: Create a gateway route config with routing rules of Json array format. + examples: + - name: Create a gateway route config targeting the app in Azure Spring Cloud. + text: az spring-cloud gateway route-config create -s MyService -g MyResourceGroup --name MyName --app-name MyApp --routes-file MyJson.json +""" + +helps['spring-cloud gateway route-config update'] = """ + type: command + short-summary: Update an existing gateway route config with routing rules of Json array format. + examples: + - name: Update an existing gateway route config targeting the app in Azure Spring Cloud. + text: az spring-cloud gateway route-config update -s MyService -g MyResourceGroup --name MyName --app-name MyApp --routes-file MyJson.json +""" + +helps['spring-cloud gateway route-config remove'] = """ + type: command + short-summary: Delete an existing gateway route config. + examples: + - name: Delete an existing gateway route config. + text: az spring-cloud gateway route-config remove -s MyService -g MyResourceGroup --name MyName +""" + +helps['spring-cloud gateway route-config show'] = """ + type: command + short-summary: Get an existing gateway route config. + examples: + - name: Get an existing gateway route config. + text: az spring-cloud gateway route-config show -s MyService -g MyResourceGroup --name MyName +""" + +helps['spring-cloud gateway route-config list'] = """ + type: command + short-summary: List all existing gateway route configs. + examples: + - name: List all existing gateway route configs. + text: az spring-cloud gateway route-config list -s MyService -g MyResourceGroup +""" + +helps['spring-cloud gateway custom-domain'] = """ + type: group + short-summary: Commands to manage custom domains for gateway. +""" + +helps['spring-cloud gateway custom-domain bind'] = """ + type: command + short-summary: Bind a custom domain with the gateway. + examples: + - name: Bind a custom domain to gateway. + text: az spring-cloud gateway custom-domain bind --domain-name MyDomainName --certificate MyCertName --service MyCluster --resource-group MyResourceGroup +""" + +helps['spring-cloud gateway custom-domain show'] = """ + type: command + short-summary: Show details of a custom domain. +""" + +helps['spring-cloud gateway custom-domain list'] = """ + type: command + short-summary: List all custom domains of the gateway. + examples: + - name: List all custom domains of the gateway. + text: az spring-cloud gateway custom-domain list --service MyCluster --resource-group MyResourceGroup +""" + +helps['spring-cloud gateway custom-domain update'] = """ + type: command + short-summary: Update a custom domain of the gateway. + examples: + - name: Bind custom domain with a specified certificate. + text: az spring-cloud gateway custom-domain update --domain-name MyDomainName --certificate MCertName --service MyCluster --resource-group MyResourceGroup +""" + +helps['spring-cloud gateway custom-domain unbind'] = """ + type: command + short-summary: Unbind a custom-domain of the gateway. +""" + +helps['spring-cloud api-portal'] = """ + type: group + short-summary: (Support Enterprise Tier Only) Commands to manage API portal in Azure Spring Cloud. +""" + +helps['spring-cloud api-portal clear'] = """ + type: command + short-summary: Clear all settings of API portal. +""" + +helps['spring-cloud api-portal show'] = """ + type: command + short-summary: Show the settings, provisioning status and runtime status of API portal. +""" + +helps['spring-cloud api-portal update'] = """ + type: command + short-summary: Update an existing API portal properties. + examples: + - name: Update API portal property. + text: az spring-cloud api-portal update -s MyService -g MyResourceGroup --assign-endpoint true --https-only true +""" + +helps['spring-cloud api-portal custom-domain'] = """ + type: group + short-summary: Commands to manage custom domains for API portal. +""" + +helps['spring-cloud api-portal custom-domain bind'] = """ + type: command + short-summary: Bind a custom domain with the API portal. + examples: + - name: Bind a custom domain to API portal. + text: az spring-cloud api-portal custom-domain bind --domain-name MyDomainName --certificate MyCertName --service MyCluster --resource-group MyResourceGroup +""" + +helps['spring-cloud api-portal custom-domain show'] = """ + type: command + short-summary: Show details of a custom domain. +""" + +helps['spring-cloud api-portal custom-domain list'] = """ + type: command + short-summary: List all custom domains of the API portal. + examples: + - name: List all custom domains of the API portal. + text: az spring-cloud api-portal custom-domain list --service MyCluster --resource-group MyResourceGroup +""" + +helps['spring-cloud api-portal custom-domain update'] = """ + type: command + short-summary: Update a custom domain of the API portal. + examples: + - name: Bind custom domain with a specified certificate. + text: az spring-cloud api-portal custom-domain update --domain-name MyDomainName --certificate MCertName --service MyCluster --resource-group MyResourceGroup +""" + +helps['spring-cloud api-portal custom-domain unbind'] = """ + type: command + short-summary: Unbind a custom-domain of the API portal. +""" + +helps['spring-cloud build-service'] = """ + type: group + short-summary: (Support Enterprise Tier Only) Commands to manage build service in Azure Spring Cloud. +""" + +helps['spring-cloud build-service builder'] = """ + type: group + short-summary: (Support Enterprise Tier Only) Commands to manage builder of build service. +""" + +helps['spring-cloud build-service builder buildpack-binding'] = """ + type: group + short-summary: (Support Enterprise Tier Only) Commands to manage buildpack-binding of builder. +""" + +helps['spring-cloud build-service builder buildpack-binding create'] = """ + type: command + short-summary: (Support Enterprise Tier Only) Create a buildpack binding. + examples: + - name: Create a buildpack binding without properties or secrets. + text: az spring-cloud build-service builder buildpack-binding create --name first-binding --builder-name first-builder --type ApplicationInsights --service MyCluster --resource-group MyResourceGroup + - name: Create a buildpack binding with only secrets. + text: az spring-cloud build-service builder buildpack-binding create --name first-binding --builder-name first-builder --type ApplicationInsights --secrets k1=v1 k2=v2 --service MyCluster --resource-group MyResourceGroup + - name: Create a buildpack binding with only properties. + text: az spring-cloud build-service builder buildpack-binding create --name first-binding --builder-name first-builder --type ApplicationInsights --properties a=b c=d --service MyCluster --resource-group MyResourceGroup + - name: Create a buildpack binding with properties and secrets. + text: az spring-cloud build-service builder buildpack-binding create --name first-binding --builder-name first-builder --type ApplicationInsights --properties a=b c=d --secrets k1=v1 k2=v2 --service MyCluster --resource-group MyResourceGroup +""" + +helps['spring-cloud build-service builder buildpack-binding set'] = """ + type: command + short-summary: (Support Enterprise Tier Only) Set a buildpack binding. + examples: + - name: Set a buildpack binding with properties and secrets. + text: az spring-cloud build-service builder buildpack-binding set --name first-binding --builder-name first-builder --type ApplicationInsights --properties a=b c=d --secrets k1=v1 k2=v2 --service MyCluster --resource-group MyResourceGroup +""" + +helps['spring-cloud build-service builder buildpack-binding show'] = """ + type: command + short-summary: (Support Enterprise Tier Only) Show a buildpack binding. The secrets will be masked. + examples: + - name: Show a buildpack binding. + text: az spring-cloud build-service builder buildpack-binding show --name first-binding --builder-name first-builder --service MyCluster --resource-group MyResourceGroup +""" + +helps['spring-cloud build-service builder buildpack-binding list'] = """ + type: command + short-summary: (Support Enterprise Tier Only) List all buildpack binding in a builder. The secrets will be masked. + examples: + - name: Show a buildpack binding. + text: az spring-cloud build-service builder buildpack-binding list --builder-name first-builder --service MyCluster --resource-group MyResourceGroup +""" + +helps['spring-cloud build-service builder buildpack-binding delete'] = """ + type: command + short-summary: (Support Enterprise Tier Only) Delete a buildpack binding. + examples: + - name: Delete a buildpack binding. + text: az spring-cloud build-service builder buildpack-binding delete --name first-binding --builder-name first-builder --service MyCluster --resource-group MyResourceGroup +""" \ No newline at end of file From 9aed17dcdaadf3817a9ec85a92906457383594f6 Mon Sep 17 00:00:00 2001 From: Pan Li Date: Fri, 7 Jan 2022 11:36:04 +0800 Subject: [PATCH 07/19] Add EOF. Signed-off-by: Pan Li --- src/spring-cloud/azext_spring_cloud/_help.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spring-cloud/azext_spring_cloud/_help.py b/src/spring-cloud/azext_spring_cloud/_help.py index fc36a351101..be833a96025 100644 --- a/src/spring-cloud/azext_spring_cloud/_help.py +++ b/src/spring-cloud/azext_spring_cloud/_help.py @@ -906,4 +906,4 @@ examples: - name: Delete a buildpack binding. text: az spring-cloud build-service builder buildpack-binding delete --name first-binding --builder-name first-builder --service MyCluster --resource-group MyResourceGroup -""" \ No newline at end of file +""" From 7941c6f38115cd9c66609067011122cc4fb42359 Mon Sep 17 00:00:00 2001 From: Pan Li Date: Fri, 7 Jan 2022 17:09:58 +0800 Subject: [PATCH 08/19] Add UT for create enterprise tier with app insights. Signed-off-by: Pan Li --- .../azext_spring_cloud/buildpack_binding.py | 5 +- .../tests/latest/test_asc_create.py | 72 ++++++++++++++++++- 2 files changed, 74 insertions(+), 3 deletions(-) diff --git a/src/spring-cloud/azext_spring_cloud/buildpack_binding.py b/src/spring-cloud/azext_spring_cloud/buildpack_binding.py index c55802f4f41..f89bf00c8af 100644 --- a/src/spring-cloud/azext_spring_cloud/buildpack_binding.py +++ b/src/spring-cloud/azext_spring_cloud/buildpack_binding.py @@ -100,6 +100,7 @@ def _get_buildpack_binding_properties(cmd, resource_group, service_name, locatio return models.BuildpackBindingProperties(binding_type="ApplicationInsights", launch_properties=launch_properties) def _create_app_insights_and_get_connection_string(cmd, resource_group, service_name, location): + try: created_app_insights = _try_create_application_insights(cmd, resource_group, service_name, location) if created_app_insights: @@ -135,6 +136,7 @@ def _get_connection_string_from_app_insights(cmd, resource_group, app_insights): def _get_app_insights_connection_string(cli_ctx, resource_group, name): appinsights_client = get_mgmt_service_client(cli_ctx, ApplicationInsightsManagementClient) appinsights = appinsights_client.components.get(resource_group, name) + if not appinsights or not appinsights.connection_string: raise ResourceNotFoundError("App Insights {} under resource group {} was not found." .format(name, resource_group)) @@ -148,7 +150,6 @@ def _try_create_application_insights(cmd, resource_group, name, location): ai_resource_group_name = resource_group ai_name = name ai_location = location - app_insights_client = get_mgmt_service_client(cmd.cli_ctx, ApplicationInsightsManagementClient) ai_properties = { "name": ai_name, @@ -158,7 +159,9 @@ def _try_create_application_insights(cmd, resource_group, name, location): "Application_Type": "web" } } + appinsights = app_insights_client.components.create_or_update(ai_resource_group_name, ai_name, ai_properties) + if not appinsights or not appinsights.connection_string: logger.warning(creation_failed_warn) return None diff --git a/src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_create.py b/src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_create.py index 53fcf2a0dd4..76f9c3dbc65 100644 --- a/src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_create.py +++ b/src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_create.py @@ -74,7 +74,7 @@ def _execute(self, resource_group, name, **kwargs): class TestSpringCloudCreateEnerprise(BasicTest): def test_asc_create_enterprise(self): - self._execute('rg', 'asc', sku=self._get_sku('Enterprise')) + self._execute('rg', 'asc', sku=self._get_sku('Enterprise'), disable_app_insights=True) resource = self.created_resource self.assertEqual('E0', resource.sku.name) self.assertEqual('Enterprise', resource.sku.tier) @@ -101,6 +101,7 @@ def _execute(self, resource_group, name, **kwargs): super()._execute(resource_group, name, client=client, **kwargs) call_args = free_mock_client.monitoring_settings.begin_update_put.call_args_list + self.assertEqual(1, len(call_args)) self.assertEqual(3, len(call_args[0][1])) self.assertEqual(resource_group, call_args[0][1]['resource_group_name']) @@ -132,4 +133,71 @@ def test_asc_create_with_AI_name(self): self.assertEqual('Standard', resource.sku.tier) self.assertEqual(False, resource.properties.zone_redundant) self.assertEqual('get-connection', self.monitoring_settings_resource.properties.app_insights_instrumentation_key) - self.assertEqual(True, self.monitoring_settings_resource.properties.trace_enabled) \ No newline at end of file + self.assertEqual(True, self.monitoring_settings_resource.properties.trace_enabled) + + +class TestSpringCloudCreateEnerpriseWithApplicationInsights(BasicTest): + def _get_application_insights_client(ctx, type): + application_insights_create_resource = mock.MagicMock() + application_insights_create_resource.connection_string = 'fake-create-connection-string' + + application_insights_get_resource = mock.MagicMock() + application_insights_get_resource.connection_string = 'fake-get-connection-string' + + free_mock_client.components.create_or_update.return_value = application_insights_create_resource + free_mock_client.components.get.return_value = application_insights_get_resource + + return free_mock_client + + def __init__(self, methodName: str = ...): + super().__init__(methodName=methodName) + self.buildpack_binding_resource = None + + @mock.patch('azext_spring_cloud.buildpack_binding.get_mgmt_service_client', _get_application_insights_client) + def _execute(self, resource_group, name, **kwargs): + client = kwargs.pop('client', None) or _get_basic_mock_client() + super()._execute(resource_group, name, client=client, **kwargs) + + call_args = client.buildpack_binding.begin_create_or_update.call_args_list + + self.assertEqual(1, len(call_args)) + self.assertEqual(2, len(call_args[0])) + self.assertEqual(resource_group, call_args[0][0][0]) + self.assertEqual(name, call_args[0][0][1]) + self.assertEqual("default", call_args[0][0][2]) + self.assertEqual("default", call_args[0][0][3]) + self.assertEqual("default", call_args[0][0][4]) + self.buildpack_binding_resource = call_args[0][0][5] + + def test_asc_create_with_application_insights_default(self): + self._execute('rg', 'asc', sku=self._get_sku('Enterprise')) + resource = self.created_resource + self.assertEqual('E0', resource.sku.name) + self.assertEqual('Enterprise', resource.sku.tier) + self.assertEqual('ApplicationInsights', self.buildpack_binding_resource.properties.binding_type) + self.assertEqual('fake-create-connection-string', + self.buildpack_binding_resource.properties.launch_properties.properties['connection-string']) + self.assertEqual(10, + self.buildpack_binding_resource.properties.launch_properties.properties['sampling-percentage']) + + def test_asc_create_with_application_insights_key(self): + self._execute('rg', 'asc', sku=self._get_sku('Enterprise'), app_insights_key='test-application-insights-key', sampling_rate=23) + resource = self.created_resource + self.assertEqual('E0', resource.sku.name) + self.assertEqual('Enterprise', resource.sku.tier) + self.assertEqual('ApplicationInsights', self.buildpack_binding_resource.properties.binding_type) + self.assertEqual('test-application-insights-key', + self.buildpack_binding_resource.properties.launch_properties.properties['connection-string']) + self.assertEqual(23, + self.buildpack_binding_resource.properties.launch_properties.properties['sampling-percentage']) + + def test_asc_create_with_application_insights_name(self): + self._execute('rg', 'asc', sku=self._get_sku('Enterprise'), app_insights='test-application-insights', sampling_rate=53) + resource = self.created_resource + self.assertEqual('E0', resource.sku.name) + self.assertEqual('Enterprise', resource.sku.tier) + self.assertEqual('ApplicationInsights', self.buildpack_binding_resource.properties.binding_type) + self.assertEqual('fake-get-connection-string', + self.buildpack_binding_resource.properties.launch_properties.properties['connection-string']) + self.assertEqual(53, + self.buildpack_binding_resource.properties.launch_properties.properties['sampling-percentage']) From 7f3ed5d6022d9668b5f42a6884c07271544519a2 Mon Sep 17 00:00:00 2001 From: Pan Li Date: Fri, 7 Jan 2022 20:04:05 +0800 Subject: [PATCH 09/19] Add record test for buildpack bindings. Signed-off-by: Pan Li --- .../recordings/test_buildpack_binding.yaml | 1487 +++++++++++++++++ .../latest/test_asc_buildpack_binding.py | 79 + 2 files changed, 1566 insertions(+) create mode 100644 src/spring-cloud/azext_spring_cloud/tests/latest/recordings/test_buildpack_binding.yaml create mode 100644 src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_buildpack_binding.py diff --git a/src/spring-cloud/azext_spring_cloud/tests/latest/recordings/test_buildpack_binding.yaml b/src/spring-cloud/azext_spring_cloud/tests/latest/recordings/test_buildpack_binding.yaml new file mode 100644 index 00000000000..66d79c7644c --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/tests/latest/recordings/test_buildpack_binding.yaml @@ -0,0 +1,1487 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding create + Connection: + - keep-alive + ParameterSetName: + - --name --type --properties --secrets -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding?api-version=2022-01-01-preview + response: + body: + string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"ed7caa979562408889414f01aa59e5de","networkProfile":{"outboundIPs":{"publicIPs":["20.120.66.58","20.120.66.69"]}},"powerState":"Running","fqdn":"test-buildpack-binding.asc-test.net"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"E0","tier":"Enterprise"},"location":"eastus","tags":null,"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding","name":"test-buildpack-binding","systemData":{"createdBy":"panli@microsoft.com","createdByType":"User","createdAt":"2022-01-07T11:10:06.9913584Z","lastModifiedBy":"panli@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-01-07T11:10:06.9913584Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '800' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:54:43 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '11999' + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding create + Connection: + - keep-alive + ParameterSetName: + - --name --type --properties --secrets -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name?api-version=2022-01-01-preview + response: + body: + string: '{"error":{"code":"NotFound","message":"KPack buildpacksBinding does + not exist","target":"default/test-binding-name","details":null}}' + headers: + cache-control: + - no-cache + content-length: + - '132' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:54:45 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 404 + message: Not Found +- request: + body: '{"properties": {"bindingType": "ApplicationInsights", "launchProperties": + {"properties": {"a": "b", "b": "c"}, "secrets": {"x": "y", "y": "z"}}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding create + Connection: + - keep-alive + Content-Length: + - '145' + Content-Type: + - application/json + ParameterSetName: + - --name --type --properties --secrets -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name?api-version=2022-01-01-preview + response: + body: + string: '{"properties":{"provisioningState":"Creating","bindingType":"ApplicationInsights","launchProperties":{"properties":{"a":"b","b":"c"},"secrets":{"x":"*","y":"*"}}},"type":"Microsoft.AppPlatform/Spring/buildServices/builders/buildpackBindings","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name","name":"test-binding-name","systemData":{"createdBy":"panli@microsoft.com","createdByType":"User","createdAt":"2022-01-07T11:54:46.3402505Z","lastModifiedBy":"panli@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-01-07T11:54:46.3402505Z"}}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-buildpack-binding/operationId/a0d1278d-55bc-47d2-9ace-7142e6bf8d78?api-version=2022-01-01-preview + cache-control: + - no-cache + content-length: + - '726' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:54:49 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/locations/eastus/operationResults/a0d1278d-55bc-47d2-9ace-7142e6bf8d78/Spring/test-buildpack-binding?api-version=2022-01-01-preview + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding create + Connection: + - keep-alive + ParameterSetName: + - --name --type --properties --secrets -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-buildpack-binding/operationId/a0d1278d-55bc-47d2-9ace-7142e6bf8d78?api-version=2022-01-01-preview + response: + body: + string: '{"id":"subscriptions/0753feba-86f1-4242-aff1-27938fb04531/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-buildpack-binding/operationId/a0d1278d-55bc-47d2-9ace-7142e6bf8d78","name":"a0d1278d-55bc-47d2-9ace-7142e6bf8d78","status":"Succeeded","startTime":"2022-01-07T11:54:50.4769869Z","endTime":"2022-01-07T11:54:57.4899293Z"}' + headers: + cache-control: + - no-cache + content-length: + - '378' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:55:21 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding create + Connection: + - keep-alive + ParameterSetName: + - --name --type --properties --secrets -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name?api-version=2022-01-01-preview + response: + body: + string: '{"properties":{"provisioningState":"Succeeded","bindingType":"ApplicationInsights","launchProperties":{"properties":{"a":"b","b":"c"},"secrets":{"x":"*","y":"*"}}},"type":"Microsoft.AppPlatform/Spring/buildServices/builders/buildpackBindings","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name","name":"test-binding-name","systemData":{"createdBy":"panli@microsoft.com","createdByType":"User","createdAt":"2022-01-07T11:54:46.3402505Z","lastModifiedBy":"panli@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-01-07T11:54:46.3402505Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '727' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:55:23 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding show + Connection: + - keep-alive + ParameterSetName: + - --name -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding?api-version=2022-01-01-preview + response: + body: + string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"ed7caa979562408889414f01aa59e5de","networkProfile":{"outboundIPs":{"publicIPs":["20.120.66.58","20.120.66.69"]}},"powerState":"Running","fqdn":"test-buildpack-binding.asc-test.net"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"E0","tier":"Enterprise"},"location":"eastus","tags":null,"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding","name":"test-buildpack-binding","systemData":{"createdBy":"panli@microsoft.com","createdByType":"User","createdAt":"2022-01-07T11:10:06.9913584Z","lastModifiedBy":"panli@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-01-07T11:10:06.9913584Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '800' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:55:25 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '11998' + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding show + Connection: + - keep-alive + ParameterSetName: + - --name -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name?api-version=2022-01-01-preview + response: + body: + string: '{"properties":{"provisioningState":"Succeeded","bindingType":"ApplicationInsights","launchProperties":{"properties":{"a":"b","b":"c"},"secrets":{"x":"*","y":"*"}}},"type":"Microsoft.AppPlatform/Spring/buildServices/builders/buildpackBindings","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name","name":"test-binding-name","systemData":{"createdBy":"panli@microsoft.com","createdByType":"User","createdAt":"2022-01-07T11:54:46.3402505Z","lastModifiedBy":"panli@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-01-07T11:54:46.3402505Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '727' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:55:28 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding show + Connection: + - keep-alive + ParameterSetName: + - --name -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name?api-version=2022-01-01-preview + response: + body: + string: '{"properties":{"provisioningState":"Succeeded","bindingType":"ApplicationInsights","launchProperties":{"properties":{"a":"b","b":"c"},"secrets":{"x":"*","y":"*"}}},"type":"Microsoft.AppPlatform/Spring/buildServices/builders/buildpackBindings","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name","name":"test-binding-name","systemData":{"createdBy":"panli@microsoft.com","createdByType":"User","createdAt":"2022-01-07T11:54:46.3402505Z","lastModifiedBy":"panli@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-01-07T11:54:46.3402505Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '727' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:55:30 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding set + Connection: + - keep-alive + ParameterSetName: + - --name --type --properties --secrets -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding?api-version=2022-01-01-preview + response: + body: + string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"ed7caa979562408889414f01aa59e5de","networkProfile":{"outboundIPs":{"publicIPs":["20.120.66.58","20.120.66.69"]}},"powerState":"Running","fqdn":"test-buildpack-binding.asc-test.net"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"E0","tier":"Enterprise"},"location":"eastus","tags":null,"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding","name":"test-buildpack-binding","systemData":{"createdBy":"panli@microsoft.com","createdByType":"User","createdAt":"2022-01-07T11:10:06.9913584Z","lastModifiedBy":"panli@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-01-07T11:10:06.9913584Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '800' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:55:32 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '11997' + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding set + Connection: + - keep-alive + ParameterSetName: + - --name --type --properties --secrets -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name?api-version=2022-01-01-preview + response: + body: + string: '{"properties":{"provisioningState":"Succeeded","bindingType":"ApplicationInsights","launchProperties":{"properties":{"a":"b","b":"c"},"secrets":{"x":"*","y":"*"}}},"type":"Microsoft.AppPlatform/Spring/buildServices/builders/buildpackBindings","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name","name":"test-binding-name","systemData":{"createdBy":"panli@microsoft.com","createdByType":"User","createdAt":"2022-01-07T11:54:46.3402505Z","lastModifiedBy":"panli@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-01-07T11:54:46.3402505Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '727' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:55:34 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 200 + message: OK +- request: + body: '{"properties": {"bindingType": "NewRelic", "launchProperties": {"properties": + {"a": "b"}, "secrets": {"c": "d"}}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding set + Connection: + - keep-alive + Content-Length: + - '114' + Content-Type: + - application/json + ParameterSetName: + - --name --type --properties --secrets -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name?api-version=2022-01-01-preview + response: + body: + string: '{"properties":{"provisioningState":"Updating","bindingType":"NewRelic","launchProperties":{"properties":{"a":"b"},"secrets":{"c":"*"}}},"type":"Microsoft.AppPlatform/Spring/buildServices/builders/buildpackBindings","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name","name":"test-binding-name","systemData":{"createdBy":"panli@microsoft.com","createdByType":"User","createdAt":"2022-01-07T11:54:46.3402505Z","lastModifiedBy":"panli@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-01-07T11:55:36.0622673Z"}}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-buildpack-binding/operationId/a6bdf74b-39a8-425e-9cdc-11c4ba49143b?api-version=2022-01-01-preview + cache-control: + - no-cache + content-length: + - '699' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:55:40 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/locations/eastus/operationResults/a6bdf74b-39a8-425e-9cdc-11c4ba49143b/Spring/test-buildpack-binding?api-version=2022-01-01-preview + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding set + Connection: + - keep-alive + ParameterSetName: + - --name --type --properties --secrets -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-buildpack-binding/operationId/a6bdf74b-39a8-425e-9cdc-11c4ba49143b?api-version=2022-01-01-preview + response: + body: + string: '{"id":"subscriptions/0753feba-86f1-4242-aff1-27938fb04531/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-buildpack-binding/operationId/a6bdf74b-39a8-425e-9cdc-11c4ba49143b","name":"a6bdf74b-39a8-425e-9cdc-11c4ba49143b","status":"Succeeded","startTime":"2022-01-07T11:55:40.4735174Z","endTime":"2022-01-07T11:55:50.4056357Z"}' + headers: + cache-control: + - no-cache + content-length: + - '378' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:56:11 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding set + Connection: + - keep-alive + ParameterSetName: + - --name --type --properties --secrets -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name?api-version=2022-01-01-preview + response: + body: + string: '{"properties":{"provisioningState":"Succeeded","bindingType":"NewRelic","launchProperties":{"properties":{"a":"b"},"secrets":{"c":"*"}}},"type":"Microsoft.AppPlatform/Spring/buildServices/builders/buildpackBindings","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name","name":"test-binding-name","systemData":{"createdBy":"panli@microsoft.com","createdByType":"User","createdAt":"2022-01-07T11:54:46.3402505Z","lastModifiedBy":"panli@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-01-07T11:55:36.0622673Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '700' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:56:15 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding delete + Connection: + - keep-alive + ParameterSetName: + - --name -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding?api-version=2022-01-01-preview + response: + body: + string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"ed7caa979562408889414f01aa59e5de","networkProfile":{"outboundIPs":{"publicIPs":["20.120.66.58","20.120.66.69"]}},"powerState":"Running","fqdn":"test-buildpack-binding.asc-test.net"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"E0","tier":"Enterprise"},"location":"eastus","tags":null,"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding","name":"test-buildpack-binding","systemData":{"createdBy":"panli@microsoft.com","createdByType":"User","createdAt":"2022-01-07T11:10:06.9913584Z","lastModifiedBy":"panli@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-01-07T11:10:06.9913584Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '800' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:56:17 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '11997' + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding delete + Connection: + - keep-alive + ParameterSetName: + - --name -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name?api-version=2022-01-01-preview + response: + body: + string: '{"properties":{"provisioningState":"Succeeded","bindingType":"NewRelic","launchProperties":{"properties":{"a":"b"},"secrets":{"c":"*"}}},"type":"Microsoft.AppPlatform/Spring/buildServices/builders/buildpackBindings","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name","name":"test-binding-name","systemData":{"createdBy":"panli@microsoft.com","createdByType":"User","createdAt":"2022-01-07T11:54:46.3402505Z","lastModifiedBy":"panli@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-01-07T11:55:36.0622673Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '700' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:56:19 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --name -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name?api-version=2022-01-01-preview + response: + body: + string: '' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-buildpack-binding/operationId/8cc21ac2-d90c-4a5c-a985-18bfe7faccba?api-version=2022-01-01-preview + cache-control: + - no-cache + content-length: + - '0' + date: + - Fri, 07 Jan 2022 11:56:23 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/locations/eastus/operationResults/8cc21ac2-d90c-4a5c-a985-18bfe7faccba/Spring/test-buildpack-binding?api-version=2022-01-01-preview + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding delete + Connection: + - keep-alive + ParameterSetName: + - --name -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-buildpack-binding/operationId/8cc21ac2-d90c-4a5c-a985-18bfe7faccba?api-version=2022-01-01-preview + response: + body: + string: '{"id":"subscriptions/0753feba-86f1-4242-aff1-27938fb04531/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-buildpack-binding/operationId/8cc21ac2-d90c-4a5c-a985-18bfe7faccba","name":"8cc21ac2-d90c-4a5c-a985-18bfe7faccba","status":"Succeeded","startTime":"2022-01-07T11:56:23.4616931Z","endTime":"2022-01-07T11:56:30.3724245Z"}' + headers: + cache-control: + - no-cache + content-length: + - '378' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:56:53 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding create + Connection: + - keep-alive + ParameterSetName: + - --name --type --properties --secrets -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding?api-version=2022-01-01-preview + response: + body: + string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"ed7caa979562408889414f01aa59e5de","networkProfile":{"outboundIPs":{"publicIPs":["20.120.66.58","20.120.66.69"]}},"powerState":"Running","fqdn":"test-buildpack-binding.asc-test.net"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"E0","tier":"Enterprise"},"location":"eastus","tags":null,"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding","name":"test-buildpack-binding","systemData":{"createdBy":"panli@microsoft.com","createdByType":"User","createdAt":"2022-01-07T11:10:06.9913584Z","lastModifiedBy":"panli@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-01-07T11:10:06.9913584Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '800' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:56:54 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '11997' + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding create + Connection: + - keep-alive + ParameterSetName: + - --name --type --properties --secrets -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name-0?api-version=2022-01-01-preview + response: + body: + string: '{"error":{"code":"NotFound","message":"KPack buildpacksBinding does + not exist","target":"default/test-binding-name-0","details":null}}' + headers: + cache-control: + - no-cache + content-length: + - '134' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:56:58 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 404 + message: Not Found +- request: + body: '{"properties": {"bindingType": "ApplicationInsights", "launchProperties": + {"properties": {"a": "b", "b": "c"}, "secrets": {"x": "y", "y": "z"}}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding create + Connection: + - keep-alive + Content-Length: + - '145' + Content-Type: + - application/json + ParameterSetName: + - --name --type --properties --secrets -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name-0?api-version=2022-01-01-preview + response: + body: + string: '{"properties":{"provisioningState":"Creating","bindingType":"ApplicationInsights","launchProperties":{"properties":{"a":"b","b":"c"},"secrets":{"x":"*","y":"*"}}},"type":"Microsoft.AppPlatform/Spring/buildServices/builders/buildpackBindings","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name-0","name":"test-binding-name-0","systemData":{"createdBy":"panli@microsoft.com","createdByType":"User","createdAt":"2022-01-07T11:56:58.77283Z","lastModifiedBy":"panli@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-01-07T11:56:58.77283Z"}}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-buildpack-binding/operationId/af0e6ea7-6203-49b0-a78e-7ba9e78ccdbf?api-version=2022-01-01-preview + cache-control: + - no-cache + content-length: + - '726' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:57:01 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/locations/eastus/operationResults/af0e6ea7-6203-49b0-a78e-7ba9e78ccdbf/Spring/test-buildpack-binding?api-version=2022-01-01-preview + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding create + Connection: + - keep-alive + ParameterSetName: + - --name --type --properties --secrets -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-buildpack-binding/operationId/af0e6ea7-6203-49b0-a78e-7ba9e78ccdbf?api-version=2022-01-01-preview + response: + body: + string: '{"id":"subscriptions/0753feba-86f1-4242-aff1-27938fb04531/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-buildpack-binding/operationId/af0e6ea7-6203-49b0-a78e-7ba9e78ccdbf","name":"af0e6ea7-6203-49b0-a78e-7ba9e78ccdbf","status":"Succeeded","startTime":"2022-01-07T11:57:01.45146Z","endTime":"2022-01-07T11:57:09.5464218Z"}' + headers: + cache-control: + - no-cache + content-length: + - '376' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:57:31 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding create + Connection: + - keep-alive + ParameterSetName: + - --name --type --properties --secrets -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name-0?api-version=2022-01-01-preview + response: + body: + string: '{"properties":{"provisioningState":"Succeeded","bindingType":"ApplicationInsights","launchProperties":{"properties":{"a":"b","b":"c"},"secrets":{"x":"*","y":"*"}}},"type":"Microsoft.AppPlatform/Spring/buildServices/builders/buildpackBindings","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name-0","name":"test-binding-name-0","systemData":{"createdBy":"panli@microsoft.com","createdByType":"User","createdAt":"2022-01-07T11:56:58.77283Z","lastModifiedBy":"panli@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-01-07T11:56:58.77283Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '727' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:57:34 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding create + Connection: + - keep-alive + ParameterSetName: + - --name --type --properties --secrets -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding?api-version=2022-01-01-preview + response: + body: + string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"ed7caa979562408889414f01aa59e5de","networkProfile":{"outboundIPs":{"publicIPs":["20.120.66.58","20.120.66.69"]}},"powerState":"Running","fqdn":"test-buildpack-binding.asc-test.net"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"E0","tier":"Enterprise"},"location":"eastus","tags":null,"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding","name":"test-buildpack-binding","systemData":{"createdBy":"panli@microsoft.com","createdByType":"User","createdAt":"2022-01-07T11:10:06.9913584Z","lastModifiedBy":"panli@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-01-07T11:10:06.9913584Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '800' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:57:36 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '11999' + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding create + Connection: + - keep-alive + ParameterSetName: + - --name --type --properties --secrets -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name-1?api-version=2022-01-01-preview + response: + body: + string: '{"error":{"code":"NotFound","message":"KPack buildpacksBinding does + not exist","target":"default/test-binding-name-1","details":null}}' + headers: + cache-control: + - no-cache + content-length: + - '134' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:57:38 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 404 + message: Not Found +- request: + body: '{"properties": {"bindingType": "NewRelic", "launchProperties": {"properties": + {"a": "b", "b": "c"}, "secrets": {"x": "y", "y": "z"}}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding create + Connection: + - keep-alive + Content-Length: + - '134' + Content-Type: + - application/json + ParameterSetName: + - --name --type --properties --secrets -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name-1?api-version=2022-01-01-preview + response: + body: + string: '{"properties":{"provisioningState":"Creating","bindingType":"NewRelic","launchProperties":{"properties":{"a":"b","b":"c"},"secrets":{"x":"*","y":"*"}}},"type":"Microsoft.AppPlatform/Spring/buildServices/builders/buildpackBindings","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name-1","name":"test-binding-name-1","systemData":{"createdBy":"panli@microsoft.com","createdByType":"User","createdAt":"2022-01-07T11:57:39.2402412Z","lastModifiedBy":"panli@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-01-07T11:57:39.2402412Z"}}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-buildpack-binding/operationId/72f81f61-7e9d-446e-aef4-79a5f07d6546?api-version=2022-01-01-preview + cache-control: + - no-cache + content-length: + - '719' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:57:43 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/locations/eastus/operationResults/72f81f61-7e9d-446e-aef4-79a5f07d6546/Spring/test-buildpack-binding?api-version=2022-01-01-preview + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding create + Connection: + - keep-alive + ParameterSetName: + - --name --type --properties --secrets -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-buildpack-binding/operationId/72f81f61-7e9d-446e-aef4-79a5f07d6546?api-version=2022-01-01-preview + response: + body: + string: '{"id":"subscriptions/0753feba-86f1-4242-aff1-27938fb04531/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-buildpack-binding/operationId/72f81f61-7e9d-446e-aef4-79a5f07d6546","name":"72f81f61-7e9d-446e-aef4-79a5f07d6546","status":"Succeeded","startTime":"2022-01-07T11:57:43.2250279Z","endTime":"2022-01-07T11:57:50.9028007Z"}' + headers: + cache-control: + - no-cache + content-length: + - '378' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:58:13 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding create + Connection: + - keep-alive + ParameterSetName: + - --name --type --properties --secrets -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name-1?api-version=2022-01-01-preview + response: + body: + string: '{"properties":{"provisioningState":"Succeeded","bindingType":"NewRelic","launchProperties":{"properties":{"a":"b","b":"c"},"secrets":{"x":"*","y":"*"}}},"type":"Microsoft.AppPlatform/Spring/buildServices/builders/buildpackBindings","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name-1","name":"test-binding-name-1","systemData":{"createdBy":"panli@microsoft.com","createdByType":"User","createdAt":"2022-01-07T11:57:39.2402412Z","lastModifiedBy":"panli@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-01-07T11:57:39.2402412Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '720' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:58:15 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding list + Connection: + - keep-alive + ParameterSetName: + - -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding?api-version=2022-01-01-preview + response: + body: + string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"ed7caa979562408889414f01aa59e5de","networkProfile":{"outboundIPs":{"publicIPs":["20.120.66.58","20.120.66.69"]}},"powerState":"Running","fqdn":"test-buildpack-binding.asc-test.net"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"E0","tier":"Enterprise"},"location":"eastus","tags":null,"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding","name":"test-buildpack-binding","systemData":{"createdBy":"panli@microsoft.com","createdByType":"User","createdAt":"2022-01-07T11:10:06.9913584Z","lastModifiedBy":"panli@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-01-07T11:10:06.9913584Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '800' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:58:17 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '11996' + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - spring-cloud build-service builder buildpack-binding list + Connection: + - keep-alive + ParameterSetName: + - -g -s + User-Agent: + - AZURECLI/2.32.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.9 (Windows-10-10.0.19044-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings?api-version=2022-01-01-preview + response: + body: + string: '{"value":[{"properties":{"provisioningState":"Succeeded","bindingType":"ApplicationInsights","launchProperties":{"properties":{"a":"b","b":"c"},"secrets":{"x":"*","y":"*"}}},"type":"Microsoft.AppPlatform/Spring/buildServices/builders/buildpackBindings","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name-0","name":"test-binding-name-0","systemData":{"createdBy":"panli@microsoft.com","createdByType":"User","createdAt":"2022-01-07T11:56:58.77283Z","lastModifiedBy":"panli@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-01-07T11:56:58.77283Z"}},{"properties":{"provisioningState":"Succeeded","bindingType":"NewRelic","launchProperties":{"properties":{"a":"b","b":"c"},"secrets":{"x":"*","y":"*"}}},"type":"Microsoft.AppPlatform/Spring/buildServices/builders/buildpackBindings","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/enterprise-test/providers/Microsoft.AppPlatform/Spring/test-buildpack-binding/buildServices/default/builders/default/buildpackBindings/test-binding-name-1","name":"test-binding-name-1","systemData":{"createdBy":"panli@microsoft.com","createdByType":"User","createdAt":"2022-01-07T11:57:39.2402412Z","lastModifiedBy":"panli@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-01-07T11:57:39.2402412Z"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '1460' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 07 Jan 2022 11:58:20 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:ccd65fc4-7cd4-497e-8dc8-9a76e9a43ae2 + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 8aeaf7a0-9097-4412-a5ee-7737152dd344 + status: + code: 200 + message: OK +version: 1 diff --git a/src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_buildpack_binding.py b/src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_buildpack_binding.py new file mode 100644 index 00000000000..d329206af2b --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_buildpack_binding.py @@ -0,0 +1,79 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +import os +import json +from azure.cli.testsdk import (ScenarioTest, record_only) +from knack.log import get_logger + +# pylint: disable=line-too-long +# pylint: disable=too-many-lines + +logger = get_logger(__name__) + +@record_only() +class BuildpackBindingTest(ScenarioTest): + + def test_buildpack_binding(self): + py_path = os.path.abspath(os.path.dirname(__file__)) + + self.kwargs.update({ + 'serviceName': 'test-buildpack-binding', + 'rg': 'enterprise-test', + 'bindingName': "test-binding-name", + 'bindingType': "ApplicationInsights", + 'properties': "a=b b=c", + 'secrets': "x=y y=z", + 'builderName': "test-builder-name", + }) + + logger.warning("=======================") + + self.cmd('spring-cloud build-service builder buildpack-binding create --name {bindingName} --type {bindingType} \ + --properties {properties} --secrets {secrets} -g {rg} -s {serviceName}', + checks=[ + self.check('properties.provisioningState', 'Succeeded'), + self.check('properties.bindingType', 'ApplicationInsights'), + self.check('properties.launchProperties.properties', {'a': 'b', 'b': 'c'}), + self.check('properties.launchProperties.secrets', {'x': '*', 'y': '*'}), + ]) + + self.cmd('spring-cloud build-service builder buildpack-binding show --name {bindingName} -g {rg} -s {serviceName}', + checks=[ + self.check('properties.provisioningState', 'Succeeded'), + self.check('properties.bindingType', 'ApplicationInsights'), + ]) + + self.cmd('spring-cloud build-service builder buildpack-binding set --name {bindingName} --type NewRelic \ + --properties a=b --secrets c=d -g {rg} -s {serviceName}', + checks=[ + self.check('properties.provisioningState', 'Succeeded'), + self.check('properties.bindingType', 'NewRelic'), + self.check('properties.launchProperties.properties', {'a': 'b'}), + self.check('properties.launchProperties.secrets', {'c': '*'}), + ]) + + self.cmd('spring-cloud build-service builder buildpack-binding delete --name {bindingName} -g {rg} -s {serviceName}') + + self.cmd('spring-cloud build-service builder buildpack-binding create --name {bindingName}-0 --type ApplicationInsights \ + --properties {properties} --secrets {secrets} -g {rg} -s {serviceName}', + checks=[ + self.check('properties.provisioningState', 'Succeeded'), + self.check('properties.bindingType', 'ApplicationInsights'), + self.check('properties.launchProperties.properties', {'a': 'b', 'b': 'c'}), + self.check('properties.launchProperties.secrets', {'x': '*', 'y': '*'}), + ]) + + self.cmd('spring-cloud build-service builder buildpack-binding create --name {bindingName}-1 --type NewRelic \ + --properties {properties} --secrets {secrets} -g {rg} -s {serviceName}', + checks=[ + self.check('properties.provisioningState', 'Succeeded'), + self.check('properties.bindingType', 'NewRelic'), + self.check('properties.launchProperties.properties', {'a': 'b', 'b': 'c'}), + self.check('properties.launchProperties.secrets', {'x': '*', 'y': '*'}), + ]) + + results = self.cmd('spring-cloud build-service builder buildpack-binding list -g {rg} -s {serviceName}').get_output_in_json() + self.assertEqual(2, len(results)) \ No newline at end of file From e689778b20d38eb75f11d5dd786ac86c0113b999 Mon Sep 17 00:00:00 2001 From: Pan Li Date: Mon, 10 Jan 2022 09:47:59 +0800 Subject: [PATCH 10/19] Resolve comments. Signed-off-by: Pan Li --- src/spring-cloud/azext_spring_cloud/_params.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/spring-cloud/azext_spring_cloud/_params.py b/src/spring-cloud/azext_spring_cloud/_params.py index 2dc94700d57..c87545736a2 100644 --- a/src/spring-cloud/azext_spring_cloud/_params.py +++ b/src/spring-cloud/azext_spring_cloud/_params.py @@ -524,7 +524,7 @@ def prepare_logs_argument(c): 'Format "key[=value]".', nargs='*', validator=validate_buildpack_binding_secrets) - c.argument('name', help='Name for buildpack binding.', validator=validate_buildpack_binding_not_exist) + c.argument('name', name_type, help='Name for buildpack binding.', validator=validate_buildpack_binding_not_exist) c.argument('builder_name', help='The name for builder.', default="default") c.argument('service', service_name_type, validator=only_support_enterprise) @@ -544,7 +544,7 @@ def prepare_logs_argument(c): 'Format "key[=value]".', nargs='*', validator=validate_buildpack_binding_secrets) - c.argument('name', help='Name for buildpack binding.', validator=validate_buildpack_binding_exist) + c.argument('name', name_type, help='Name for buildpack binding.', validator=validate_buildpack_binding_exist) c.argument('builder_name', help='The name for builder.', default="default") c.argument('service', service_name_type, validator=only_support_enterprise) @@ -552,7 +552,7 @@ def prepare_logs_argument(c): for scope in ['spring-cloud build-service builder buildpack-binding show', 'spring-cloud build-service builder buildpack-binding delete']: with self.argument_context(scope) as c: - c.argument('name', help='Name for buildpack binding.', validator=validate_buildpack_binding_exist) + c.argument('name', name_type, help='Name for buildpack binding.', validator=validate_buildpack_binding_exist) c.argument('builder_name', help='The name for builder.', default="default") c.argument('service', service_name_type, validator=only_support_enterprise) From 135aa2c479db76425c5c41759b12cea3351a7542 Mon Sep 17 00:00:00 2001 From: Pan Li Date: Mon, 10 Jan 2022 09:50:16 +0800 Subject: [PATCH 11/19] Resolve comments. Signed-off-by: Pan Li --- .../azext_spring_cloud/_validators_enterprise.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/spring-cloud/azext_spring_cloud/_validators_enterprise.py b/src/spring-cloud/azext_spring_cloud/_validators_enterprise.py index 953709437aa..e31052bdc85 100644 --- a/src/spring-cloud/azext_spring_cloud/_validators_enterprise.py +++ b/src/spring-cloud/azext_spring_cloud/_validators_enterprise.py @@ -150,9 +150,9 @@ def validate_buildpack_binding_not_exist(cmd, namespace): namespace.builder_name, namespace.name) if binding_resource is not None: - raise CLIError('buildpack Binding {} in builder {} already exists ' - 'in resource group {}, service {}. You can edit it by set command.' - .format(namespace.name, namespace.resource_group, namespace.service, namespace.builder_name)) + raise ClientRequestError('buildpack Binding {} in builder {} already exists ' + 'in resource group {}, service {}. You can edit it by set command.' + .format(namespace.name, namespace.resource_group, namespace.service, namespace.builder_name)) except ResourceNotFoundError: # Excepted case pass From d374d52151ca368f8bc0a28af6e087954c16e50a Mon Sep 17 00:00:00 2001 From: Pan Li Date: Mon, 10 Jan 2022 11:09:48 +0800 Subject: [PATCH 12/19] Resolve comments and make static check happy. Signed-off-by: Pan Li --- src/spring-cloud/azext_spring_cloud/_help.py | 2 +- src/spring-cloud/azext_spring_cloud/_params.py | 2 -- .../azext_spring_cloud/_validators_enterprise.py | 1 - src/spring-cloud/azext_spring_cloud/buildpack_binding.py | 8 ++++---- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/spring-cloud/azext_spring_cloud/_help.py b/src/spring-cloud/azext_spring_cloud/_help.py index be833a96025..b3dc59f82ea 100644 --- a/src/spring-cloud/azext_spring_cloud/_help.py +++ b/src/spring-cloud/azext_spring_cloud/_help.py @@ -896,7 +896,7 @@ type: command short-summary: (Support Enterprise Tier Only) List all buildpack binding in a builder. The secrets will be masked. examples: - - name: Show a buildpack binding. + - name: List all buildpack binding of a builder. text: az spring-cloud build-service builder buildpack-binding list --builder-name first-builder --service MyCluster --resource-group MyResourceGroup """ diff --git a/src/spring-cloud/azext_spring_cloud/_params.py b/src/spring-cloud/azext_spring_cloud/_params.py index c87545736a2..25081f08967 100644 --- a/src/spring-cloud/azext_spring_cloud/_params.py +++ b/src/spring-cloud/azext_spring_cloud/_params.py @@ -528,7 +528,6 @@ def prepare_logs_argument(c): c.argument('builder_name', help='The name for builder.', default="default") c.argument('service', service_name_type, validator=only_support_enterprise) - for scope in ['spring-cloud build-service builder buildpack-binding set']: with self.argument_context(scope) as c: c.argument('type', @@ -548,7 +547,6 @@ def prepare_logs_argument(c): c.argument('builder_name', help='The name for builder.', default="default") c.argument('service', service_name_type, validator=only_support_enterprise) - for scope in ['spring-cloud build-service builder buildpack-binding show', 'spring-cloud build-service builder buildpack-binding delete']: with self.argument_context(scope) as c: diff --git a/src/spring-cloud/azext_spring_cloud/_validators_enterprise.py b/src/spring-cloud/azext_spring_cloud/_validators_enterprise.py index e31052bdc85..0d1f675e891 100644 --- a/src/spring-cloud/azext_spring_cloud/_validators_enterprise.py +++ b/src/spring-cloud/azext_spring_cloud/_validators_enterprise.py @@ -8,7 +8,6 @@ from re import match from azure.cli.core.commands.validators import validate_tag from azure.core.exceptions import ResourceNotFoundError -from azure.cli.core.util import CLIError from azure.cli.core.azclierror import (ArgumentUsageError, ClientRequestError, InvalidArgumentValueError, MutuallyExclusiveArgumentError) diff --git a/src/spring-cloud/azext_spring_cloud/buildpack_binding.py b/src/spring-cloud/azext_spring_cloud/buildpack_binding.py index f89bf00c8af..b72296c38b8 100644 --- a/src/spring-cloud/azext_spring_cloud/buildpack_binding.py +++ b/src/spring-cloud/azext_spring_cloud/buildpack_binding.py @@ -22,7 +22,7 @@ def create_or_update_buildpack_binding(cmd, client, resource_group, service, - name, type, builder_name=None, properties=None, secrets=None): + name, type, builder_name=None, properties=None, secrets=None): if not builder_name: builder_name = DEFAULT_BUILDER_NAME logger.warning('Option --builder-name is not provided, will use default builder name "{}".'.format(builder_name)) @@ -31,7 +31,7 @@ def create_or_update_buildpack_binding(cmd, client, resource_group, service, binding_resource = _build_buildpack_binding_resource(type, properties, secrets) return sdk_no_wait(False, client.buildpack_binding.begin_create_or_update, resource_group, - service, DEFAULT_BUILD_SERVICE_NAME, builder_name, name, binding_resource) + service, DEFAULT_BUILD_SERVICE_NAME, builder_name, name, binding_resource) def buildpack_binding_show(cmd, client, resource_group, service, name, builder_name=None): @@ -74,9 +74,9 @@ def create_default_buildpack_binding_for_application_insights(cmd, client, resou def _build_buildpack_binding_resource(binding_type, properties_dict, secrets_dict): launch_properties = models.BuildpackBindingLaunchProperties(properties=properties_dict, - secrets=secrets_dict) + secrets=secrets_dict) binding_properties = models.BuildpackBindingProperties(binding_type=binding_type, - launch_properties=launch_properties) + launch_properties=launch_properties) return models.BuildpackBindingResource(properties=binding_properties) From 59d3690da5dbd0498da8194523f8421ef5a70994 Mon Sep 17 00:00:00 2001 From: Pan Li Date: Mon, 10 Jan 2022 11:24:40 +0800 Subject: [PATCH 13/19] Make static check happy. Signed-off-by: Pan Li --- src/spring-cloud/azext_spring_cloud/buildpack_binding.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/spring-cloud/azext_spring_cloud/buildpack_binding.py b/src/spring-cloud/azext_spring_cloud/buildpack_binding.py index b72296c38b8..0634c2c27e1 100644 --- a/src/spring-cloud/azext_spring_cloud/buildpack_binding.py +++ b/src/spring-cloud/azext_spring_cloud/buildpack_binding.py @@ -72,6 +72,7 @@ def create_default_buildpack_binding_for_application_insights(cmd, client, resou return client.buildpack_binding.begin_create_or_update(resource_group, name, DEFAULT_BUILD_SERVICE_NAME, DEFAULT_BUILDER_NAME, DEFAULT_BINDING_NAME, binding_resource) + def _build_buildpack_binding_resource(binding_type, properties_dict, secrets_dict): launch_properties = models.BuildpackBindingLaunchProperties(properties=properties_dict, secrets=secrets_dict) @@ -90,7 +91,7 @@ def _get_buildpack_binding_properties(cmd, resource_group, service_name, locatio if not connection_string: raise InvalidArgumentValueError('Error while trying to get the ConnectionString of Application Insights for the Azure Spring Cloud. ' - 'Please use the Azure Portal to create and configure the Application Insights, if needed.') + 'Please use the Azure Portal to create and configure the Application Insights, if needed.') launch_properties = models.BuildpackBindingLaunchProperties(properties={ "connection-string": connection_string, @@ -99,6 +100,7 @@ def _get_buildpack_binding_properties(cmd, resource_group, service_name, locatio return models.BuildpackBindingProperties(binding_type="ApplicationInsights", launch_properties=launch_properties) + def _create_app_insights_and_get_connection_string(cmd, resource_group, service_name, location): try: @@ -111,6 +113,7 @@ def _create_app_insights_and_get_connection_string(cmd, resource_group, service_ 'Please use the Azure Portal to create and configure the Application Insights, if needed.') return None + def _get_connection_string_from_app_insights(cmd, resource_group, app_insights): """Get connection string from: 1) application insights name @@ -133,6 +136,7 @@ def _get_connection_string_from_app_insights(cmd, resource_group, app_insights): return connection_string + def _get_app_insights_connection_string(cli_ctx, resource_group, name): appinsights_client = get_mgmt_service_client(cli_ctx, ApplicationInsightsManagementClient) appinsights = appinsights_client.components.get(resource_group, name) @@ -142,6 +146,7 @@ def _get_app_insights_connection_string(cli_ctx, resource_group, name): .format(name, resource_group)) return appinsights.connection_string + def _try_create_application_insights(cmd, resource_group, name, location): creation_failed_warn = 'Unable to create the Application Insights for the Azure Spring Cloud. ' \ 'Please use the Azure Portal to manually create and configure the Application Insights, ' \ @@ -172,4 +177,4 @@ def _try_create_application_insights(cmd, resource_group, name, location): 'You can visit %s/#resource%s/overview to view your ' 'Application Insights component', appinsights.name, portal_url, appinsights.id) - return appinsights \ No newline at end of file + return appinsights From 5211830b84db5ab73325573fcc20447d838613d3 Mon Sep 17 00:00:00 2001 From: Pan Li Date: Mon, 10 Jan 2022 11:34:28 +0800 Subject: [PATCH 14/19] Resolve comments. Signed-off-by: Pan Li --- src/spring-cloud/azext_spring_cloud/buildpack_binding.py | 4 ++-- src/spring-cloud/azext_spring_cloud/commands.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/spring-cloud/azext_spring_cloud/buildpack_binding.py b/src/spring-cloud/azext_spring_cloud/buildpack_binding.py index 0634c2c27e1..0c0c64169e7 100644 --- a/src/spring-cloud/azext_spring_cloud/buildpack_binding.py +++ b/src/spring-cloud/azext_spring_cloud/buildpack_binding.py @@ -142,8 +142,8 @@ def _get_app_insights_connection_string(cli_ctx, resource_group, name): appinsights = appinsights_client.components.get(resource_group, name) if not appinsights or not appinsights.connection_string: - raise ResourceNotFoundError("App Insights {} under resource group {} was not found." - .format(name, resource_group)) + raise ResourceNotFoundError("App Insights {} under resource group {} was not found.".format(name, resource_group)) + return appinsights.connection_string diff --git a/src/spring-cloud/azext_spring_cloud/commands.py b/src/spring-cloud/azext_spring_cloud/commands.py index 41e44ffb4ca..fc934631362 100644 --- a/src/spring-cloud/azext_spring_cloud/commands.py +++ b/src/spring-cloud/azext_spring_cloud/commands.py @@ -287,4 +287,4 @@ def load_command_table(self, _): g.custom_command('set', 'create_or_update_buildpack_binding') g.custom_show_command('show', 'buildpack_binding_show') g.custom_command('list', 'buildpack_binding_list') - g.custom_command('delete', 'buildpack_binding_delete') + g.custom_command('delete', 'buildpack_binding_delete', confirmation=True) From bc47c3023c1af55fa4bc3b113f4b00fa2a9890ba Mon Sep 17 00:00:00 2001 From: Pan Li Date: Mon, 10 Jan 2022 11:49:24 +0800 Subject: [PATCH 15/19] Resolve comments. Signed-off-by: Pan Li --- src/spring-cloud/azext_spring_cloud/buildpack_binding.py | 2 +- .../tests/latest/test_asc_buildpack_binding.py | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/spring-cloud/azext_spring_cloud/buildpack_binding.py b/src/spring-cloud/azext_spring_cloud/buildpack_binding.py index 0c0c64169e7..1cea0145d4c 100644 --- a/src/spring-cloud/azext_spring_cloud/buildpack_binding.py +++ b/src/spring-cloud/azext_spring_cloud/buildpack_binding.py @@ -155,6 +155,7 @@ def _try_create_application_insights(cmd, resource_group, name, location): ai_resource_group_name = resource_group ai_name = name ai_location = location + app_insights_client = get_mgmt_service_client(cmd.cli_ctx, ApplicationInsightsManagementClient) ai_properties = { "name": ai_name, @@ -164,7 +165,6 @@ def _try_create_application_insights(cmd, resource_group, name, location): "Application_Type": "web" } } - appinsights = app_insights_client.components.create_or_update(ai_resource_group_name, ai_name, ai_properties) if not appinsights or not appinsights.connection_string: diff --git a/src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_buildpack_binding.py b/src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_buildpack_binding.py index d329206af2b..d93c68e6cb0 100644 --- a/src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_buildpack_binding.py +++ b/src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_buildpack_binding.py @@ -11,8 +11,6 @@ # pylint: disable=line-too-long # pylint: disable=too-many-lines -logger = get_logger(__name__) - @record_only() class BuildpackBindingTest(ScenarioTest): @@ -29,8 +27,6 @@ def test_buildpack_binding(self): 'builderName': "test-builder-name", }) - logger.warning("=======================") - self.cmd('spring-cloud build-service builder buildpack-binding create --name {bindingName} --type {bindingType} \ --properties {properties} --secrets {secrets} -g {rg} -s {serviceName}', checks=[ @@ -55,7 +51,7 @@ def test_buildpack_binding(self): self.check('properties.launchProperties.secrets', {'c': '*'}), ]) - self.cmd('spring-cloud build-service builder buildpack-binding delete --name {bindingName} -g {rg} -s {serviceName}') + self.cmd('spring-cloud build-service builder buildpack-binding delete --name {bindingName} -g {rg} -s {serviceName} --yes') self.cmd('spring-cloud build-service builder buildpack-binding create --name {bindingName}-0 --type ApplicationInsights \ --properties {properties} --secrets {secrets} -g {rg} -s {serviceName}', From cfbcab36b31c57a8b7774b0815ebf7e955fa3590 Mon Sep 17 00:00:00 2001 From: Pan Li Date: Mon, 10 Jan 2022 11:52:24 +0800 Subject: [PATCH 16/19] Replace CRLF to LF. Signed-off-by: Pan Li --- .../azext_spring_cloud/buildpack_binding.py | 360 +++++++++--------- 1 file changed, 180 insertions(+), 180 deletions(-) diff --git a/src/spring-cloud/azext_spring_cloud/buildpack_binding.py b/src/spring-cloud/azext_spring_cloud/buildpack_binding.py index 1cea0145d4c..d7a618a39d4 100644 --- a/src/spring-cloud/azext_spring_cloud/buildpack_binding.py +++ b/src/spring-cloud/azext_spring_cloud/buildpack_binding.py @@ -1,180 +1,180 @@ -# -------------------------------------------------------------------------------------------- -# 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 -from .vendored_sdks.appplatform.v2022_01_01_preview import models -from azure.cli.core.util import sdk_no_wait -from ._utils import get_portal_uri -from msrestazure.tools import parse_resource_id, is_valid_resource_id -from azure.cli.core.commands.client_factory import get_mgmt_service_client -from azure.cli.core.azclierror import InvalidArgumentValueError -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient -from azure.core.exceptions import ResourceNotFoundError -from knack.log import get_logger - -logger = get_logger(__name__) - -DEFAULT_BUILDER_NAME = "default" -DEFAULT_BINDING_NAME = "default" -DEFAULT_BUILD_SERVICE_NAME = "default" - - -def create_or_update_buildpack_binding(cmd, client, resource_group, service, - name, type, builder_name=None, properties=None, secrets=None): - if not builder_name: - builder_name = DEFAULT_BUILDER_NAME - logger.warning('Option --builder-name is not provided, will use default builder name "{}".'.format(builder_name)) - - logger.warning('[1/1] Creating or updating to buildpack binding for builder "{}", (this operation can take a while to complete).'.format(builder_name)) - - binding_resource = _build_buildpack_binding_resource(type, properties, secrets) - return sdk_no_wait(False, client.buildpack_binding.begin_create_or_update, resource_group, - service, DEFAULT_BUILD_SERVICE_NAME, builder_name, name, binding_resource) - - -def buildpack_binding_show(cmd, client, resource_group, service, name, builder_name=None): - if not builder_name: - builder_name = DEFAULT_BUILDER_NAME - logger.warning('Option --builder-name is not provided, will use default builder name "{}".'.format(builder_name)) - - return client.buildpack_binding.get(resource_group, service, DEFAULT_BUILD_SERVICE_NAME, - builder_name, name) - - -def buildpack_binding_list(cmd, client, resource_group, service, builder_name=None): - if not builder_name: - builder_name = DEFAULT_BUILDER_NAME - logger.warning('Option --builder-name is not provided, will use default builder name "{}".'.format(builder_name)) - - return client.buildpack_binding.list(resource_group, service, DEFAULT_BUILD_SERVICE_NAME, builder_name) - - -def buildpack_binding_delete(cmd, client, resource_group, service, name, builder_name=None): - if not builder_name: - builder_name = DEFAULT_BUILDER_NAME - logger.warning('Option --builder-name is not provided, will use default builder name "{}".'.format(builder_name)) - - logger.warning('[1/1] Deleting buildpack binding for builder "{}", (this operation can take a while to complete).'.format(builder_name)) - - return sdk_no_wait(False, client.buildpack_binding.begin_delete, resource_group, - service, DEFAULT_BUILD_SERVICE_NAME, builder_name, name) - - -def create_default_buildpack_binding_for_application_insights(cmd, client, resource_group, name, location, - app_insights_key, app_insights, sampling_rate): - logger.warning("Start configure Application Insights") - binding_resource = models.BuildpackBindingResource() - binding_resource.properties = _get_buildpack_binding_properties(cmd, resource_group, name, location, app_insights_key, app_insights, sampling_rate) - - if binding_resource.properties: - return client.buildpack_binding.begin_create_or_update(resource_group, name, DEFAULT_BUILD_SERVICE_NAME, - DEFAULT_BUILDER_NAME, DEFAULT_BINDING_NAME, binding_resource) - - -def _build_buildpack_binding_resource(binding_type, properties_dict, secrets_dict): - launch_properties = models.BuildpackBindingLaunchProperties(properties=properties_dict, - secrets=secrets_dict) - binding_properties = models.BuildpackBindingProperties(binding_type=binding_type, - launch_properties=launch_properties) - return models.BuildpackBindingResource(properties=binding_properties) - - -def _get_buildpack_binding_properties(cmd, resource_group, service_name, location, - app_insights_key, app_insights, sampling_rate): - - sampling_rate = sampling_rate or 10 - connection_string = app_insights_key or \ - _get_connection_string_from_app_insights(cmd, resource_group, app_insights) or \ - _create_app_insights_and_get_connection_string(cmd, resource_group, service_name, location) - - if not connection_string: - raise InvalidArgumentValueError('Error while trying to get the ConnectionString of Application Insights for the Azure Spring Cloud. ' - 'Please use the Azure Portal to create and configure the Application Insights, if needed.') - - launch_properties = models.BuildpackBindingLaunchProperties(properties={ - "connection-string": connection_string, - "sampling-percentage": sampling_rate, - }) - - return models.BuildpackBindingProperties(binding_type="ApplicationInsights", launch_properties=launch_properties) - - -def _create_app_insights_and_get_connection_string(cmd, resource_group, service_name, location): - - try: - created_app_insights = _try_create_application_insights(cmd, resource_group, service_name, location) - if created_app_insights: - return created_app_insights.connection_string - except Exception: # pylint: disable=broad-except - logger.warning( - 'Error while trying to create and configure an Application Insights for the Azure Spring Cloud. ' - 'Please use the Azure Portal to create and configure the Application Insights, if needed.') - return None - - -def _get_connection_string_from_app_insights(cmd, resource_group, app_insights): - """Get connection string from: - 1) application insights name - 2) application insights resource id - """ - - if not app_insights: - return None - - if is_valid_resource_id(app_insights): - resource_id_dict = parse_resource_id(app_insights) - connection_string = _get_app_insights_connection_string( - cmd.cli_ctx, resource_id_dict['resource_group'], resource_id_dict['resource_name']) - else: - connection_string = _get_app_insights_connection_string(cmd.cli_ctx, resource_group, app_insights) - - if not connection_string: - logger.warning( - "Cannot find Connection string from application insights:{}".format(app_insights)) - - return connection_string - - -def _get_app_insights_connection_string(cli_ctx, resource_group, name): - appinsights_client = get_mgmt_service_client(cli_ctx, ApplicationInsightsManagementClient) - appinsights = appinsights_client.components.get(resource_group, name) - - if not appinsights or not appinsights.connection_string: - raise ResourceNotFoundError("App Insights {} under resource group {} was not found.".format(name, resource_group)) - - return appinsights.connection_string - - -def _try_create_application_insights(cmd, resource_group, name, location): - creation_failed_warn = 'Unable to create the Application Insights for the Azure Spring Cloud. ' \ - 'Please use the Azure Portal to manually create and configure the Application Insights, ' \ - 'if needed.' - - ai_resource_group_name = resource_group - ai_name = name - ai_location = location - - app_insights_client = get_mgmt_service_client(cmd.cli_ctx, ApplicationInsightsManagementClient) - ai_properties = { - "name": ai_name, - "location": ai_location, - "kind": "web", - "properties": { - "Application_Type": "web" - } - } - appinsights = app_insights_client.components.create_or_update(ai_resource_group_name, ai_name, ai_properties) - - if not appinsights or not appinsights.connection_string: - logger.warning(creation_failed_warn) - return None - - portal_url = get_portal_uri(cmd.cli_ctx) - # We make this success message as a warning to no interfere with regular JSON output in stdout - logger.warning('Application Insights \"%s\" was created for this Azure Spring Cloud. ' - 'You can visit %s/#resource%s/overview to view your ' - 'Application Insights component', appinsights.name, portal_url, appinsights.id) - - return appinsights +# -------------------------------------------------------------------------------------------- +# 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 +from .vendored_sdks.appplatform.v2022_01_01_preview import models +from azure.cli.core.util import sdk_no_wait +from ._utils import get_portal_uri +from msrestazure.tools import parse_resource_id, is_valid_resource_id +from azure.cli.core.commands.client_factory import get_mgmt_service_client +from azure.cli.core.azclierror import InvalidArgumentValueError +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.core.exceptions import ResourceNotFoundError +from knack.log import get_logger + +logger = get_logger(__name__) + +DEFAULT_BUILDER_NAME = "default" +DEFAULT_BINDING_NAME = "default" +DEFAULT_BUILD_SERVICE_NAME = "default" + + +def create_or_update_buildpack_binding(cmd, client, resource_group, service, + name, type, builder_name=None, properties=None, secrets=None): + if not builder_name: + builder_name = DEFAULT_BUILDER_NAME + logger.warning('Option --builder-name is not provided, will use default builder name "{}".'.format(builder_name)) + + logger.warning('[1/1] Creating or updating to buildpack binding for builder "{}", (this operation can take a while to complete).'.format(builder_name)) + + binding_resource = _build_buildpack_binding_resource(type, properties, secrets) + return sdk_no_wait(False, client.buildpack_binding.begin_create_or_update, resource_group, + service, DEFAULT_BUILD_SERVICE_NAME, builder_name, name, binding_resource) + + +def buildpack_binding_show(cmd, client, resource_group, service, name, builder_name=None): + if not builder_name: + builder_name = DEFAULT_BUILDER_NAME + logger.warning('Option --builder-name is not provided, will use default builder name "{}".'.format(builder_name)) + + return client.buildpack_binding.get(resource_group, service, DEFAULT_BUILD_SERVICE_NAME, + builder_name, name) + + +def buildpack_binding_list(cmd, client, resource_group, service, builder_name=None): + if not builder_name: + builder_name = DEFAULT_BUILDER_NAME + logger.warning('Option --builder-name is not provided, will use default builder name "{}".'.format(builder_name)) + + return client.buildpack_binding.list(resource_group, service, DEFAULT_BUILD_SERVICE_NAME, builder_name) + + +def buildpack_binding_delete(cmd, client, resource_group, service, name, builder_name=None): + if not builder_name: + builder_name = DEFAULT_BUILDER_NAME + logger.warning('Option --builder-name is not provided, will use default builder name "{}".'.format(builder_name)) + + logger.warning('[1/1] Deleting buildpack binding for builder "{}", (this operation can take a while to complete).'.format(builder_name)) + + return sdk_no_wait(False, client.buildpack_binding.begin_delete, resource_group, + service, DEFAULT_BUILD_SERVICE_NAME, builder_name, name) + + +def create_default_buildpack_binding_for_application_insights(cmd, client, resource_group, name, location, + app_insights_key, app_insights, sampling_rate): + logger.warning("Start configure Application Insights") + binding_resource = models.BuildpackBindingResource() + binding_resource.properties = _get_buildpack_binding_properties(cmd, resource_group, name, location, app_insights_key, app_insights, sampling_rate) + + if binding_resource.properties: + return client.buildpack_binding.begin_create_or_update(resource_group, name, DEFAULT_BUILD_SERVICE_NAME, + DEFAULT_BUILDER_NAME, DEFAULT_BINDING_NAME, binding_resource) + + +def _build_buildpack_binding_resource(binding_type, properties_dict, secrets_dict): + launch_properties = models.BuildpackBindingLaunchProperties(properties=properties_dict, + secrets=secrets_dict) + binding_properties = models.BuildpackBindingProperties(binding_type=binding_type, + launch_properties=launch_properties) + return models.BuildpackBindingResource(properties=binding_properties) + + +def _get_buildpack_binding_properties(cmd, resource_group, service_name, location, + app_insights_key, app_insights, sampling_rate): + + sampling_rate = sampling_rate or 10 + connection_string = app_insights_key or \ + _get_connection_string_from_app_insights(cmd, resource_group, app_insights) or \ + _create_app_insights_and_get_connection_string(cmd, resource_group, service_name, location) + + if not connection_string: + raise InvalidArgumentValueError('Error while trying to get the ConnectionString of Application Insights for the Azure Spring Cloud. ' + 'Please use the Azure Portal to create and configure the Application Insights, if needed.') + + launch_properties = models.BuildpackBindingLaunchProperties(properties={ + "connection-string": connection_string, + "sampling-percentage": sampling_rate, + }) + + return models.BuildpackBindingProperties(binding_type="ApplicationInsights", launch_properties=launch_properties) + + +def _create_app_insights_and_get_connection_string(cmd, resource_group, service_name, location): + + try: + created_app_insights = _try_create_application_insights(cmd, resource_group, service_name, location) + if created_app_insights: + return created_app_insights.connection_string + except Exception: # pylint: disable=broad-except + logger.warning( + 'Error while trying to create and configure an Application Insights for the Azure Spring Cloud. ' + 'Please use the Azure Portal to create and configure the Application Insights, if needed.') + return None + + +def _get_connection_string_from_app_insights(cmd, resource_group, app_insights): + """Get connection string from: + 1) application insights name + 2) application insights resource id + """ + + if not app_insights: + return None + + if is_valid_resource_id(app_insights): + resource_id_dict = parse_resource_id(app_insights) + connection_string = _get_app_insights_connection_string( + cmd.cli_ctx, resource_id_dict['resource_group'], resource_id_dict['resource_name']) + else: + connection_string = _get_app_insights_connection_string(cmd.cli_ctx, resource_group, app_insights) + + if not connection_string: + logger.warning( + "Cannot find Connection string from application insights:{}".format(app_insights)) + + return connection_string + + +def _get_app_insights_connection_string(cli_ctx, resource_group, name): + appinsights_client = get_mgmt_service_client(cli_ctx, ApplicationInsightsManagementClient) + appinsights = appinsights_client.components.get(resource_group, name) + + if not appinsights or not appinsights.connection_string: + raise ResourceNotFoundError("App Insights {} under resource group {} was not found.".format(name, resource_group)) + + return appinsights.connection_string + + +def _try_create_application_insights(cmd, resource_group, name, location): + creation_failed_warn = 'Unable to create the Application Insights for the Azure Spring Cloud. ' \ + 'Please use the Azure Portal to manually create and configure the Application Insights, ' \ + 'if needed.' + + ai_resource_group_name = resource_group + ai_name = name + ai_location = location + + app_insights_client = get_mgmt_service_client(cmd.cli_ctx, ApplicationInsightsManagementClient) + ai_properties = { + "name": ai_name, + "location": ai_location, + "kind": "web", + "properties": { + "Application_Type": "web" + } + } + appinsights = app_insights_client.components.create_or_update(ai_resource_group_name, ai_name, ai_properties) + + if not appinsights or not appinsights.connection_string: + logger.warning(creation_failed_warn) + return None + + portal_url = get_portal_uri(cmd.cli_ctx) + # We make this success message as a warning to no interfere with regular JSON output in stdout + logger.warning('Application Insights \"%s\" was created for this Azure Spring Cloud. ' + 'You can visit %s/#resource%s/overview to view your ' + 'Application Insights component', appinsights.name, portal_url, appinsights.id) + + return appinsights From 20ed90576051ae617398c88a02bdbd106169d591 Mon Sep 17 00:00:00 2001 From: Pan Li Date: Mon, 10 Jan 2022 14:13:55 +0800 Subject: [PATCH 17/19] Minor change format. Signed-off-by: Pan Li --- src/spring-cloud/azext_spring_cloud/buildpack_binding.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/spring-cloud/azext_spring_cloud/buildpack_binding.py b/src/spring-cloud/azext_spring_cloud/buildpack_binding.py index d7a618a39d4..8033ea7915c 100644 --- a/src/spring-cloud/azext_spring_cloud/buildpack_binding.py +++ b/src/spring-cloud/azext_spring_cloud/buildpack_binding.py @@ -155,8 +155,6 @@ def _try_create_application_insights(cmd, resource_group, name, location): ai_resource_group_name = resource_group ai_name = name ai_location = location - - app_insights_client = get_mgmt_service_client(cmd.cli_ctx, ApplicationInsightsManagementClient) ai_properties = { "name": ai_name, "location": ai_location, @@ -165,6 +163,8 @@ def _try_create_application_insights(cmd, resource_group, name, location): "Application_Type": "web" } } + + app_insights_client = get_mgmt_service_client(cmd.cli_ctx, ApplicationInsightsManagementClient) appinsights = app_insights_client.components.create_or_update(ai_resource_group_name, ai_name, ai_properties) if not appinsights or not appinsights.connection_string: From 627334d456e769601f69e131f95cc470a278816f Mon Sep 17 00:00:00 2001 From: Pan Li Date: Mon, 10 Jan 2022 14:24:27 +0800 Subject: [PATCH 18/19] Make static check happy. Signed-off-by: Pan Li --- .../azext_spring_cloud/_validators_enterprise.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/spring-cloud/azext_spring_cloud/_validators_enterprise.py b/src/spring-cloud/azext_spring_cloud/_validators_enterprise.py index 0d1f675e891..8cbd4311945 100644 --- a/src/spring-cloud/azext_spring_cloud/_validators_enterprise.py +++ b/src/spring-cloud/azext_spring_cloud/_validators_enterprise.py @@ -144,10 +144,10 @@ def validate_buildpack_binding_not_exist(cmd, namespace): client = get_client(cmd) try: binding_resource = client.buildpack_binding.get(namespace.resource_group, - namespace.service, - DEFAULT_BUILD_SERVICE_NAME, - namespace.builder_name, - namespace.name) + namespace.service, + DEFAULT_BUILD_SERVICE_NAME, + namespace.builder_name, + namespace.name) if binding_resource is not None: raise ClientRequestError('buildpack Binding {} in builder {} already exists ' 'in resource group {}, service {}. You can edit it by set command.' @@ -161,7 +161,7 @@ def validate_buildpack_binding_exist(cmd, namespace): client = get_client(cmd) # If not exists exception will be raised client.buildpack_binding.get(namespace.resource_group, - namespace.service, - DEFAULT_BUILD_SERVICE_NAME, - namespace.builder_name, - namespace.name) + namespace.service, + DEFAULT_BUILD_SERVICE_NAME, + namespace.builder_name, + namespace.name) From 818094c9a150ca5fdc8b2367bfc13d527072c139 Mon Sep 17 00:00:00 2001 From: Pan Li Date: Mon, 10 Jan 2022 15:29:14 +0800 Subject: [PATCH 19/19] Merge parmas. Signed-off-by: Pan Li --- .../azext_spring_cloud/_params.py | 38 +++++-------------- .../latest/test_asc_buildpack_binding.py | 2 +- 2 files changed, 10 insertions(+), 30 deletions(-) diff --git a/src/spring-cloud/azext_spring_cloud/_params.py b/src/spring-cloud/azext_spring_cloud/_params.py index 10716e6cc0d..50ddd0ffaae 100644 --- a/src/spring-cloud/azext_spring_cloud/_params.py +++ b/src/spring-cloud/azext_spring_cloud/_params.py @@ -428,12 +428,6 @@ def prepare_logs_argument(c): with self.argument_context('spring-cloud {}'.format(scope)) as c: c.argument('service', service_name_type, validator=only_support_enterprise) - with self.argument_context('spring-cloud service-registry bind') as c: - c.argument('app', app_name_type, help='Name of app.', validator=validate_app_name) - - with self.argument_context('spring-cloud service-registry unbind') as c: - c.argument('app', app_name_type, help='Name of app.', validator=validate_app_name) - for scope in ['bind', 'unbind']: with self.argument_context('spring-cloud service-registry {}'.format(scope)) as c: c.argument('app', app_name_type, help='Name of app.', validator=validate_app_name) @@ -513,24 +507,10 @@ def prepare_logs_argument(c): for scope in ['spring-cloud build-service builder buildpack-binding create']: with self.argument_context(scope) as c: - c.argument('type', - arg_type=get_enum_type(v20220101_preview_AppPlatformEnums.BindingType), - help='Required type for buildpack binding.') - c.argument('properties', - help='Non-sensitive properties for launchProperties. Format "key[=value]".', - nargs='*', - validator=validate_buildpack_binding_properties) - c.argument('secrets', - help='Sensitive properties for launchProperties. ' - 'Once put, it will be encrypted and never return to user. ' - 'Format "key[=value]".', - nargs='*', - validator=validate_buildpack_binding_secrets) c.argument('name', name_type, help='Name for buildpack binding.', validator=validate_buildpack_binding_not_exist) - c.argument('builder_name', help='The name for builder.', default="default") - c.argument('service', service_name_type, validator=only_support_enterprise) - for scope in ['spring-cloud build-service builder buildpack-binding set']: + for scope in ['spring-cloud build-service builder buildpack-binding create', + 'spring-cloud build-service builder buildpack-binding set']: with self.argument_context(scope) as c: c.argument('type', arg_type=get_enum_type(v20220101_preview_AppPlatformEnums.BindingType), @@ -545,18 +525,18 @@ def prepare_logs_argument(c): 'Format "key[=value]".', nargs='*', validator=validate_buildpack_binding_secrets) - c.argument('name', name_type, help='Name for buildpack binding.', validator=validate_buildpack_binding_exist) - c.argument('builder_name', help='The name for builder.', default="default") - c.argument('service', service_name_type, validator=only_support_enterprise) - for scope in ['spring-cloud build-service builder buildpack-binding show', + for scope in ['spring-cloud build-service builder buildpack-binding set', + 'spring-cloud build-service builder buildpack-binding show', 'spring-cloud build-service builder buildpack-binding delete']: with self.argument_context(scope) as c: c.argument('name', name_type, help='Name for buildpack binding.', validator=validate_buildpack_binding_exist) - c.argument('builder_name', help='The name for builder.', default="default") - c.argument('service', service_name_type, validator=only_support_enterprise) - for scope in ['spring-cloud build-service builder buildpack-binding list']: + for scope in ['spring-cloud build-service builder buildpack-binding create', + 'spring-cloud build-service builder buildpack-binding set', + 'spring-cloud build-service builder buildpack-binding list', + 'spring-cloud build-service builder buildpack-binding show', + 'spring-cloud build-service builder buildpack-binding delete']: with self.argument_context(scope) as c: c.argument('builder_name', help='The name for builder.', default="default") c.argument('service', service_name_type, validator=only_support_enterprise) diff --git a/src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_buildpack_binding.py b/src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_buildpack_binding.py index d93c68e6cb0..808255952b0 100644 --- a/src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_buildpack_binding.py +++ b/src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_buildpack_binding.py @@ -72,4 +72,4 @@ def test_buildpack_binding(self): ]) results = self.cmd('spring-cloud build-service builder buildpack-binding list -g {rg} -s {serviceName}').get_output_in_json() - self.assertEqual(2, len(results)) \ No newline at end of file + self.assertEqual(2, len(results))