diff --git a/src/spring-cloud/HISTORY.md b/src/spring-cloud/HISTORY.md index 7b4d10f8318..877b56640eb 100644 --- a/src/spring-cloud/HISTORY.md +++ b/src/spring-cloud/HISTORY.md @@ -1,6 +1,10 @@ Release History =============== +2.7.0 +----- +* Migrate to track2 SDK + 2.6.0 ----- * Add support for 0.5 core, 512 Mi resource requests in app deployment diff --git a/src/spring-cloud/azext_spring_cloud/_params.py b/src/spring-cloud/azext_spring_cloud/_params.py index 426798fba89..23d40103aa8 100644 --- a/src/spring-cloud/azext_spring_cloud/_params.py +++ b/src/spring-cloud/azext_spring_cloud/_params.py @@ -239,7 +239,7 @@ def prepare_logs_argument(c): with self.argument_context('spring-cloud certificate') as c: c.argument('service', service_name_type) - c.argument('name', name_type, help='Name of certificate.') + c.argument('name', help='Name of certificate.') with self.argument_context('spring-cloud certificate add') as c: c.argument('vault_uri', help='The key vault uri where store the certificate') diff --git a/src/spring-cloud/azext_spring_cloud/_utils.py b/src/spring-cloud/azext_spring_cloud/_utils.py index 418d0ab82ef..9e93b5c8f68 100644 --- a/src/spring-cloud/azext_spring_cloud/_utils.py +++ b/src/spring-cloud/azext_spring_cloud/_utils.py @@ -2,7 +2,7 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- - +import json from enum import Enum import os import codecs @@ -23,7 +23,7 @@ def _get_upload_local_file(runtime_version, artifact_path=None): file_path = artifact_path - file_type = "NetCoreZip" if runtime_version == AppPlatformEnums.RuntimeVersion.net_core_31 else "Jar" + file_type = "NetCoreZip" if runtime_version == AppPlatformEnums.RuntimeVersion.NET_CORE31 else "Jar" if file_path is None: file_type = "Source" @@ -229,3 +229,14 @@ def get_portal_uri(cli_ctx): except Exception as e: logger.debug("Could not get Azure Portal endpoint. Exception: %s", str(e)) return 'https://portal.azure.com' + + +def handle_asc_exception(ex): + try: + raise CLIError(ex.inner_exception.error.message) + except AttributeError: + if hasattr(ex, 'response'): + response_dict = json.loads(ex.response.internal_response.text) + raise CLIError(response_dict["error"]["message"]) + else: + raise CLIError(ex) diff --git a/src/spring-cloud/azext_spring_cloud/commands.py b/src/spring-cloud/azext_spring_cloud/commands.py index ef61aed689c..6fd1ce7ced0 100644 --- a/src/spring-cloud/azext_spring_cloud/commands.py +++ b/src/spring-cloud/azext_spring_cloud/commands.py @@ -4,11 +4,12 @@ # -------------------------------------------------------------------------------------------- # pylint: disable=line-too-long +from azext_spring_cloud._utils import handle_asc_exception + from ._client_factory import (cf_app_services, cf_spring_cloud, cf_spring_cloud_20201101preview, cf_spring_cloud_20210601preview, - cf_bindings, cf_config_servers) from ._transformers import (transform_spring_cloud_table_output, transform_app_table_output, @@ -19,33 +20,37 @@ # pylint: disable=too-many-statements def load_command_table(self, _): - with self.command_group('spring-cloud', client_factory=cf_app_services) as g: + with self.command_group('spring-cloud', client_factory=cf_app_services, + exception_handler=handle_asc_exception) as g: g.custom_command('create', 'spring_cloud_create', supports_no_wait=True, client_factory=cf_spring_cloud) g.custom_command('update', 'spring_cloud_update', supports_no_wait=True, client_factory=cf_spring_cloud) g.custom_command('delete', 'spring_cloud_delete', supports_no_wait=True) g.custom_command('list', 'spring_cloud_list', table_transformer=transform_spring_cloud_table_output) g.custom_show_command('show', 'spring_cloud_get', table_transformer=transform_spring_cloud_table_output) - with self.command_group('spring-cloud test-endpoint', client_factory=cf_spring_cloud) as g: + with self.command_group('spring-cloud test-endpoint', client_factory=cf_spring_cloud, + exception_handler=handle_asc_exception) as g: g.custom_command('enable ', 'enable_test_endpoint') g.custom_show_command('disable ', 'disable_test_endpoint') g.custom_command('renew-key', 'regenerate_keys') g.custom_command('list', 'list_keys') - with self.command_group('spring-cloud config-server', client_factory=cf_config_servers) as g: + with self.command_group('spring-cloud config-server', client_factory=cf_config_servers, + exception_handler=handle_asc_exception) as g: g.custom_command('set', 'config_set', supports_no_wait=True) g.custom_command('clear', 'config_delete') g.custom_show_command('show', 'config_get') with self.command_group('spring-cloud config-server git', client_factory=cf_config_servers, - supports_local_cache=True) as g: + supports_local_cache=True, exception_handler=handle_asc_exception) as g: g.custom_command('set', 'config_git_set') g.custom_command('repo add', 'config_repo_add') g.custom_command('repo remove', 'config_repo_delete') g.custom_command('repo update', 'config_repo_update') g.custom_command('repo list', 'config_repo_list') - with self.command_group('spring-cloud app', client_factory=cf_spring_cloud_20210601preview) as g: + with self.command_group('spring-cloud app', client_factory=cf_spring_cloud_20210601preview, + exception_handler=handle_asc_exception) as g: g.custom_command('create', 'app_create') g.custom_command('update', 'app_update') g.custom_command('deploy', 'app_deploy', supports_no_wait=True) @@ -65,16 +70,19 @@ def load_command_table(self, _): g.custom_command('restart', 'app_restart', supports_no_wait=True) g.custom_command('logs', 'app_tail_log') - with self.command_group('spring-cloud app identity', client_factory=cf_spring_cloud) as g: + with self.command_group('spring-cloud app identity', client_factory=cf_spring_cloud, + exception_handler=handle_asc_exception) as g: g.custom_command('assign', 'app_identity_assign') g.custom_command('remove', 'app_identity_remove') g.custom_show_command('show', 'app_identity_show') with self.command_group('spring-cloud app log', client_factory=cf_spring_cloud, - deprecate_info=g.deprecate(redirect='az spring-cloud app logs', hide=True)) as g: + deprecate_info=g.deprecate(redirect='az spring-cloud app logs', hide=True), + exception_handler=handle_asc_exception) as g: g.custom_command('tail', 'app_tail_log') - with self.command_group('spring-cloud app deployment', client_factory=cf_spring_cloud_20210601preview) as g: + with self.command_group('spring-cloud app deployment', client_factory=cf_spring_cloud_20210601preview, + exception_handler=handle_asc_exception) as g: g.custom_command('create', 'deployment_create', supports_no_wait=True) g.custom_command('list', 'deployment_list', table_transformer=transform_spring_cloud_deployment_output) @@ -82,7 +90,8 @@ def load_command_table(self, _): 'show', 'deployment_get', table_transformer=transform_spring_cloud_deployment_output) g.custom_command('delete', 'deployment_delete') - with self.command_group('spring-cloud app binding', client_factory=cf_spring_cloud) as g: + with self.command_group('spring-cloud app binding', client_factory=cf_spring_cloud, + exception_handler=handle_asc_exception) as g: g.custom_command('list', 'binding_list') g.custom_show_command('show', 'binding_get') g.custom_command('cosmos add', 'binding_cosmos_add') @@ -93,22 +102,26 @@ def load_command_table(self, _): g.custom_command('redis update', 'binding_redis_update') g.custom_show_command('remove', 'binding_remove') - with self.command_group('spring-cloud certificate', client_factory=cf_spring_cloud) as g: + with self.command_group('spring-cloud certificate', client_factory=cf_spring_cloud, + exception_handler=handle_asc_exception) as g: g.custom_command('add', 'certificate_add') g.custom_show_command('show', 'certificate_show', table_transformer=transform_spring_cloud_certificate_output) g.custom_command('list', 'certificate_list', table_transformer=transform_spring_cloud_certificate_output) g.custom_command('remove', 'certificate_remove') - with self.command_group('spring-cloud app custom-domain', client_factory=cf_spring_cloud) as g: + with self.command_group('spring-cloud app custom-domain', client_factory=cf_spring_cloud, + exception_handler=handle_asc_exception) as g: g.custom_command('bind', 'domain_bind') g.custom_show_command('show', 'domain_show', table_transformer=transform_spring_cloud_custom_domain_output) g.custom_command('list', 'domain_list', table_transformer=transform_spring_cloud_custom_domain_output) g.custom_command('update', 'domain_update') g.custom_command('unbind', 'domain_unbind') - with self.command_group('spring-cloud app-insights', is_preview=True, client_factory=cf_spring_cloud_20201101preview) as g: + with self.command_group('spring-cloud app-insights', is_preview=True, + client_factory=cf_spring_cloud_20201101preview, + exception_handler=handle_asc_exception) as g: g.custom_command('update', 'app_insights_update') g.custom_show_command('show', 'app_insights_show') - with self.command_group('spring-cloud'): + with self.command_group('spring-cloud', exception_handler=handle_asc_exception): pass diff --git a/src/spring-cloud/azext_spring_cloud/custom.py b/src/spring-cloud/azext_spring_cloud/custom.py index c5dce3dafd0..900b0ce2c6d 100644 --- a/src/spring-cloud/azext_spring_cloud/custom.py +++ b/src/spring-cloud/azext_spring_cloud/custom.py @@ -6,11 +6,14 @@ # pylint: disable=unused-argument, logging-format-interpolation, protected-access, wrong-import-order, too-many-lines import requests import re + +from azure.core.exceptions import HttpResponseError +from azure.mgmt.cosmosdb import CosmosDBManagementClient +from azure.mgmt.redis import RedisManagementClient from requests.auth import HTTPBasicAuth import yaml # pylint: disable=import-error from time import sleep from ._stream_utils import stream_logs -from msrestazure.azure_exceptions import CloudError from msrestazure.tools import parse_resource_id, is_valid_resource_id from ._utils import _get_upload_local_file, _get_persistent_disk_size, get_portal_uri, get_azure_files_info from knack.util import CLIError @@ -28,7 +31,6 @@ from azure.cli.core.util import sdk_no_wait from azure.cli.core.profiles import ResourceType, get_sdk from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient -from ast import literal_eval from azure.cli.core.commands import cached_put from ._utils import _get_rg_location from ._utils import _get_sku_name @@ -57,9 +59,8 @@ def spring_cloud_create(cmd, client, resource_group, name, location=None, app_in service_runtime_network_resource_group=None, app_network_resource_group=None, disable_distributed_tracing=None, disable_app_insights=None, enable_java_agent=None, sku='Standard', tags=None, no_wait=False): - rg_location = _get_rg_location(cmd.cli_ctx, resource_group) if location is None: - location = rg_location + location = _get_rg_location(cmd.cli_ctx, resource_group) properties = models.ClusterResourceProperties() if service_runtime_subnet or app_subnet or reserved_cidr_range: @@ -75,11 +76,13 @@ def spring_cloud_create(cmd, client, resource_group, name, location=None, app_in resource = models.ServiceResource(location=location, sku=full_sku, properties=properties, tags=tags) - poller = client.services.create_or_update( + poller = client.services.begin_create_or_update( resource_group, name, resource) logger.warning(" - Creating Service ..") while poller.done() is False: sleep(5) + + monitoring_setting_resource = models.MonitoringSettingResource() if disable_distributed_tracing is not True or disable_app_insights is not True: if enable_java_agent: client_preview = get_mgmt_service_client(cmd.cli_ctx, AppPlatformManagementClient_20201101preview) @@ -87,15 +90,18 @@ def spring_cloud_create(cmd, client, resource_group, name, location=None, app_in trace_properties = update_java_agent_config(cmd, resource_group, name, location, app_insights_key, app_insights, enable_java_agent) if trace_properties is not None: - sdk_no_wait(no_wait, client_preview.monitoring_settings.update_put, - resource_group_name=resource_group, service_name=name, properties=trace_properties) + monitoring_setting_resource.properties = trace_properties + sdk_no_wait(no_wait, client_preview.monitoring_settings.begin_update_put, + resource_group_name=resource_group, service_name=name, + monitoring_setting_resource=monitoring_setting_resource) else: logger.warning("Start configure Application Insights") trace_properties = update_tracing_config(cmd, resource_group, name, location, app_insights_key, app_insights, disable_app_insights) if trace_properties is not None: - sdk_no_wait(no_wait, client.monitoring_settings.update_put, - resource_group_name=resource_group, service_name=name, properties=trace_properties) + monitoring_setting_resource.properties = trace_properties + sdk_no_wait(no_wait, client.monitoring_settings.begin_update_put, resource_group_name=resource_group, + service_name=name, monitoring_setting_resource=monitoring_setting_resource) return poller @@ -141,20 +147,10 @@ def spring_cloud_update(cmd, client, resource_group, name, app_insights_key=None trace_properties = update_tracing_config(cmd, resource_group, name, location, app_insights_key, app_insights, (disable_distributed_tracing or disable_app_insights)) if trace_properties is not None: - sdk_no_wait(no_wait, client.monitoring_settings.update_put, - resource_group_name=resource_group, service_name=name, properties=trace_properties) - - # update service tags - if tags is not None: - updated_resource.tags = tags - update_service_tags = True - - if update_service_tags is False and update_service_sku is False: - return resource - - updated_resource.properties = updated_resource_properties - return sdk_no_wait(no_wait, client.services.update, - resource_group_name=resource_group, service_name=name, resource=updated_resource) + monitoring_setting_resource = models.MonitoringSettingResource(properties=trace_properties) + sdk_no_wait(no_wait, client.monitoring_settings.begin_update_put, + resource_group_name=resource_group, service_name=name, + monitoring_setting_resource=monitoring_setting_resource) # update service tags if tags is not None: @@ -165,13 +161,13 @@ def spring_cloud_update(cmd, client, resource_group, name, app_insights_key=None return resource updated_resource.properties = updated_resource_properties - return sdk_no_wait(no_wait, client.services.update, + return sdk_no_wait(no_wait, client.services.begin_update, resource_group_name=resource_group, service_name=name, resource=updated_resource) def spring_cloud_delete(cmd, client, resource_group, name, no_wait=False): logger.warning("Stop using Azure Spring Cloud? We appreciate your feedback: https://aka.ms/springclouddeletesurvey") - return sdk_no_wait(no_wait, client.delete, resource_group_name=resource_group, service_name=name) + return sdk_no_wait(no_wait, client.begin_delete, resource_group_name=resource_group, service_name=name) def spring_cloud_list(cmd, client, resource_group=None): @@ -213,7 +209,7 @@ def list_keys(cmd, client, resource_group, name, app=None, deployment=None): # pylint: disable=redefined-builtin def regenerate_keys(cmd, client, resource_group, name, type): - return client.services.regenerate_test_key(resource_group, name, type) + return client.services.regenerate_test_key(resource_group, name, models.RegenerateTestKeyRequestPayload(key_type=type)) def app_create(cmd, client, resource_group, service, name, @@ -245,7 +241,7 @@ def app_create(cmd, client, resource_group, service, name, if assign_identity is True: app_resource.identity = models_20210601preview.ManagedIdentityProperties(type="systemassigned") - poller = client.apps.create_or_update( + poller = client.apps.begin_create_or_update( resource_group, service, name, app_resource) while poller.done() is False: sleep(APP_CREATE_OR_UPDATE_SLEEP_INTERVAL) @@ -261,7 +257,7 @@ def app_create(cmd, client, resource_group, service, name, deployment_settings.cpu = None deployment_settings.memory_in_gb = None - file_type = "NetCoreZip" if runtime_version == AppPlatformEnums.RuntimeVersion.net_core_31 else "Jar" + file_type = "NetCoreZip" if runtime_version == AppPlatformEnums.RuntimeVersion.NET_CORE31 else "Jar" user_source_info = models_20210601preview.UserSourceInfo( relative_path='', type=file_type) @@ -273,9 +269,12 @@ def app_create(cmd, client, resource_group, service, name, logger.warning( "[2/4] Creating default deployment with name '{}'".format(DEFAULT_DEPLOYMENT_NAME)) sku = models_20210601preview.Sku(name="S0", tier="STANDARD", capacity=instance_count) - poller = client.deployments.create_or_update(resource_group, service, name, DEFAULT_DEPLOYMENT_NAME, - properties=properties, - sku=sku) + deployment_resource = models.DeploymentResource(properties=properties, sku=sku) + poller = client.deployments.begin_create_or_update(resource_group, + service, + name, + DEFAULT_DEPLOYMENT_NAME, + deployment_resource) logger.warning("[3/4] Setting default deployment to production") properties = models_20210601preview.AppResourceProperties( @@ -291,7 +290,7 @@ def app_create(cmd, client, resource_group, service, name, app_resource.properties = properties app_resource.location = resource.location - app_poller = client.apps.update(resource_group, service, name, app_resource) + app_poller = client.apps.begin_update(resource_group, service, name, app_resource) logger.warning( "[4/4] Updating app '{}' (this operation can take a while to complete)".format(name)) while not poller.done() or not app_poller.done(): @@ -338,7 +337,7 @@ def app_update(cmd, client, resource_group, service, name, app_resource.location = location logger.warning("[1/2] updating app '{}'".format(name)) - poller = client.apps.update( + poller = client.apps.begin_update( resource_group, service, name, app_resource) while poller.done() is False: sleep(APP_CREATE_OR_UPDATE_SLEEP_INTERVAL) @@ -364,8 +363,9 @@ def app_update(cmd, client, resource_group, service, name, deployment_settings.memory_in_gb = None properties = models_20210601preview.DeploymentResourceProperties( deployment_settings=deployment_settings) - poller = client.deployments.update( - resource_group, service, name, deployment, properties) + deployment_resource = models.DeploymentResource(properties=properties) + poller = client.deployments.begin_update( + resource_group, service, name, deployment, deployment_resource) while poller.done() is False: sleep(DEPLOYMENT_CREATE_OR_UPDATE_SLEEP_INTERVAL) @@ -380,7 +380,7 @@ def app_delete(cmd, client, service, name): client.apps.get(resource_group, service, name) - return client.apps.delete(resource_group, service, name) + return client.apps.begin_delete(resource_group, service, name) def app_start(cmd, client, @@ -395,7 +395,7 @@ def app_start(cmd, client, if deployment is None: logger.warning(NO_PRODUCTION_DEPLOYMENT_SET_ERROR) raise CLIError(NO_PRODUCTION_DEPLOYMENT_ERROR) - return sdk_no_wait(no_wait, client.deployments.start, + return sdk_no_wait(no_wait, client.deployments.begin_start, resource_group, service, name, deployment) @@ -411,7 +411,7 @@ def app_stop(cmd, client, if deployment is None: logger.warning(NO_PRODUCTION_DEPLOYMENT_SET_ERROR) raise CLIError(NO_PRODUCTION_DEPLOYMENT_ERROR) - return sdk_no_wait(no_wait, client.deployments.stop, + return sdk_no_wait(no_wait, client.deployments.begin_stop, resource_group, service, name, deployment) @@ -427,7 +427,7 @@ def app_restart(cmd, client, if deployment is None: logger.warning(NO_PRODUCTION_DEPLOYMENT_SET_ERROR) raise CLIError(NO_PRODUCTION_DEPLOYMENT_ERROR) - return sdk_no_wait(no_wait, client.deployments.restart, + return sdk_no_wait(no_wait, client.deployments.begin_restart, resource_group, service, name, deployment) @@ -530,8 +530,9 @@ def app_scale(cmd, client, resource_group, service, name, properties = models_20210601preview.DeploymentResourceProperties( deployment_settings=deployment_settings) sku = models_20210601preview.Sku(name="S0", tier="STANDARD", capacity=instance_count) - return sdk_no_wait(no_wait, client.deployments.update, - resource_group, service, name, deployment, properties=properties, sku=sku) + deployment_resource = models.DeploymentResource(properties=properties, sku=sku) + return sdk_no_wait(no_wait, client.deployments.begin_update, + resource_group, service, name, deployment, deployment_resource) def app_get_build_log(cmd, client, resource_group, service, name, deployment=None): @@ -614,7 +615,7 @@ def app_identity_assign(cmd, client, resource_group, service, name, role=None, s app_resource.identity = identity app_resource.properties = properties app_resource.location = location - client.apps.update(resource_group, service, name, app_resource) + client.apps.begin_update(resource_group, service, name, app_resource) app = client.apps.get(resource_group, service, name) if role: principal_id = app.identity.principal_id @@ -634,7 +635,7 @@ def app_identity_assign(cmd, client, resource_group, service, name, role=None, s assignments_client.create(scope=scope, role_assignment_name=assignment_name, parameters=parameters) break - except CloudError as ex: + except HttpResponseError as ex: if 'role assignment already exists' in ex.message: logger.info('Role assignment already exists') break @@ -658,7 +659,7 @@ def app_identity_remove(cmd, client, resource_group, service, name): app_resource.identity = identity app_resource.properties = properties app_resource.location = location - return client.apps.update(resource_group, service, name, app_resource) + return client.apps.begin_update(resource_group, service, name, app_resource) def app_identity_show(cmd, client, resource_group, service, name): @@ -687,7 +688,7 @@ def app_set_deployment(cmd, client, resource_group, service, name, deployment): app_resource.properties = properties app_resource.location = location - return client.apps.update(resource_group, service, name, app_resource) + return client.apps.begin_update(resource_group, service, name, app_resource) def app_unset_deployment(cmd, client, resource_group, service, name): @@ -706,7 +707,7 @@ def app_unset_deployment(cmd, client, resource_group, service, name): app_resource.properties = properties app_resource.location = location - return client.apps.update(resource_group, service, name, app_resource) + return client.apps.begin_update(resource_group, service, name, app_resource) def deployment_create(cmd, client, resource_group, service, app, name, @@ -792,15 +793,16 @@ def deployment_delete(cmd, client, resource_group, service, app, name): if active_deployment_name == name: logger.warning(DELETE_PRODUCTION_DEPLOYMENT_WARNING) client.deployments.get(resource_group, service, app, name) - return client.deployments.delete(resource_group, service, app, name) + return client.deployments.begin_delete(resource_group, service, app, name) def is_valid_git_uri(uri): return uri.startswith("https://") or uri.startswith("git@") -def validate_config_server_settings(client, resource_group, name, git_property): +def validate_config_server_settings(client, resource_group, name, config_server_settings): error_msg = "Git URI should start with \"https://\" or \"git@\"" + git_property = config_server_settings.git_property if git_property: if not is_valid_git_uri(git_property.uri): raise CLIError(error_msg) @@ -810,7 +812,7 @@ def validate_config_server_settings(client, resource_group, name, git_property): raise CLIError(error_msg) try: - result = sdk_no_wait(False, client.validate, resource_group, name, git_property).result() + result = sdk_no_wait(False, client.begin_validate, resource_group, name, config_server_settings).result() except Exception as err: # pylint: disable=broad-except raise CLIError("{0}. You may raise a support ticket if needed by the following link: https://docs.microsoft.com/azure/spring-cloud/spring-cloud-faq?pivots=programming-language-java#how-can-i-provide-feedback-and-report-issues".format(err)) @@ -866,9 +868,11 @@ def standardization(dic): config_server_properties = models.ConfigServerProperties(config_server=config_server_settings) logger.warning("[1/2] Validating config server settings") - validate_config_server_settings(client, resource_group, name, git_property) + validate_config_server_settings(client, resource_group, name, config_server_settings) logger.warning("[2/2] Updating config server settings, (this operation can take a while to complete)") - return sdk_no_wait(no_wait, client.update_put, resource_group, name, config_server_properties) + + config_server_resource = models.ConfigServerResource(properties=config_server_properties) + return sdk_no_wait(no_wait, client.begin_update_put, resource_group, name, config_server_resource) def config_get(cmd, client, resource_group, name): @@ -881,7 +885,8 @@ def config_get(cmd, client, resource_group, name): def config_delete(cmd, client, resource_group, name): config_server_properties = models.ConfigServerProperties() - return client.update_put(resource_group, name, config_server_properties) + config_server_resource = models.ConfigServerResource(properties=config_server_properties) + return client.begin_update_put(resource_group, name, config_server_resource) def config_git_set(cmd, client, resource_group, name, uri, @@ -911,9 +916,11 @@ def config_git_set(cmd, client, resource_group, name, uri, config_server_properties = models.ConfigServerProperties(config_server=config_server_settings) logger.warning("[1/2] Validating config server settings") - validate_config_server_settings(client, resource_group, name, git_property) + validate_config_server_settings(client, resource_group, name, config_server_settings) + logger.warning("[2/2] Updating config server settings, (this operation can take a while to complete)") - return cached_put(cmd, client.update_put, config_server_properties, resource_group, name).result() + config_server_resource = models.ConfigServerResource(properties=config_server_properties) + return cached_put(cmd, client.begin_update_put, config_server_resource, resource_group, name).result() def config_repo_add(cmd, client, resource_group, name, uri, repo_name, @@ -962,9 +969,11 @@ def config_repo_add(cmd, client, resource_group, name, uri, repo_name, config_server=config_server_settings) logger.warning("[1/2] Validating config server settings") - validate_config_server_settings(client, resource_group, name, git_property) + validate_config_server_settings(client, resource_group, name, config_server_settings) + logger.warning("[2/2] Adding config server settings repo, (this operation can take a while to complete)") - return cached_put(cmd, client.update_patch, config_server_properties, resource_group, name).result() + config_server_resource = models.ConfigServerResource(properties=config_server_properties) + return cached_put(cmd, client.begin_update_patch, config_server_resource, resource_group, name).result() def config_repo_delete(cmd, client, resource_group, name, repo_name): @@ -985,9 +994,11 @@ def config_repo_delete(cmd, client, resource_group, name, repo_name): config_server=config_server_settings) logger.warning("[1/2] Validating config server settings") - validate_config_server_settings(client, resource_group, name, git_property) + validate_config_server_settings(client, resource_group, name, config_server_settings) + logger.warning("[2/2] Deleting config server settings repo, (this operation can take a while to complete)") - return cached_put(cmd, client.update_patch, config_server_properties, resource_group, name).result() + config_server_resource = models.ConfigServerResource(properties=config_server_properties) + return cached_put(cmd, client.begin_update_patch, config_server_resource, resource_group, name).result() def config_repo_update(cmd, client, resource_group, name, repo_name, @@ -1036,9 +1047,11 @@ def config_repo_update(cmd, client, resource_group, name, repo_name, config_server_properties = models.ConfigServerProperties(config_server=config_server_settings) logger.warning("[1/2] Validating config server settings") - validate_config_server_settings(client, resource_group, name, git_property) + validate_config_server_settings(client, resource_group, name, config_server_settings) + logger.warning("[2/2] Updating config server settings repo, (this operation can take a while to complete)") - return cached_put(cmd, client.update_patch, config_server_properties, resource_group, name).result() + config_server_resource = models.ConfigServerResource(properties=config_server_properties) + return cached_put(cmd, client.begin_update_patch, config_server_resource, resource_group, name).result() def config_repo_list(cmd, client, resource_group, name): @@ -1062,7 +1075,7 @@ def binding_get(cmd, client, resource_group, service, app, name): def binding_remove(cmd, client, resource_group, service, app, name): - return client.bindings.delete(resource_group, service, app, name) + return client.bindings.begin_delete(resource_group, service, app, name) def binding_cosmos_add(cmd, client, resource_group, service, app, name, @@ -1085,7 +1098,7 @@ def binding_cosmos_add(cmd, client, resource_group, service, app, name, binding_parameters['collectionName'] = collection_name try: - primary_key = _get_cosmosdb_primary_key(client.bindings, resource_id) + primary_key = _get_cosmosdb_primary_key(cmd.cli_ctx, resource_id) except: raise CLIError( "Couldn't get cosmosdb {}'s primary key".format(resource_name)) @@ -1097,7 +1110,8 @@ def binding_cosmos_add(cmd, client, resource_group, service, app, name, key=primary_key, binding_parameters=binding_parameters ) - return client.bindings.create_or_update(resource_group, service, app, name, properties) + binding_resource = models.BindingResource(properties=properties) + return client.bindings.begin_create_or_update(resource_group, service, app, name, binding_resource) def binding_cosmos_update(cmd, client, resource_group, service, app, name, @@ -1114,7 +1128,7 @@ def binding_cosmos_update(cmd, client, resource_group, service, app, name, binding_parameters['collectionName'] = collection_name try: - primary_key = _get_cosmosdb_primary_key(client.bindings, resource_id) + primary_key = _get_cosmosdb_primary_key(cmd.cli_ctx, resource_id) except: raise CLIError( "Couldn't get cosmosdb {}'s primary key".format(resource_name)) @@ -1123,7 +1137,8 @@ def binding_cosmos_update(cmd, client, resource_group, service, app, name, key=primary_key, binding_parameters=binding_parameters ) - return client.bindings.update(resource_group, service, app, name, properties) + binding_resource = models.BindingResource(properties=properties) + return client.bindings.begin_update(resource_group, service, app, name, binding_resource) def binding_mysql_add(cmd, client, resource_group, service, app, name, @@ -1146,7 +1161,8 @@ def binding_mysql_add(cmd, client, resource_group, service, app, name, key=key, binding_parameters=binding_parameters ) - return client.bindings.create_or_update(resource_group, service, app, name, properties) + binding_resource = models.BindingResource(properties=properties) + return client.bindings.begin_create_or_update(resource_group, service, app, name, binding_resource) def binding_mysql_update(cmd, client, resource_group, service, app, name, @@ -1162,7 +1178,8 @@ def binding_mysql_update(cmd, client, resource_group, service, app, name, key=key, binding_parameters=binding_parameters ) - return client.bindings.update(resource_group, service, app, name, properties) + binding_resource = models.BindingResource(properties=properties) + return client.bindings.begin_update(resource_group, service, app, name, binding_resource) def binding_redis_add(cmd, client, resource_group, service, app, name, @@ -1177,7 +1194,7 @@ def binding_redis_add(cmd, client, resource_group, service, app, name, binding_parameters['useSsl'] = use_ssl primary_key = None try: - primary_key = _get_redis_primary_key(client.bindings, resource_id) + primary_key = _get_redis_primary_key(cmd.cli_ctx, resource_id) except: raise CLIError( "Couldn't get redis {}'s primary key".format(resource_name)) @@ -1189,8 +1206,8 @@ def binding_redis_add(cmd, client, resource_group, service, app, name, key=primary_key, binding_parameters=binding_parameters ) - - return client.bindings.create_or_update(resource_group, service, app, name, properties) + binding_resource = models.BindingResource(properties=properties) + return client.bindings.begin_create_or_update(resource_group, service, app, name, binding_resource) def binding_redis_update(cmd, client, resource_group, service, app, name, @@ -1204,7 +1221,7 @@ def binding_redis_update(cmd, client, resource_group, service, app, name, primary_key = None try: - primary_key = _get_redis_primary_key(client.bindings, resource_id) + primary_key = _get_redis_primary_key(cmd.cli_ctx, resource_id) except: raise CLIError( "Couldn't get redis {}'s primary key".format(resource_name)) @@ -1213,47 +1230,23 @@ def binding_redis_update(cmd, client, resource_group, service, app, name, key=primary_key, binding_parameters=binding_parameters ) - return client.bindings.update(resource_group, service, app, name, properties) - + binding_resource = models.BindingResource(properties=properties) + return client.bindings.begin_update(resource_group, service, app, name, binding_resource) -def _get_cosmosdb_primary_key(client, resource_id): - url = '{}/listKeys'.format(resource_id) - operation_config = {} - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = client._serialize.query( - "client.api_version", '2015-04-08', 'str') - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - - # Construct and send request - request = client._client.post(url, query_parameters, header_parameters) - response = client._client.send(request, stream=False, **operation_config) - keys = response.content.decode("utf-8") - keys_dict = literal_eval(keys) - return keys_dict['primaryMasterKey'] - - -def _get_redis_primary_key(client, resource_id): - url = '{}/listKeys'.format(resource_id) - operation_config = {} - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = client._serialize.query( - "client.api_version", '2016-04-01', 'str') +def _get_cosmosdb_primary_key(cli_ctx, resource_id): + resource_id_dict = parse_resource_id(resource_id) + cosmosdb_client = get_mgmt_service_client(cli_ctx, CosmosDBManagementClient) + keys = cosmosdb_client.database_accounts.list_keys(resource_id_dict['resource_group'], + resource_id_dict['resource_name']) + return keys.primary_master_key - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - # Construct and send request - request = client._client.post(url, query_parameters, header_parameters) - response = client._client.send(request, stream=False, **operation_config) - keys = response.content.decode("utf-8") - keys_dict = literal_eval(keys) - return keys_dict['primaryKey'] +def _get_redis_primary_key(cli_ctx, resource_id): + resource_id_dict = parse_resource_id(resource_id) + redis_client = get_mgmt_service_client(cli_ctx, RedisManagementClient) + keys = redis_client.redis.list_keys(resource_id_dict['resource_group'], resource_id_dict['resource_name']) + return keys.primary_key def _get_all_deployments(client, resource_group, service, app): @@ -1287,14 +1280,10 @@ def _app_deploy(client, resource_group, service, app, name, version, path, runti logger.warning("file_type is {}".format(file_type)) logger.warning("[1/3] Requesting for upload URL") try: - response = client.apps.get_resource_upload_url(resource_group, - service, - app, - None, - None) + response = client.apps.get_resource_upload_url(resource_group, service, app) upload_url = response.upload_url relative_path = response.relative_path - except (AttributeError, CloudError) as e: + except (AttributeError, HttpResponseError) as e: raise CLIError( "Failed to get a SAS URL to upload context. Error: {}".format(e.message)) @@ -1339,7 +1328,7 @@ def get_log_url(): if not log_file_url_response: return None return log_file_url_response.url - except CloudError: + except HttpResponseError: return None def get_logs_loop(): @@ -1361,12 +1350,13 @@ def get_logs_loop(): # create deployment logger.warning( "[3/3] Updating deployment in app '{}' (this operation can take a while to complete)".format(app)) + deployment_resource = models.DeploymentResource(properties=properties, sku=sku) if update: - return sdk_no_wait(no_wait, client.deployments.update, - resource_group, service, app, name, properties=properties, sku=sku) + return sdk_no_wait(no_wait, client.deployments.begin_update, + resource_group, service, app, name, deployment_resource) - return sdk_no_wait(no_wait, client.deployments.create_or_update, - resource_group, service, app, name, properties=properties, sku=sku) + return sdk_no_wait(no_wait, client.deployments.begin_create_or_update, + resource_group, service, app, name, deployment_resource) # pylint: disable=bare-except, too-many-statements @@ -1496,7 +1486,12 @@ def certificate_add(cmd, client, resource_group, service, name, vault_uri, vault vault_uri=vault_uri, key_vault_cert_name=vault_certificate_name ) - return client.certificates.create_or_update(resource_group, service, name, properties) + certificate_resource = models.CertificateResource(properties=properties) + return client.certificates.begin_create_or_update( + resource_group_name=resource_group, + service_name=service, + certificate_name=name, + certificate_resource=certificate_resource) def certificate_show(cmd, client, resource_group, service, name): @@ -1509,7 +1504,7 @@ def certificate_list(cmd, client, resource_group, service): def certificate_remove(cmd, client, resource_group, service, name): client.certificates.get(resource_group, service, name) - return client.certificates.delete(resource_group, service, name) + return client.certificates.begin_delete(resource_group, service, name) def domain_bind(cmd, client, resource_group, service, app, @@ -1527,7 +1522,9 @@ def domain_bind(cmd, client, resource_group, service, app, if enable_end_to_end_tls is not None: _update_app_e2e_tls(cmd, resource_group, service, app, enable_end_to_end_tls) - return client.custom_domains.create_or_update(resource_group, service, app, domain_name, properties) + custom_domain_resource = models.CustomDomainResource(properties=properties) + return client.custom_domains.begin_create_or_update(resource_group, service, app, + domain_name, custom_domain_resource) def _update_app_e2e_tls(cmd, resource_group, service, app, enable_end_to_end_tls): @@ -1541,7 +1538,7 @@ def _update_app_e2e_tls(cmd, resource_group, service, app, enable_end_to_end_tls app_resource.location = location logger.warning("Set end to end tls for app '{}'".format(app)) - poller = client.apps.update( + poller = client.apps.begin_update( resource_group, service, app, app_resource) return poller.result() @@ -1571,12 +1568,14 @@ def domain_update(cmd, client, resource_group, service, app, if enable_end_to_end_tls is not None: _update_app_e2e_tls(cmd, resource_group, service, app, enable_end_to_end_tls) - return client.custom_domains.create_or_update(resource_group, service, app, domain_name, properties) + custom_domain_resource = models.CustomDomainResource(properties=properties) + return client.custom_domains.begin_create_or_update(resource_group, service, app, + domain_name, custom_domain_resource) def domain_unbind(cmd, client, resource_group, service, app, domain_name): client.custom_domains.get(resource_group, service, app, domain_name) - return client.custom_domains.delete(resource_group, service, app, domain_name) + return client.custom_domains.begin_delete(resource_group, service, app, domain_name) def get_app_insights_key(cli_ctx, resource_group, name): @@ -1715,8 +1714,10 @@ def app_insights_update(cmd, client, resource_group, name, app_insights_key=None trace_properties = models_20201101preview.MonitoringSettingProperties( trace_enabled=True, app_insights_instrumentation_key=instrumentation_key, app_insights_sampling_rate=trace_properties.app_insights_sampling_rate) if trace_properties is not None: - sdk_no_wait(no_wait, client.monitoring_settings.update_put, - resource_group_name=resource_group, service_name=name, properties=trace_properties) + monitoring_setting_resource = models.MonitoringSettingResource(properties=trace_properties) + sdk_no_wait(no_wait, client.monitoring_settings.begin_update_put, + resource_group_name=resource_group, service_name=name, + monitoring_setting_resource=monitoring_setting_resource) def app_insights_show(cmd, client, resource_group, name, no_wait=False): diff --git a/src/spring-cloud/azext_spring_cloud/tests/latest/recordings/test_bind_cert_to_domain.yaml b/src/spring-cloud/azext_spring_cloud/tests/latest/recordings/test_bind_cert_to_domain.yaml index 10992c47a5c..9c63fd743d3 100644 --- a/src/spring-cloud/azext_spring_cloud/tests/latest/recordings/test_bind_cert_to_domain.yaml +++ b/src/spring-cloud/azext_spring_cloud/tests/latest/recordings/test_bind_cert_to_domain.yaml @@ -14,32 +14,31 @@ interactions: Content-Length: - '114' Content-Type: - - application/json; charset=utf-8 + - application/json ParameterSetName: - --name --vault-uri --vault-certificate-name -g -s User-Agent: - - python/3.8.1 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3 - azure-mgmt-appplatform/0.1.0 Azure-SDK-For-Python AZURECLI/2.5.0 - accept-language: - - en-US + - AZURECLI/2.25.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/certificates/test-cert?api-version=2020-07-01 response: body: - string: '{"properties":{"thumbprint":"839dbe007ebc9aeb7150d58b1474dd955e684f18","vaultUri":"https://integration-test-prod.vault.azure.net/","keyVaultCertName":"cli-unittest","certVersion":"210525ac4b3d4a0d8431ab7e64cd11f8","issuer":"*.asc-test.net","expirationDate":"2021-05-08T04:54:02.000+0000","activateDate":"2020-05-08T04:44:02.000+0000","subjectName":"CN=*.asc-test.net","dnsNames":["cli.asc-test.net"]},"type":"Microsoft.AppPlatform/Spring/certificates","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/certificates/test-cert","name":"test-cert"}' + string: '{"properties":{"thumbprint":"e1c623ea873cdc6a80f8682e0949c654fe2151db","vaultUri":"https://integration-test-prod.vault.azure.net/","keyVaultCertName":"cli-unittest","certVersion":"7fb4a84d12c042dcaf590a8d4a8d5c99","issuer":"*.asc-test.net","expirationDate":"2022-02-24T04:52:26.000+00:00","activateDate":"2021-02-24T04:42:26.000+00:00","subjectName":"*.asc-test.net","dnsNames":["cli.asc-test.net"]},"type":"Microsoft.AppPlatform/Spring/certificates","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/certificates/test-cert","name":"test-cert"}' headers: cache-control: - no-cache content-length: - - '624' + - '623' content-type: - application/json; charset=utf-8 date: - - Fri, 08 May 2020 05:02:37 GMT + - Tue, 20 Jul 2021 05:05:33 GMT expires: - '-1' pragma: - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d server: - nginx/1.17.7 strict-transport-security: @@ -51,9 +50,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1199' x-rp-server-mvid: - - afbe1e12-8584-4dc5-aa1e-547e4b04d8ae + - 9c5dac43-ba50-4546-ade2-62b32c9e757c status: code: 200 message: OK @@ -71,28 +70,27 @@ interactions: ParameterSetName: - --name -g -s User-Agent: - - python/3.8.1 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3 - azure-mgmt-appplatform/0.1.0 Azure-SDK-For-Python AZURECLI/2.5.0 - accept-language: - - en-US + - AZURECLI/2.25.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/certificates/test-cert?api-version=2020-07-01 response: body: - string: '{"properties":{"thumbprint":"839dbe007ebc9aeb7150d58b1474dd955e684f18","vaultUri":"https://integration-test-prod.vault.azure.net/","keyVaultCertName":"cli-unittest","certVersion":"210525ac4b3d4a0d8431ab7e64cd11f8","issuer":"*.asc-test.net","expirationDate":"2021-05-08T04:54:02.000+0000","activateDate":"2020-05-08T04:44:02.000+0000","subjectName":"CN=*.asc-test.net","dnsNames":["cli.asc-test.net"]},"type":"Microsoft.AppPlatform/Spring/certificates","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/certificates/test-cert","name":"test-cert"}' + string: '{"properties":{"thumbprint":"e1c623ea873cdc6a80f8682e0949c654fe2151db","vaultUri":"https://integration-test-prod.vault.azure.net/","keyVaultCertName":"cli-unittest","certVersion":"7fb4a84d12c042dcaf590a8d4a8d5c99","issuer":"*.asc-test.net","expirationDate":"2022-02-24T04:52:26.000+00:00","activateDate":"2021-02-24T04:42:26.000+00:00","subjectName":"*.asc-test.net","dnsNames":["cli.asc-test.net"]},"type":"Microsoft.AppPlatform/Spring/certificates","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/certificates/test-cert","name":"test-cert"}' headers: cache-control: - no-cache content-length: - - '624' + - '623' content-type: - application/json; charset=utf-8 date: - - Fri, 08 May 2020 05:02:39 GMT + - Tue, 20 Jul 2021 05:05:33 GMT expires: - '-1' pragma: - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d server: - nginx/1.17.7 strict-transport-security: @@ -104,7 +102,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - afbe1e12-8584-4dc5-aa1e-547e4b04d8ae + - 9c5dac43-ba50-4546-ade2-62b32c9e757c status: code: 200 message: OK @@ -119,29 +117,30 @@ interactions: - spring-cloud certificate list Connection: - keep-alive + ParameterSetName: + - -g -s User-Agent: - - python/3.8.1 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3 - azure-mgmt-appplatform/0.1.0 Azure-SDK-For-Python AZURECLI/2.5.0 - accept-language: - - en-US + - AZURECLI/2.25.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/certificates?api-version=2020-07-01 response: body: - string: '{"value":[{"properties":{"thumbprint":"839dbe007ebc9aeb7150d58b1474dd955e684f18","vaultUri":"https://integration-test-prod.vault.azure.net/","keyVaultCertName":"cli-unittest","certVersion":"210525ac4b3d4a0d8431ab7e64cd11f8","issuer":"*.asc-test.net","expirationDate":"2021-05-08T04:54:02.000+0000","activateDate":"2020-05-08T04:44:02.000+0000","subjectName":"CN=*.asc-test.net","dnsNames":["cli.asc-test.net"]},"type":"Microsoft.AppPlatform/Spring/certificates","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/certificates/test-cert","name":"test-cert"}]}' + string: '{"value":[{"properties":{"thumbprint":"e1c623ea873cdc6a80f8682e0949c654fe2151db","vaultUri":"https://integration-test-prod.vault.azure.net/","keyVaultCertName":"cli-unittest","certVersion":"7fb4a84d12c042dcaf590a8d4a8d5c99","issuer":"*.asc-test.net","expirationDate":"2022-02-24T04:52:26.000+00:00","activateDate":"2021-02-24T04:42:26.000+00:00","subjectName":"*.asc-test.net","dnsNames":["cli.asc-test.net"]},"type":"Microsoft.AppPlatform/Spring/certificates","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/certificates/test-cert","name":"test-cert"}]}' headers: cache-control: - no-cache content-length: - - '636' + - '635' content-type: - application/json; charset=utf-8 date: - - Fri, 08 May 2020 05:02:41 GMT + - Tue, 20 Jul 2021 05:05:35 GMT expires: - '-1' pragma: - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d server: - nginx/1.17.7 strict-transport-security: @@ -153,12 +152,12 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - afbe1e12-8584-4dc5-aa1e-547e4b04d8ae + - 9c5dac43-ba50-4546-ade2-62b32c9e757c status: code: 200 message: OK - request: - body: '{"properties": {}}' + body: null headers: Accept: - application/json @@ -168,35 +167,30 @@ interactions: - spring-cloud app custom-domain bind Connection: - keep-alive - Content-Length: - - '18' - Content-Type: - - application/json; charset=utf-8 ParameterSetName: - --domain-name --app -g -s User-Agent: - - python/3.8.1 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3 - azure-mgmt-appplatform/0.1.0 Azure-SDK-For-Python AZURECLI/2.5.0 - accept-language: - - en-US - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app/domains/cli.asc-test.net?api-version=2020-07-01 + - AZURECLI/2.25.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app?api-version=2020-07-01 response: body: - string: '{"properties":{"appName":"test-app"},"type":"Microsoft.AppPlatform/Spring/apps/domains","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app/domains/cli.asc-test.net","name":"cli.asc-test.net"}' + string: '{"properties":{"public":false,"provisioningState":"Succeeded","activeDeploymentName":"default","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"createdTime":"2021-07-20T03:46:52.134Z","temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"}},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app","name":"test-app"}' headers: cache-control: - no-cache content-length: - - '283' + - '548' content-type: - application/json; charset=utf-8 date: - - Fri, 08 May 2020 05:02:43 GMT + - Tue, 20 Jul 2021 05:05:36 GMT expires: - '-1' pragma: - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d server: - nginx/1.17.7 strict-transport-security: @@ -207,32 +201,33 @@ interactions: - Accept-Encoding,Accept-Encoding x-content-type-options: - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1198' + x-ms-ratelimit-remaining-subscription-resource-requests: + - '11999' x-rp-server-mvid: - - afbe1e12-8584-4dc5-aa1e-547e4b04d8ae + - 9c5dac43-ba50-4546-ade2-62b32c9e757c status: code: 200 message: OK - request: - body: null + body: '{"properties": {}}' headers: Accept: - application/json Accept-Encoding: - gzip, deflate CommandName: - - spring-cloud app custom-domain show + - spring-cloud app custom-domain bind Connection: - keep-alive + Content-Length: + - '18' + Content-Type: + - application/json ParameterSetName: - --domain-name --app -g -s User-Agent: - - python/3.8.1 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3 - azure-mgmt-appplatform/0.1.0 Azure-SDK-For-Python AZURECLI/2.5.0 - accept-language: - - en-US - method: GET + - AZURECLI/2.25.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app/domains/cli.asc-test.net?api-version=2020-07-01 response: body: @@ -245,11 +240,13 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 08 May 2020 05:02:44 GMT + - Tue, 20 Jul 2021 05:05:37 GMT expires: - '-1' pragma: - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d server: - nginx/1.17.7 strict-transport-security: @@ -260,8 +257,10 @@ interactions: - Accept-Encoding,Accept-Encoding x-content-type-options: - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' x-rp-server-mvid: - - afbe1e12-8584-4dc5-aa1e-547e4b04d8ae + - 9c5dac43-ba50-4546-ade2-62b32c9e757c status: code: 200 message: OK @@ -273,34 +272,33 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - spring-cloud app custom-domain list + - spring-cloud app custom-domain show Connection: - keep-alive ParameterSetName: - - --app -g -s + - --domain-name --app -g -s User-Agent: - - python/3.8.1 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3 - azure-mgmt-appplatform/0.1.0 Azure-SDK-For-Python AZURECLI/2.5.0 - accept-language: - - en-US + - AZURECLI/2.25.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app/domains?api-version=2020-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app?api-version=2020-07-01 response: body: - string: '{"value":[{"properties":{"appName":"test-app"},"type":"Microsoft.AppPlatform/Spring/apps/domains","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app/domains/cli.asc-test.net","name":"cli.asc-test.net"}]}' + string: '{"properties":{"public":false,"provisioningState":"Succeeded","activeDeploymentName":"default","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"createdTime":"2021-07-20T03:46:52.134Z","temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"}},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app","name":"test-app"}' headers: cache-control: - no-cache content-length: - - '295' + - '548' content-type: - application/json; charset=utf-8 date: - - Fri, 08 May 2020 05:02:46 GMT + - Tue, 20 Jul 2021 05:05:39 GMT expires: - '-1' pragma: - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d server: - nginx/1.17.7 strict-transport-security: @@ -311,8 +309,10 @@ interactions: - Accept-Encoding,Accept-Encoding x-content-type-options: - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '11999' x-rp-server-mvid: - - afbe1e12-8584-4dc5-aa1e-547e4b04d8ae + - 9c5dac43-ba50-4546-ade2-62b32c9e757c status: code: 200 message: OK @@ -324,34 +324,33 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - spring-cloud app custom-domain update + - spring-cloud app custom-domain show Connection: - keep-alive ParameterSetName: - - --domain-name --certificate --app -g -s + - --domain-name --app -g -s User-Agent: - - python/3.8.1 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3 - azure-mgmt-appplatform/0.1.0 Azure-SDK-For-Python AZURECLI/2.5.0 - accept-language: - - en-US + - AZURECLI/2.25.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/certificates/test-cert?api-version=2020-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app/domains/cli.asc-test.net?api-version=2020-07-01 response: body: - string: '{"properties":{"thumbprint":"839dbe007ebc9aeb7150d58b1474dd955e684f18","vaultUri":"https://integration-test-prod.vault.azure.net/","keyVaultCertName":"cli-unittest","certVersion":"210525ac4b3d4a0d8431ab7e64cd11f8","issuer":"*.asc-test.net","expirationDate":"2021-05-08T04:54:02.000+0000","activateDate":"2020-05-08T04:44:02.000+0000","subjectName":"CN=*.asc-test.net","dnsNames":["cli.asc-test.net"]},"type":"Microsoft.AppPlatform/Spring/certificates","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/certificates/test-cert","name":"test-cert"}' + string: '{"properties":{"appName":"test-app"},"type":"Microsoft.AppPlatform/Spring/apps/domains","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app/domains/cli.asc-test.net","name":"cli.asc-test.net"}' headers: cache-control: - no-cache content-length: - - '624' + - '283' content-type: - application/json; charset=utf-8 date: - - Fri, 08 May 2020 05:02:48 GMT + - Tue, 20 Jul 2021 05:05:39 GMT expires: - '-1' pragma: - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d server: - nginx/1.17.7 strict-transport-security: @@ -363,51 +362,45 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - afbe1e12-8584-4dc5-aa1e-547e4b04d8ae + - 9c5dac43-ba50-4546-ade2-62b32c9e757c status: code: 200 message: OK - request: - body: '{"properties": {"thumbprint": "839dbe007ebc9aeb7150d58b1474dd955e684f18", - "certName": "test-cert"}}' + body: null headers: Accept: - application/json Accept-Encoding: - gzip, deflate CommandName: - - spring-cloud app custom-domain update + - spring-cloud app custom-domain list Connection: - keep-alive - Content-Length: - - '99' - Content-Type: - - application/json; charset=utf-8 ParameterSetName: - - --domain-name --certificate --app -g -s + - --app -g -s User-Agent: - - python/3.8.1 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3 - azure-mgmt-appplatform/0.1.0 Azure-SDK-For-Python AZURECLI/2.5.0 - accept-language: - - en-US - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app/domains/cli.asc-test.net?api-version=2020-07-01 + - AZURECLI/2.25.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app?api-version=2020-07-01 response: body: - string: '{"properties":{"thumbprint":"839dbe007ebc9aeb7150d58b1474dd955e684f18","appName":"test-app","certName":"test-cert"},"type":"Microsoft.AppPlatform/Spring/apps/domains","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app/domains/cli.asc-test.net","name":"cli.asc-test.net"}' + string: '{"properties":{"public":false,"provisioningState":"Succeeded","activeDeploymentName":"default","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"createdTime":"2021-07-20T03:46:52.134Z","temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"}},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app","name":"test-app"}' headers: cache-control: - no-cache content-length: - - '362' + - '548' content-type: - application/json; charset=utf-8 date: - - Fri, 08 May 2020 05:02:49 GMT + - Tue, 20 Jul 2021 05:05:41 GMT expires: - '-1' pragma: - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d server: - nginx/1.17.7 strict-transport-security: @@ -418,10 +411,10 @@ interactions: - Accept-Encoding,Accept-Encoding x-content-type-options: - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1199' + x-ms-ratelimit-remaining-subscription-resource-requests: + - '11999' x-rp-server-mvid: - - afbe1e12-8584-4dc5-aa1e-547e4b04d8ae + - 9c5dac43-ba50-4546-ade2-62b32c9e757c status: code: 200 message: OK @@ -433,34 +426,33 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - spring-cloud app custom-domain unbind + - spring-cloud app custom-domain list Connection: - keep-alive ParameterSetName: - - --domain-name --app -g -s + - --app -g -s User-Agent: - - python/3.8.1 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3 - azure-mgmt-appplatform/0.1.0 Azure-SDK-For-Python AZURECLI/2.5.0 - accept-language: - - en-US + - AZURECLI/2.25.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app/domains/cli.asc-test.net?api-version=2020-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app/domains?api-version=2020-07-01 response: body: - string: '{"properties":{"thumbprint":"839dbe007ebc9aeb7150d58b1474dd955e684f18","appName":"test-app","certName":"test-cert"},"type":"Microsoft.AppPlatform/Spring/apps/domains","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app/domains/cli.asc-test.net","name":"cli.asc-test.net"}' + string: '{"value":[{"properties":{"appName":"test-app"},"type":"Microsoft.AppPlatform/Spring/apps/domains","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app/domains/cli.asc-test.net","name":"cli.asc-test.net"}]}' headers: cache-control: - no-cache content-length: - - '362' + - '295' content-type: - application/json; charset=utf-8 date: - - Fri, 08 May 2020 05:02:50 GMT + - Tue, 20 Jul 2021 05:05:41 GMT expires: - '-1' pragma: - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d server: - nginx/1.17.7 strict-transport-security: @@ -472,7 +464,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - afbe1e12-8584-4dc5-aa1e-547e4b04d8ae + - 9c5dac43-ba50-4546-ade2-62b32c9e757c status: code: 200 message: OK @@ -484,97 +476,50 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - spring-cloud app custom-domain unbind - Connection: - - keep-alive - Content-Length: - - '0' - ParameterSetName: - - --domain-name --app -g -s - User-Agent: - - python/3.8.1 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3 - azure-mgmt-appplatform/0.1.0 Azure-SDK-For-Python AZURECLI/2.5.0 - accept-language: - - en-US - method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app/domains/cli.asc-test.net?api-version=2020-07-01 - response: - body: - string: '' - headers: - cache-control: - - no-cache - content-length: - - '0' - date: - - Fri, 08 May 2020 05:02:50 GMT - expires: - - '-1' - pragma: - - no-cache - 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: - - afbe1e12-8584-4dc5-aa1e-547e4b04d8ae - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - spring-cloud app custom-domain show + - spring-cloud app custom-domain update Connection: - keep-alive ParameterSetName: - - --domain-name --app -g -s + - --domain-name --certificate --app -g -s User-Agent: - - python/3.8.1 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3 - azure-mgmt-appplatform/0.1.0 Azure-SDK-For-Python AZURECLI/2.5.0 - accept-language: - - en-US + - AZURECLI/2.25.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app/domains/cli.asc-test.net?api-version=2020-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app?api-version=2020-07-01 response: body: - string: '{"error":{"code":"EntityNotFound","message":"CustomDomain with name - ''cli.asc-test.net'' not found","target":null,"details":null}}' + string: '{"properties":{"public":false,"provisioningState":"Succeeded","activeDeploymentName":"default","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"createdTime":"2021-07-20T03:46:52.134Z","temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"}},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app","name":"test-app"}' headers: cache-control: - no-cache content-length: - - '128' + - '548' content-type: - application/json; charset=utf-8 date: - - Fri, 08 May 2020 05:02:52 GMT + - Tue, 20 Jul 2021 05:05:42 GMT expires: - '-1' pragma: - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d server: - nginx/1.17.7 strict-transport-security: - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked vary: - - Accept-Encoding + - Accept-Encoding,Accept-Encoding x-content-type-options: - nosniff + x-ms-ratelimit-remaining-subscription-resource-requests: + - '11998' x-rp-server-mvid: - - afbe1e12-8584-4dc5-aa1e-547e4b04d8ae + - 9c5dac43-ba50-4546-ade2-62b32c9e757c status: - code: 404 - message: Not Found + code: 200 + message: OK - request: body: null headers: @@ -583,34 +528,33 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - spring-cloud certificate remove + - spring-cloud app custom-domain update Connection: - keep-alive ParameterSetName: - - --name -g -s + - --domain-name --certificate --app -g -s User-Agent: - - python/3.8.1 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3 - azure-mgmt-appplatform/0.1.0 Azure-SDK-For-Python AZURECLI/2.5.0 - accept-language: - - en-US + - AZURECLI/2.25.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/certificates/test-cert?api-version=2020-07-01 response: body: - string: '{"properties":{"thumbprint":"839dbe007ebc9aeb7150d58b1474dd955e684f18","vaultUri":"https://integration-test-prod.vault.azure.net/","keyVaultCertName":"cli-unittest","certVersion":"210525ac4b3d4a0d8431ab7e64cd11f8","issuer":"*.asc-test.net","expirationDate":"2021-05-08T04:54:02.000+0000","activateDate":"2020-05-08T04:44:02.000+0000","subjectName":"CN=*.asc-test.net","dnsNames":["cli.asc-test.net"]},"type":"Microsoft.AppPlatform/Spring/certificates","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/certificates/test-cert","name":"test-cert"}' + string: '{"properties":{"thumbprint":"e1c623ea873cdc6a80f8682e0949c654fe2151db","vaultUri":"https://integration-test-prod.vault.azure.net/","keyVaultCertName":"cli-unittest","certVersion":"7fb4a84d12c042dcaf590a8d4a8d5c99","issuer":"*.asc-test.net","expirationDate":"2022-02-24T04:52:26.000+00:00","activateDate":"2021-02-24T04:42:26.000+00:00","subjectName":"*.asc-test.net","dnsNames":["cli.asc-test.net"]},"type":"Microsoft.AppPlatform/Spring/certificates","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/certificates/test-cert","name":"test-cert"}' headers: cache-control: - no-cache content-length: - - '624' + - '623' content-type: - application/json; charset=utf-8 date: - - Fri, 08 May 2020 05:02:53 GMT + - Tue, 20 Jul 2021 05:05:42 GMT expires: - '-1' pragma: - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d server: - nginx/1.17.7 strict-transport-security: @@ -622,56 +566,64 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - afbe1e12-8584-4dc5-aa1e-547e4b04d8ae + - 9c5dac43-ba50-4546-ade2-62b32c9e757c status: code: 200 message: OK - request: - body: null + body: '{"properties": {"thumbprint": "e1c623ea873cdc6a80f8682e0949c654fe2151db", + "certName": "test-cert"}}' headers: Accept: - application/json Accept-Encoding: - gzip, deflate CommandName: - - spring-cloud certificate remove + - spring-cloud app custom-domain update Connection: - keep-alive Content-Length: - - '0' + - '99' + Content-Type: + - application/json ParameterSetName: - - --name -g -s + - --domain-name --certificate --app -g -s User-Agent: - - python/3.8.1 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3 - azure-mgmt-appplatform/0.1.0 Azure-SDK-For-Python AZURECLI/2.5.0 - accept-language: - - en-US - method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/certificates/test-cert?api-version=2020-07-01 + - AZURECLI/2.25.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app/domains/cli.asc-test.net?api-version=2020-07-01 response: body: - string: '' + string: '{"properties":{"thumbprint":"e1c623ea873cdc6a80f8682e0949c654fe2151db","appName":"test-app","certName":"test-cert"},"type":"Microsoft.AppPlatform/Spring/apps/domains","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app/domains/cli.asc-test.net","name":"cli.asc-test.net"}' headers: cache-control: - no-cache content-length: - - '0' + - '362' + content-type: + - application/json; charset=utf-8 date: - - Fri, 08 May 2020 05:02:53 GMT + - Tue, 20 Jul 2021 05:05:43 GMT expires: - '-1' pragma: - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d 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-deletes: - - '14999' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' x-rp-server-mvid: - - afbe1e12-8584-4dc5-aa1e-547e4b04d8ae + - 9c5dac43-ba50-4546-ade2-62b32c9e757c status: code: 200 message: OK @@ -683,48 +635,48 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - spring-cloud certificate show + - spring-cloud app custom-domain unbind Connection: - keep-alive ParameterSetName: - - --name -g -s + - --domain-name --app -g -s User-Agent: - - python/3.8.1 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3 - azure-mgmt-appplatform/0.1.0 Azure-SDK-For-Python AZURECLI/2.5.0 - accept-language: - - en-US + - AZURECLI/2.25.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/certificates/test-cert?api-version=2020-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app/domains/cli.asc-test.net?api-version=2020-07-01 response: body: - string: '{"error":{"code":"EntityNotFound","message":"CertificateName ''test-cert'' - not found","target":null,"details":null}}' + string: '{"properties":{"thumbprint":"e1c623ea873cdc6a80f8682e0949c654fe2151db","appName":"test-app","certName":"test-cert"},"type":"Microsoft.AppPlatform/Spring/apps/domains","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app/domains/cli.asc-test.net","name":"cli.asc-test.net"}' headers: cache-control: - no-cache content-length: - - '114' + - '362' content-type: - application/json; charset=utf-8 date: - - Fri, 08 May 2020 05:02:54 GMT + - Tue, 20 Jul 2021 05:05:44 GMT expires: - '-1' pragma: - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d server: - nginx/1.17.7 strict-transport-security: - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked vary: - - Accept-Encoding + - Accept-Encoding,Accept-Encoding x-content-type-options: - nosniff x-rp-server-mvid: - - afbe1e12-8584-4dc5-aa1e-547e4b04d8ae + - 9c5dac43-ba50-4546-ade2-62b32c9e757c status: - code: 404 - message: Not Found + code: 200 + message: OK - request: body: null headers: @@ -733,34 +685,33 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - spring-cloud app get + - spring-cloud app custom-domain unbind Connection: - keep-alive Content-Length: - '0' ParameterSetName: - - --name -g -s + - --domain-name --app -g -s User-Agent: - - python/3.8.1 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3 - azure-mgmt-appplatform/0.1.0 Azure-SDK-For-Python AZURECLI/2.5.0 - accept-language: - - en-US - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app?api-version=2020-07-01 + - AZURECLI/2.25.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app/domains/cli.asc-test.net?api-version=2020-07-01 response: body: - string: '{"properties":{"public":true,"url":"","provisioningState":"Succeeded","activeDeploymentName":"default","fqdn":"","httpsOnly":false,"createdTime":"2020-12-22T10:09:47.388Z","temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app","name":"test-app"}' + string: '' headers: cache-control: - no-cache content-length: - '0' date: - - Wed, 23 Dec 2020 04:42:46 GMT + - Tue, 20 Jul 2021 05:05:45 GMT expires: - '-1' pragma: - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d server: - nginx/1.17.7 strict-transport-security: @@ -770,7 +721,7 @@ interactions: x-ms-ratelimit-remaining-subscription-deletes: - '14999' x-rp-server-mvid: - - afbe1e12-8584-4dc5-aa1e-547e4b04d8ae + - 9c5dac43-ba50-4546-ade2-62b32c9e757c status: code: 200 message: OK @@ -782,44 +733,47 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - spring-cloud app get + - spring-cloud app custom-domain show Connection: - keep-alive - Content-Length: - - '0' ParameterSetName: - - --name -g -s + - --domain-name --app -g -s User-Agent: - - python/3.8.1 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3 - azure-mgmt-appplatform/0.1.0 Azure-SDK-For-Python AZURECLI/2.5.0 - accept-language: - - en-US + - AZURECLI/2.25.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app?api-version=2020-07-01 response: body: - string: '{"properties":{"public":true,"url":"","provisioningState":"Succeeded","activeDeploymentName":"default","fqdn":"","httpsOnly":false,"createdTime":"2020-12-22T10:09:47.388Z","temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app","name":"test-app"}' + string: '{"properties":{"public":false,"provisioningState":"Succeeded","activeDeploymentName":"default","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"createdTime":"2021-07-20T03:46:52.134Z","temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"}},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app","name":"test-app"}' headers: cache-control: - no-cache content-length: - - '0' + - '548' + content-type: + - application/json; charset=utf-8 date: - - Wed, 23 Dec 2020 04:42:46 GMT + - Tue, 20 Jul 2021 05:05:47 GMT expires: - '-1' pragma: - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d 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-deletes: - - '14999' + x-ms-ratelimit-remaining-subscription-resource-requests: + - '11999' x-rp-server-mvid: - - afbe1e12-8584-4dc5-aa1e-547e4b04d8ae + - 9c5dac43-ba50-4546-ade2-62b32c9e757c status: code: 200 message: OK @@ -831,47 +785,45 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - spring-cloud app get + - spring-cloud app custom-domain show Connection: - keep-alive - Content-Length: - - '0' ParameterSetName: - - --name -g -s + - --domain-name --app -g -s User-Agent: - - python/3.8.1 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3 - azure-mgmt-appplatform/0.1.0 Azure-SDK-For-Python AZURECLI/2.5.0 - accept-language: - - en-US + - AZURECLI/2.25.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app?api-version=2020-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app/domains/cli.asc-test.net?api-version=2020-07-01 response: body: - string: '{"properties":{"public":true,"url":"","provisioningState":"Succeeded","activeDeploymentName":"default","fqdn":"","httpsOnly":false,"createdTime":"2020-12-22T10:09:47.388Z","temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app","name":"test-app"}' + string: '{"error":{"code":"EntityNotFound","message":"CustomDomain ''cli.asc-test.net'' + not found.","target":null,"details":null}}' headers: cache-control: - no-cache content-length: - - '0' + - '119' + content-type: + - application/json; charset=utf-8 date: - - Wed, 23 Dec 2020 04:42:46 GMT + - Tue, 20 Jul 2021 05:05:47 GMT expires: - '-1' pragma: - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d 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: - - afbe1e12-8584-4dc5-aa1e-547e4b04d8ae + - 9c5dac43-ba50-4546-ade2-62b32c9e757c status: - code: 200 - message: OK + code: 404 + message: Not Found - request: body: null headers: @@ -880,44 +832,45 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - spring-cloud app get + - spring-cloud certificate remove Connection: - keep-alive - Content-Length: - - '0' ParameterSetName: - --name -g -s User-Agent: - - python/3.8.1 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3 - azure-mgmt-appplatform/0.1.0 Azure-SDK-For-Python AZURECLI/2.5.0 - accept-language: - - en-US + - AZURECLI/2.25.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app?api-version=2020-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/certificates/test-cert?api-version=2020-07-01 response: body: - string: '{"properties":{"public":true,"url":"","provisioningState":"Succeeded","activeDeploymentName":"default","fqdn":"","httpsOnly":false,"createdTime":"2020-12-22T10:09:47.388Z","temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app","name":"test-app"}' + string: '{"properties":{"thumbprint":"e1c623ea873cdc6a80f8682e0949c654fe2151db","vaultUri":"https://integration-test-prod.vault.azure.net/","keyVaultCertName":"cli-unittest","certVersion":"7fb4a84d12c042dcaf590a8d4a8d5c99","issuer":"*.asc-test.net","expirationDate":"2022-02-24T04:52:26.000+00:00","activateDate":"2021-02-24T04:42:26.000+00:00","subjectName":"*.asc-test.net","dnsNames":["cli.asc-test.net"]},"type":"Microsoft.AppPlatform/Spring/certificates","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/certificates/test-cert","name":"test-cert"}' headers: cache-control: - no-cache content-length: - - '0' + - '623' + content-type: + - application/json; charset=utf-8 date: - - Wed, 23 Dec 2020 04:42:46 GMT + - Tue, 20 Jul 2021 05:05:48 GMT expires: - '-1' pragma: - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d 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-deletes: - - '14999' x-rp-server-mvid: - - afbe1e12-8584-4dc5-aa1e-547e4b04d8ae + - 9c5dac43-ba50-4546-ade2-62b32c9e757c status: code: 200 message: OK @@ -929,7 +882,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - spring-cloud app get + - spring-cloud certificate remove Connection: - keep-alive Content-Length: @@ -937,26 +890,25 @@ interactions: ParameterSetName: - --name -g -s User-Agent: - - python/3.8.1 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3 - azure-mgmt-appplatform/0.1.0 Azure-SDK-For-Python AZURECLI/2.5.0 - accept-language: - - en-US - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app?api-version=2020-07-01 + - AZURECLI/2.25.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/certificates/test-cert?api-version=2020-07-01 response: body: - string: '{"properties":{"public":true,"url":"","provisioningState":"Succeeded","activeDeploymentName":"default","fqdn":"","httpsOnly":false,"createdTime":"2020-12-22T10:09:47.388Z","temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app","name":"test-app"}' + string: '' headers: cache-control: - no-cache content-length: - '0' date: - - Wed, 23 Dec 2020 04:42:46 GMT + - Tue, 20 Jul 2021 05:05:49 GMT expires: - '-1' pragma: - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d server: - nginx/1.17.7 strict-transport-security: @@ -966,7 +918,7 @@ interactions: x-ms-ratelimit-remaining-subscription-deletes: - '14999' x-rp-server-mvid: - - afbe1e12-8584-4dc5-aa1e-547e4b04d8ae + - 9c5dac43-ba50-4546-ade2-62b32c9e757c status: code: 200 message: OK @@ -978,45 +930,43 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - spring-cloud app get + - spring-cloud certificate show Connection: - keep-alive - Content-Length: - - '0' ParameterSetName: - --name -g -s User-Agent: - - python/3.8.1 (Windows-10-10.0.18362-SP0) msrest/0.6.11 msrest_azure/0.6.3 - azure-mgmt-appplatform/0.1.0 Azure-SDK-For-Python AZURECLI/2.5.0 - accept-language: - - en-US + - AZURECLI/2.25.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app?api-version=2020-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/certificates/test-cert?api-version=2020-07-01 response: body: - string: '{"properties":{"public":true,"url":"","provisioningState":"Succeeded","activeDeploymentName":"default","fqdn":"","httpsOnly":false,"createdTime":"2020-12-22T10:09:47.388Z","temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app","name":"test-app"}' + string: '{"error":{"code":"EntityNotFound","message":"Certificate ''test-cert'' + not found.","target":null,"details":null}}' headers: cache-control: - no-cache content-length: - - '0' + - '111' + content-type: + - application/json; charset=utf-8 date: - - Wed, 23 Dec 2020 04:42:46 GMT + - Tue, 20 Jul 2021 05:05:50 GMT expires: - '-1' pragma: - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d 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: - - afbe1e12-8584-4dc5-aa1e-547e4b04d8ae + - 9c5dac43-ba50-4546-ade2-62b32c9e757c status: - code: 200 - message: OK + code: 404 + message: Not Found version: 1 diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/__init__.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/__init__.py index ee44eafce0f..9c5da1ef39d 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/__init__.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/__init__.py @@ -1,19 +1,16 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._configuration import AppPlatformManagementClientConfiguration from ._app_platform_management_client import AppPlatformManagementClient -__all__ = ['AppPlatformManagementClient', 'AppPlatformManagementClientConfiguration'] - -from .version import VERSION - -__version__ = VERSION +__all__ = ['AppPlatformManagementClient'] +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/_app_platform_management_client.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/_app_platform_management_client.py index d2ce20bbe77..b417f26cc70 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/_app_platform_management_client.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/_app_platform_management_client.py @@ -9,41 +9,51 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import SDKClient -from msrest import Serializer, Deserializer +from typing import TYPE_CHECKING +from azure.mgmt.core import ARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin +from msrest import Deserializer, Serializer + from ._configuration import AppPlatformManagementClientConfiguration +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse +class _SDKClient(object): + def __init__(self, *args, **kwargs): + """This is a fake class to support current implemetation of MultiApiClientMixin." + Will be removed in final version of multiapi azure-core based client + """ + pass -class AppPlatformManagementClient(MultiApiClientMixin, SDKClient): - """REST API for Azure Spring Cloud +class AppPlatformManagementClient(MultiApiClientMixin, _SDKClient): + """REST API for Azure Spring Cloud. - This ready contains multiple API versions, to help you deal with all Azure clouds + This ready contains multiple API versions, to help you deal with all of the Azure clouds (Azure Stack, Azure Government, Azure China, etc.). - By default, uses latest API version available on public Azure. - For production, you should stick a particular api-version and/or profile. - The profile sets a mapping between the operation group and an API version. + By default, it uses the latest API version available on public Azure. + For production, you should stick to a particular api-version and/or profile. + The profile sets a mapping between an operation group and its API version. The api-version parameter sets the default API version if the operation group is not described in the profile. - :ivar config: Configuration for client. - :vartype config: AppPlatformManagementClientConfiguration - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Subscription credentials which uniquely identify - Microsoft Azure subscription. The subscription ID forms part of the URI - for every service call. + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str api_version: API version to use if no profile is provided, or if - missing in profile. - :param str base_url: Service URL + :param api_version: API version to use if no profile is provided, or if missing in profile. + :type api_version: str + :param base_url: Service URL + :type base_url: str :param profile: A profile definition, from KnownProfiles to dict. :type profile: azure.profiles.KnownProfiles + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ DEFAULT_API_VERSION = '2020-07-01' @@ -56,11 +66,20 @@ class AppPlatformManagementClient(MultiApiClientMixin, SDKClient): _PROFILE_TAG + " latest" ) - def __init__(self, credentials, subscription_id, api_version=None, base_url=None, profile=KnownProfiles.default): - self.config = AppPlatformManagementClientConfiguration(credentials, subscription_id, base_url) + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + api_version=None, # type: Optional[str] + base_url=None, # type: Optional[str] + profile=KnownProfiles.default, # type: KnownProfiles + **kwargs # type: Any + ): + if not base_url: + base_url = 'https://management.azure.com' + self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(AppPlatformManagementClient, self).__init__( - credentials, - self.config, api_version=api_version, profile=profile ) @@ -90,7 +109,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2021-06-01-preview': from .v2021_06_01_preview import models return models - raise NotImplementedError("APIVersion {} is not available".format(api_version)) + raise ValueError("API version {} is not available".format(api_version)) @property def apps(self): @@ -111,8 +130,8 @@ def apps(self): elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import AppsOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + raise ValueError("API version {} does not have operation group 'apps'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def bindings(self): @@ -133,8 +152,8 @@ def bindings(self): elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import BindingsOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + raise ValueError("API version {} does not have operation group 'bindings'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def certificates(self): @@ -155,8 +174,8 @@ def certificates(self): elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import CertificatesOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + raise ValueError("API version {} does not have operation group 'certificates'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def config_servers(self): @@ -174,8 +193,8 @@ def config_servers(self): elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import ConfigServersOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + raise ValueError("API version {} does not have operation group 'config_servers'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def custom_domains(self): @@ -196,8 +215,8 @@ def custom_domains(self): elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import CustomDomainsOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + raise ValueError("API version {} does not have operation group 'custom_domains'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def deployments(self): @@ -218,8 +237,8 @@ def deployments(self): elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import DeploymentsOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + raise ValueError("API version {} does not have operation group 'deployments'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def monitoring_settings(self): @@ -237,8 +256,8 @@ def monitoring_settings(self): elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import MonitoringSettingsOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + raise ValueError("API version {} does not have operation group 'monitoring_settings'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def operations(self): @@ -259,8 +278,8 @@ def operations(self): elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import Operations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def runtime_versions(self): @@ -281,8 +300,8 @@ def runtime_versions(self): elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import RuntimeVersionsOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + raise ValueError("API version {} does not have operation group 'runtime_versions'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def services(self): @@ -303,8 +322,8 @@ def services(self): elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import ServicesOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + raise ValueError("API version {} does not have operation group 'services'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def sku(self): @@ -316,8 +335,8 @@ def sku(self): if api_version == '2019-05-01-preview': from .v2019_05_01_preview.operations import SkuOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + raise ValueError("API version {} does not have operation group 'sku'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def skus(self): @@ -335,5 +354,13 @@ def skus(self): elif api_version == '2021-06-01-preview': from .v2021_06_01_preview.operations import SkusOperations as OperationClass else: - raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + raise ValueError("API version {} does not have operation group 'skus'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + def close(self): + self._client.close() + def __enter__(self): + self._client.__enter__() + return self + def __exit__(self, *exc_details): + self._client.__exit__(*exc_details) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/_configuration.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/_configuration.py index 5a7f3752f05..7ab9f3c3d51 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/_configuration.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/_configuration.py @@ -8,43 +8,64 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from msrestazure import AzureConfiguration +from typing import TYPE_CHECKING -from .version import VERSION +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +class AppPlatformManagementClientConfiguration(Configuration): + """Configuration for AppPlatformManagementClient. -class AppPlatformManagementClientConfiguration(AzureConfiguration): - """Configuration for AppPlatformManagementClient Note that all parameters used to create this instance are saved as instance attributes. - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Gets subscription ID which uniquely identify the - Microsoft Azure subscription. The subscription ID forms part of the URI - for every service call. + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - if not base_url: - base_url = 'https://management.azure.com' + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) - super(AppPlatformManagementClientConfiguration, self).__init__(base_url) - - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True - - self.add_user_agent('azure-mgmt-appplatform/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials + self.credential = credential self.subscription_id = subscription_id + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'azure-mgmt-appplatform/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/version.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/_version.py similarity index 84% rename from src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/version.py rename to src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/_version.py index 9c644827672..276ff8a2d87 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/version.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/_version.py @@ -1,13 +1,10 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.2.0" +VERSION = "6.1.0" diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/version.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/aio/__init__.py similarity index 71% rename from src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/version.py rename to src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/aio/__init__.py index 0ec2fae7a62..39f10548873 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/version.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/aio/__init__.py @@ -1,13 +1,10 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2020-11-01-preview" - +from ._app_platform_management_client import AppPlatformManagementClient +__all__ = ['AppPlatformManagementClient'] diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/aio/_app_platform_management_client.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/aio/_app_platform_management_client.py new file mode 100644 index 00000000000..401fdc29467 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/aio/_app_platform_management_client.py @@ -0,0 +1,364 @@ +# 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. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from azure.profiles import KnownProfiles, ProfileDefinition +from azure.profiles.multiapiclient import MultiApiClientMixin +from msrest import Deserializer, Serializer + +from ._configuration import AppPlatformManagementClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class _SDKClient(object): + def __init__(self, *args, **kwargs): + """This is a fake class to support current implemetation of MultiApiClientMixin." + Will be removed in final version of multiapi azure-core based client + """ + pass + +class AppPlatformManagementClient(MultiApiClientMixin, _SDKClient): + """REST API for Azure Spring Cloud. + + This ready contains multiple API versions, to help you deal with all of the Azure clouds + (Azure Stack, Azure Government, Azure China, etc.). + By default, it uses the latest API version available on public Azure. + For production, you should stick to a particular api-version and/or profile. + The profile sets a mapping between an operation group and its API version. + The api-version parameter sets the default API version if the operation + group is not described in the profile. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param api_version: API version to use if no profile is provided, or if missing in profile. + :type api_version: str + :param base_url: Service URL + :type base_url: str + :param profile: A profile definition, from KnownProfiles to dict. + :type profile: azure.profiles.KnownProfiles + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + DEFAULT_API_VERSION = '2020-07-01' + _PROFILE_TAG = "azure.mgmt.appplatform.AppPlatformManagementClient" + LATEST_PROFILE = ProfileDefinition({ + _PROFILE_TAG: { + None: DEFAULT_API_VERSION, + 'sku': '2019-05-01-preview', + }}, + _PROFILE_TAG + " latest" + ) + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + api_version: Optional[str] = None, + base_url: Optional[str] = None, + profile: KnownProfiles = KnownProfiles.default, + **kwargs # type: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + super(AppPlatformManagementClient, self).__init__( + api_version=api_version, + profile=profile + ) + + @classmethod + def _models_dict(cls, api_version): + return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} + + @classmethod + def models(cls, api_version=DEFAULT_API_VERSION): + """Module depends on the API version: + + * 2019-05-01-preview: :mod:`v2019_05_01_preview.models` + * 2020-07-01: :mod:`v2020_07_01.models` + * 2020-11-01-preview: :mod:`v2020_11_01_preview.models` + * 2021-06-01-preview: :mod:`v2021_06_01_preview.models` + """ + if api_version == '2019-05-01-preview': + from ..v2019_05_01_preview import models + return models + elif api_version == '2020-07-01': + from ..v2020_07_01 import models + return models + elif api_version == '2020-11-01-preview': + from ..v2020_11_01_preview import models + return models + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview import models + return models + raise ValueError("API version {} is not available".format(api_version)) + + @property + def apps(self): + """Instance depends on the API version: + + * 2019-05-01-preview: :class:`AppsOperations` + * 2020-07-01: :class:`AppsOperations` + * 2020-11-01-preview: :class:`AppsOperations` + * 2021-06-01-preview: :class:`AppsOperations` + """ + api_version = self._get_api_version('apps') + if api_version == '2019-05-01-preview': + from ..v2019_05_01_preview.aio.operations import AppsOperations as OperationClass + elif api_version == '2020-07-01': + from ..v2020_07_01.aio.operations import AppsOperations as OperationClass + elif api_version == '2020-11-01-preview': + from ..v2020_11_01_preview.aio.operations import AppsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import AppsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'apps'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def bindings(self): + """Instance depends on the API version: + + * 2019-05-01-preview: :class:`BindingsOperations` + * 2020-07-01: :class:`BindingsOperations` + * 2020-11-01-preview: :class:`BindingsOperations` + * 2021-06-01-preview: :class:`BindingsOperations` + """ + api_version = self._get_api_version('bindings') + if api_version == '2019-05-01-preview': + from ..v2019_05_01_preview.aio.operations import BindingsOperations as OperationClass + elif api_version == '2020-07-01': + from ..v2020_07_01.aio.operations import BindingsOperations as OperationClass + elif api_version == '2020-11-01-preview': + from ..v2020_11_01_preview.aio.operations import BindingsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import BindingsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'bindings'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def certificates(self): + """Instance depends on the API version: + + * 2019-05-01-preview: :class:`CertificatesOperations` + * 2020-07-01: :class:`CertificatesOperations` + * 2020-11-01-preview: :class:`CertificatesOperations` + * 2021-06-01-preview: :class:`CertificatesOperations` + """ + api_version = self._get_api_version('certificates') + if api_version == '2019-05-01-preview': + from ..v2019_05_01_preview.aio.operations import CertificatesOperations as OperationClass + elif api_version == '2020-07-01': + from ..v2020_07_01.aio.operations import CertificatesOperations as OperationClass + elif api_version == '2020-11-01-preview': + from ..v2020_11_01_preview.aio.operations import CertificatesOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import CertificatesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'certificates'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def config_servers(self): + """Instance depends on the API version: + + * 2020-07-01: :class:`ConfigServersOperations` + * 2020-11-01-preview: :class:`ConfigServersOperations` + * 2021-06-01-preview: :class:`ConfigServersOperations` + """ + api_version = self._get_api_version('config_servers') + if api_version == '2020-07-01': + from ..v2020_07_01.aio.operations import ConfigServersOperations as OperationClass + elif api_version == '2020-11-01-preview': + from ..v2020_11_01_preview.aio.operations import ConfigServersOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import ConfigServersOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'config_servers'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def custom_domains(self): + """Instance depends on the API version: + + * 2019-05-01-preview: :class:`CustomDomainsOperations` + * 2020-07-01: :class:`CustomDomainsOperations` + * 2020-11-01-preview: :class:`CustomDomainsOperations` + * 2021-06-01-preview: :class:`CustomDomainsOperations` + """ + api_version = self._get_api_version('custom_domains') + if api_version == '2019-05-01-preview': + from ..v2019_05_01_preview.aio.operations import CustomDomainsOperations as OperationClass + elif api_version == '2020-07-01': + from ..v2020_07_01.aio.operations import CustomDomainsOperations as OperationClass + elif api_version == '2020-11-01-preview': + from ..v2020_11_01_preview.aio.operations import CustomDomainsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import CustomDomainsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'custom_domains'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def deployments(self): + """Instance depends on the API version: + + * 2019-05-01-preview: :class:`DeploymentsOperations` + * 2020-07-01: :class:`DeploymentsOperations` + * 2020-11-01-preview: :class:`DeploymentsOperations` + * 2021-06-01-preview: :class:`DeploymentsOperations` + """ + api_version = self._get_api_version('deployments') + if api_version == '2019-05-01-preview': + from ..v2019_05_01_preview.aio.operations import DeploymentsOperations as OperationClass + elif api_version == '2020-07-01': + from ..v2020_07_01.aio.operations import DeploymentsOperations as OperationClass + elif api_version == '2020-11-01-preview': + from ..v2020_11_01_preview.aio.operations import DeploymentsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import DeploymentsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'deployments'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def monitoring_settings(self): + """Instance depends on the API version: + + * 2020-07-01: :class:`MonitoringSettingsOperations` + * 2020-11-01-preview: :class:`MonitoringSettingsOperations` + * 2021-06-01-preview: :class:`MonitoringSettingsOperations` + """ + api_version = self._get_api_version('monitoring_settings') + if api_version == '2020-07-01': + from ..v2020_07_01.aio.operations import MonitoringSettingsOperations as OperationClass + elif api_version == '2020-11-01-preview': + from ..v2020_11_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'monitoring_settings'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def operations(self): + """Instance depends on the API version: + + * 2019-05-01-preview: :class:`Operations` + * 2020-07-01: :class:`Operations` + * 2020-11-01-preview: :class:`Operations` + * 2021-06-01-preview: :class:`Operations` + """ + api_version = self._get_api_version('operations') + if api_version == '2019-05-01-preview': + from ..v2019_05_01_preview.aio.operations import Operations as OperationClass + elif api_version == '2020-07-01': + from ..v2020_07_01.aio.operations import Operations as OperationClass + elif api_version == '2020-11-01-preview': + from ..v2020_11_01_preview.aio.operations import Operations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import Operations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def runtime_versions(self): + """Instance depends on the API version: + + * 2019-05-01-preview: :class:`RuntimeVersionsOperations` + * 2020-07-01: :class:`RuntimeVersionsOperations` + * 2020-11-01-preview: :class:`RuntimeVersionsOperations` + * 2021-06-01-preview: :class:`RuntimeVersionsOperations` + """ + api_version = self._get_api_version('runtime_versions') + if api_version == '2019-05-01-preview': + from ..v2019_05_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass + elif api_version == '2020-07-01': + from ..v2020_07_01.aio.operations import RuntimeVersionsOperations as OperationClass + elif api_version == '2020-11-01-preview': + from ..v2020_11_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'runtime_versions'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def services(self): + """Instance depends on the API version: + + * 2019-05-01-preview: :class:`ServicesOperations` + * 2020-07-01: :class:`ServicesOperations` + * 2020-11-01-preview: :class:`ServicesOperations` + * 2021-06-01-preview: :class:`ServicesOperations` + """ + api_version = self._get_api_version('services') + if api_version == '2019-05-01-preview': + from ..v2019_05_01_preview.aio.operations import ServicesOperations as OperationClass + elif api_version == '2020-07-01': + from ..v2020_07_01.aio.operations import ServicesOperations as OperationClass + elif api_version == '2020-11-01-preview': + from ..v2020_11_01_preview.aio.operations import ServicesOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import ServicesOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'services'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def sku(self): + """Instance depends on the API version: + + * 2019-05-01-preview: :class:`SkuOperations` + """ + api_version = self._get_api_version('sku') + if api_version == '2019-05-01-preview': + from ..v2019_05_01_preview.aio.operations import SkuOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'sku'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def skus(self): + """Instance depends on the API version: + + * 2020-07-01: :class:`SkusOperations` + * 2020-11-01-preview: :class:`SkusOperations` + * 2021-06-01-preview: :class:`SkusOperations` + """ + api_version = self._get_api_version('skus') + if api_version == '2020-07-01': + from ..v2020_07_01.aio.operations import SkusOperations as OperationClass + elif api_version == '2020-11-01-preview': + from ..v2020_11_01_preview.aio.operations import SkusOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import SkusOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'skus'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + async def close(self): + await self._client.close() + async def __aenter__(self): + await self._client.__aenter__() + return self + async def __aexit__(self, *exc_details): + await self._client.__aexit__(*exc_details) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/aio/_configuration.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/aio/_configuration.py new file mode 100644 index 00000000000..d383d0e0754 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/aio/_configuration.py @@ -0,0 +1,67 @@ +# 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. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class AppPlatformManagementClientConfiguration(Configuration): + """Configuration for AppPlatformManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs # type: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'azure-mgmt-appplatform/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/py.typed b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/__init__.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/__init__.py index ee44eafce0f..d2ddf950056 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/__init__.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/__init__.py @@ -1,19 +1,19 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._configuration import AppPlatformManagementClientConfiguration from ._app_platform_management_client import AppPlatformManagementClient -__all__ = ['AppPlatformManagementClient', 'AppPlatformManagementClientConfiguration'] - -from .version import VERSION +from ._version import VERSION __version__ = VERSION +__all__ = ['AppPlatformManagementClient'] +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/_app_platform_management_client.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/_app_platform_management_client.py index a0ff01ceabf..82ff1e7eeb2 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/_app_platform_management_client.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/_app_platform_management_client.py @@ -1,16 +1,22 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import SDKClient -from msrest import Serializer, Deserializer +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import AppPlatformManagementClientConfiguration from .operations import ServicesOperations @@ -25,67 +31,99 @@ from . import models -class AppPlatformManagementClient(SDKClient): - """REST API for Azure Spring Cloud +class AppPlatformManagementClient(object): + """REST API for Azure Spring Cloud. - :ivar config: Configuration for client. - :vartype config: AppPlatformManagementClientConfiguration - - :ivar services: Services operations + :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2019_05_01_preview.operations.ServicesOperations - :ivar apps: Apps operations + :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2019_05_01_preview.operations.AppsOperations - :ivar bindings: Bindings operations + :ivar bindings: BindingsOperations operations :vartype bindings: azure.mgmt.appplatform.v2019_05_01_preview.operations.BindingsOperations - :ivar certificates: Certificates operations + :ivar certificates: CertificatesOperations operations :vartype certificates: azure.mgmt.appplatform.v2019_05_01_preview.operations.CertificatesOperations - :ivar custom_domains: CustomDomains operations + :ivar custom_domains: CustomDomainsOperations operations :vartype custom_domains: azure.mgmt.appplatform.v2019_05_01_preview.operations.CustomDomainsOperations - :ivar deployments: Deployments operations + :ivar deployments: DeploymentsOperations operations :vartype deployments: azure.mgmt.appplatform.v2019_05_01_preview.operations.DeploymentsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2019_05_01_preview.operations.Operations - :ivar runtime_versions: RuntimeVersions operations + :ivar runtime_versions: RuntimeVersionsOperations operations :vartype runtime_versions: azure.mgmt.appplatform.v2019_05_01_preview.operations.RuntimeVersionsOperations - :ivar sku: Sku operations + :ivar sku: SkuOperations operations :vartype sku: azure.mgmt.appplatform.v2019_05_01_preview.operations.SkuOperations - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Gets subscription ID which uniquely identify the - Microsoft Azure subscription. The subscription ID forms part of the URI - for every service call. + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = AppPlatformManagementClientConfiguration(credentials, subscription_id, base_url) - super(AppPlatformManagementClient, self).__init__(self.config.credentials, self.config) + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2019-05-01-preview' self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.services = ServicesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.apps = AppsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.bindings = BindingsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.certificates = CertificatesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.custom_domains = CustomDomainsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.deployments = DeploymentsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.operations = Operations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.runtime_versions = RuntimeVersionsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.sku = SkuOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> AppPlatformManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/_configuration.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/_configuration.py index 5a7f3752f05..18a7e2758d0 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/_configuration.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/_configuration.py @@ -1,50 +1,71 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrestazure import AzureConfiguration -from .version import VERSION +from typing import TYPE_CHECKING +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class AppPlatformManagementClientConfiguration(Configuration): + """Configuration for AppPlatformManagementClient. -class AppPlatformManagementClientConfiguration(AzureConfiguration): - """Configuration for AppPlatformManagementClient Note that all parameters used to create this instance are saved as instance attributes. - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Gets subscription ID which uniquely identify the - Microsoft Azure subscription. The subscription ID forms part of the URI - for every service call. + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - if not base_url: - base_url = 'https://management.azure.com' - - super(AppPlatformManagementClientConfiguration, self).__init__(base_url) - - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) - self.add_user_agent('azure-mgmt-appplatform/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials + self.credential = credential self.subscription_id = subscription_id + self.api_version = "2019-05-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/_metadata.json b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/_metadata.json new file mode 100644 index 00000000000..ed50cf259b5 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/_metadata.json @@ -0,0 +1,111 @@ +{ + "chosen_version": "2019-05-01-preview", + "total_api_version_list": ["2019-05-01-preview"], + "client": { + "name": "AppPlatformManagementClient", + "filename": "_app_platform_management_client", + "description": "REST API for Azure Spring Cloud.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "services": "ServicesOperations", + "apps": "AppsOperations", + "bindings": "BindingsOperations", + "certificates": "CertificatesOperations", + "custom_domains": "CustomDomainsOperations", + "deployments": "DeploymentsOperations", + "operations": "Operations", + "runtime_versions": "RuntimeVersionsOperations", + "sku": "SkuOperations" + } +} \ No newline at end of file diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/version.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/_version.py similarity index 83% rename from src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/version.py rename to src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/_version.py index e001913245a..92453d8691d 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/version.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/_version.py @@ -1,13 +1,9 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2020-07-01" - +VERSION = "6.1.0" diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/__init__.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/__init__.py new file mode 100644 index 00000000000..39f10548873 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/__init__.py @@ -0,0 +1,10 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._app_platform_management_client import AppPlatformManagementClient +__all__ = ['AppPlatformManagementClient'] diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/_app_platform_management_client.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/_app_platform_management_client.py new file mode 100644 index 00000000000..c4e9e2ac7f5 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/_app_platform_management_client.py @@ -0,0 +1,122 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import ServicesOperations +from .operations import AppsOperations +from .operations import BindingsOperations +from .operations import CertificatesOperations +from .operations import CustomDomainsOperations +from .operations import DeploymentsOperations +from .operations import Operations +from .operations import RuntimeVersionsOperations +from .operations import SkuOperations +from .. import models + + +class AppPlatformManagementClient(object): + """REST API for Azure Spring Cloud. + + :ivar services: ServicesOperations operations + :vartype services: azure.mgmt.appplatform.v2019_05_01_preview.aio.operations.ServicesOperations + :ivar apps: AppsOperations operations + :vartype apps: azure.mgmt.appplatform.v2019_05_01_preview.aio.operations.AppsOperations + :ivar bindings: BindingsOperations operations + :vartype bindings: azure.mgmt.appplatform.v2019_05_01_preview.aio.operations.BindingsOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.appplatform.v2019_05_01_preview.aio.operations.CertificatesOperations + :ivar custom_domains: CustomDomainsOperations operations + :vartype custom_domains: azure.mgmt.appplatform.v2019_05_01_preview.aio.operations.CustomDomainsOperations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: azure.mgmt.appplatform.v2019_05_01_preview.aio.operations.DeploymentsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.appplatform.v2019_05_01_preview.aio.operations.Operations + :ivar runtime_versions: RuntimeVersionsOperations operations + :vartype runtime_versions: azure.mgmt.appplatform.v2019_05_01_preview.aio.operations.RuntimeVersionsOperations + :ivar sku: SkuOperations operations + :vartype sku: azure.mgmt.appplatform.v2019_05_01_preview.aio.operations.SkuOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.services = ServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.sku = SkuOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "AppPlatformManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/_configuration.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/_configuration.py new file mode 100644 index 00000000000..a5e13e26a08 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/_configuration.py @@ -0,0 +1,67 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class AppPlatformManagementClientConfiguration(Configuration): + """Configuration for AppPlatformManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2019-05-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/__init__.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/__init__.py new file mode 100644 index 00000000000..52627bc6018 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/__init__.py @@ -0,0 +1,29 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._services_operations import ServicesOperations +from ._apps_operations import AppsOperations +from ._bindings_operations import BindingsOperations +from ._certificates_operations import CertificatesOperations +from ._custom_domains_operations import CustomDomainsOperations +from ._deployments_operations import DeploymentsOperations +from ._operations import Operations +from ._runtime_versions_operations import RuntimeVersionsOperations +from ._sku_operations import SkuOperations + +__all__ = [ + 'ServicesOperations', + 'AppsOperations', + 'BindingsOperations', + 'CertificatesOperations', + 'CustomDomainsOperations', + 'DeploymentsOperations', + 'Operations', + 'RuntimeVersionsOperations', + 'SkuOperations', +] diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_apps_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_apps_operations.py new file mode 100644 index 00000000000..14016781710 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_apps_operations.py @@ -0,0 +1,582 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AppsOperations: + """AppsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2019_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + sync_status: Optional[str] = None, + **kwargs: Any + ) -> "_models.AppResource": + """Get an App and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param sync_status: Indicates whether sync status. + :type sync_status: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if sync_status is not None: + query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.AppResource"]: + """Create a new App or update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param app_resource: Parameters for the create or update operation. + :type app_resource: ~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> None: + """Operation to delete an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.AppResource"]: + """Operation to update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param app_resource: Parameters for the update operation. + :type app_resource: ~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.AppResourceCollection"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AppResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + + async def get_resource_upload_url( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> "_models.ResourceUploadDefinition": + """Get an resource upload URL for an App, which may be artifacts or source archive. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceUploadDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceUploadDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_resource_upload_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_bindings_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_bindings_operations.py new file mode 100644 index 00000000000..713c34adbbd --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_bindings_operations.py @@ -0,0 +1,402 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BindingsOperations: + """BindingsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2019_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> "_models.BindingResource": + """Get a Binding and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BindingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": + """Create a new Binding or update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :param binding_resource: Parameters for the create or update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BindingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> None: + """Operation to delete a Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": + """Operation to update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :param binding_resource: Parameters for the update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BindingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BindingResourceCollection"]: + """Handles requests to list all resources in an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_certificates_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_certificates_operations.py new file mode 100644 index 00000000000..b8b4fd41472 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_certificates_operations.py @@ -0,0 +1,311 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CertificatesOperations: + """CertificatesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2019_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> "_models.CertificateResource": + """Get the certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> "_models.CertificateResource": + """Create or update certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :param certificate_resource: Parameters for the create or update operation. + :type certificate_resource: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_resource, 'CertificateResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> None: + """Delete the certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.CertificateResourceCollection"]: + """List all the certificates of one user. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_custom_domains_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_custom_domains_operations.py new file mode 100644 index 00000000000..34096d1ba4d --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_custom_domains_operations.py @@ -0,0 +1,473 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CustomDomainsOperations: + """CustomDomainsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2019_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.CustomDomainResource": + """Get the custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": + """Create or update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> None: + """Delete the custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + async def patch( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": + """Update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.patch.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.CustomDomainResourceCollection"]: + """List the custom domains of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore + + async def validate( + self, + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: "_models.CustomDomainValidatePayload", + **kwargs: Any + ) -> "_models.CustomDomainValidateResult": + """Check the resource name is valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param validate_payload: + :type validate_payload: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainValidatePayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainValidateResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.validate.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/validate'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_deployments_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_deployments_operations.py new file mode 100644 index 00000000000..a4d1214cce2 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_deployments_operations.py @@ -0,0 +1,1066 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DeploymentsOperations: + """DeploymentsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2019_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> "_models.DeploymentResource": + """Get a Deployment and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.DeploymentResource"]: + """Create a new Deployment or update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param deployment_resource: Parameters for the create or update operation. + :type deployment_resource: ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + """Operation to delete a Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.DeploymentResource"]: + """Operation to update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param deployment_resource: Parameters for the update operation. + :type deployment_resource: ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DeploymentResourceCollection"]: + """Handles requests to list all resources in an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param version: Version of the deployments to be listed. + :type version: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore + + def list_cluster_all_deployments( + self, + resource_group_name: str, + service_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DeploymentResourceCollection"]: + """List deployments for a certain service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param version: Version of the deployments to be listed. + :type version: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_cluster_all_deployments.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_cluster_all_deployments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore + + async def _start_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + + async def begin_start( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Start the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + + async def _stop_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + + async def begin_stop( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Stop the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._stop_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + + async def _restart_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + + async def begin_restart( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restart the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + + async def get_log_file_url( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> Optional["_models.LogFileUrlResponse"]: + """Get deployment log file URL. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogFileUrlResponse, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.LogFileUrlResponse or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LogFileUrlResponse"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_log_file_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LogFileUrlResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_operations.py new file mode 100644 index 00000000000..8f6523f5508 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_operations.py @@ -0,0 +1,104 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2019_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.AvailableOperations"]: + """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailableOperations or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.AvailableOperations] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AvailableOperations', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_runtime_versions_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_runtime_versions_operations.py new file mode 100644 index 00000000000..9d18f835614 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_runtime_versions_operations.py @@ -0,0 +1,87 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RuntimeVersionsOperations: + """RuntimeVersionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2019_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list_runtime_versions( + self, + **kwargs: Any + ) -> "_models.AvailableRuntimeVersions": + """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailableRuntimeVersions, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.AvailableRuntimeVersions + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableRuntimeVersions"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_runtime_versions.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AvailableRuntimeVersions', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_services_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_services_operations.py new file mode 100644 index 00000000000..dc2d7751049 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_services_operations.py @@ -0,0 +1,910 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ServicesOperations: + """ServicesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2019_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ServiceResource": + """Get a Service and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ServiceResource"]: + """Create a new Service or update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param resource: Parameters for the create or update operation. + :type resource: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ServiceResource"]: + """Operation to update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param resource: Parameters for the update operation. + :type resource: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def list_test_keys( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": + """List test keys for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_test_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + + async def regenerate_test_key( + self, + resource_group_name: str, + service_name: str, + regenerate_test_key_request: "_models.RegenerateTestKeyRequestPayload", + **kwargs: Any + ) -> "_models.TestKeys": + """Regenerate a test key for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param regenerate_test_key_request: Parameters for the operation. + :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2019_05_01_preview.models.RegenerateTestKeyRequestPayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_test_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore + + async def disable_test_endpoint( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: + """disable_test_endpoint. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.disable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + + async def enable_test_endpoint( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": + """enable_test_endpoint. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + # Construct URL + url = self.enable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore + + async def check_name_availability( + self, + location: str, + availability_parameters: "_models.NameAvailabilityParameters", + **kwargs: Any + ) -> "_models.NameAvailability": + """Checks that the resource name is valid and is not already in use. + + :param location: the region. + :type location: str + :param availability_parameters: Parameters supplied to the operation. + :type availability_parameters: ~azure.mgmt.appplatform.v2019_05_01_preview.models.NameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.NameAvailability + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailability"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NameAvailability', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ServiceResourceList"]: + """Handles requests to list all resources in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ServiceResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + + def list( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ServiceResourceList"]: + """Handles requests to list all resources in a resource group. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ServiceResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_sku_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_sku_operations.py new file mode 100644 index 00000000000..a7111308ab8 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/aio/operations/_sku_operations.py @@ -0,0 +1,108 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SkuOperations: + """SkuOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2019_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ResourceSkuCollection"]: + """list. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/models/__init__.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/models/__init__.py index e14ef4761e6..ca288c598cf 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/models/__init__.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/models/__init__.py @@ -1,32 +1,36 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- try: from ._models_py3 import AppResource + from ._models_py3 import AppResourceCollection from ._models_py3 import AppResourceProperties + from ._models_py3 import AvailableOperations from ._models_py3 import AvailableRuntimeVersions from ._models_py3 import BindingResource + from ._models_py3 import BindingResourceCollection from ._models_py3 import BindingResourceProperties from ._models_py3 import CertificateProperties from ._models_py3 import CertificateResource + from ._models_py3 import CertificateResourceCollection + from ._models_py3 import CloudErrorBody from ._models_py3 import ClusterResourceProperties from ._models_py3 import ConfigServerGitProperty from ._models_py3 import ConfigServerProperties from ._models_py3 import ConfigServerSettings from ._models_py3 import CustomDomainProperties from ._models_py3 import CustomDomainResource + from ._models_py3 import CustomDomainResourceCollection from ._models_py3 import CustomDomainValidatePayload from ._models_py3 import CustomDomainValidateResult from ._models_py3 import DeploymentInstance from ._models_py3 import DeploymentResource + from ._models_py3 import DeploymentResourceCollection from ._models_py3 import DeploymentResourceProperties from ._models_py3 import DeploymentSettings from ._models_py3 import Error @@ -50,12 +54,14 @@ from ._models_py3 import Resource from ._models_py3 import ResourceSku from ._models_py3 import ResourceSkuCapabilities + from ._models_py3 import ResourceSkuCollection from ._models_py3 import ResourceSkuLocationInfo from ._models_py3 import ResourceSkuRestrictionInfo from ._models_py3 import ResourceSkuRestrictions from ._models_py3 import ResourceSkuZoneDetails from ._models_py3 import ResourceUploadDefinition from ._models_py3 import ServiceResource + from ._models_py3 import ServiceResourceList from ._models_py3 import ServiceSpecification from ._models_py3 import Sku from ._models_py3 import SkuCapacity @@ -66,106 +72,115 @@ from ._models_py3 import TrackedResource from ._models_py3 import UserSourceInfo except (SyntaxError, ImportError): - from ._models import AppResource - from ._models import AppResourceProperties - from ._models import AvailableRuntimeVersions - from ._models import BindingResource - from ._models import BindingResourceProperties - from ._models import CertificateProperties - from ._models import CertificateResource - from ._models import ClusterResourceProperties - from ._models import ConfigServerGitProperty - from ._models import ConfigServerProperties - from ._models import ConfigServerSettings - from ._models import CustomDomainProperties - from ._models import CustomDomainResource - from ._models import CustomDomainValidatePayload - from ._models import CustomDomainValidateResult - from ._models import DeploymentInstance - from ._models import DeploymentResource - from ._models import DeploymentResourceProperties - from ._models import DeploymentSettings - from ._models import Error - from ._models import GitPatternRepository - from ._models import LogFileUrlResponse - from ._models import LogSpecification - from ._models import ManagedIdentityProperties - from ._models import MetricDimension - from ._models import MetricSpecification - from ._models import NameAvailability - from ._models import NameAvailabilityParameters - from ._models import NetworkProfile - from ._models import NetworkProfileOutboundIPs - from ._models import OperationDetail - from ._models import OperationDisplay - from ._models import OperationProperties - from ._models import PersistentDisk - from ._models import ProxyResource - from ._models import RegenerateTestKeyRequestPayload - from ._models import RequiredTraffic - from ._models import Resource - from ._models import ResourceSku - from ._models import ResourceSkuCapabilities - from ._models import ResourceSkuLocationInfo - from ._models import ResourceSkuRestrictionInfo - from ._models import ResourceSkuRestrictions - from ._models import ResourceSkuZoneDetails - from ._models import ResourceUploadDefinition - from ._models import ServiceResource - from ._models import ServiceSpecification - from ._models import Sku - from ._models import SkuCapacity - from ._models import SupportedRuntimeVersion - from ._models import TemporaryDisk - from ._models import TestKeys - from ._models import TraceProperties - from ._models import TrackedResource - from ._models import UserSourceInfo -from ._paged_models import AppResourcePaged -from ._paged_models import BindingResourcePaged -from ._paged_models import CertificateResourcePaged -from ._paged_models import CustomDomainResourcePaged -from ._paged_models import DeploymentResourcePaged -from ._paged_models import OperationDetailPaged -from ._paged_models import ResourceSkuPaged -from ._paged_models import ServiceResourcePaged + from ._models import AppResource # type: ignore + from ._models import AppResourceCollection # type: ignore + from ._models import AppResourceProperties # type: ignore + from ._models import AvailableOperations # type: ignore + from ._models import AvailableRuntimeVersions # type: ignore + from ._models import BindingResource # type: ignore + from ._models import BindingResourceCollection # type: ignore + from ._models import BindingResourceProperties # type: ignore + from ._models import CertificateProperties # type: ignore + from ._models import CertificateResource # type: ignore + from ._models import CertificateResourceCollection # type: ignore + from ._models import CloudErrorBody # type: ignore + from ._models import ClusterResourceProperties # type: ignore + from ._models import ConfigServerGitProperty # type: ignore + from ._models import ConfigServerProperties # type: ignore + from ._models import ConfigServerSettings # type: ignore + from ._models import CustomDomainProperties # type: ignore + from ._models import CustomDomainResource # type: ignore + from ._models import CustomDomainResourceCollection # type: ignore + from ._models import CustomDomainValidatePayload # type: ignore + from ._models import CustomDomainValidateResult # type: ignore + from ._models import DeploymentInstance # type: ignore + from ._models import DeploymentResource # type: ignore + from ._models import DeploymentResourceCollection # type: ignore + from ._models import DeploymentResourceProperties # type: ignore + from ._models import DeploymentSettings # type: ignore + from ._models import Error # type: ignore + from ._models import GitPatternRepository # type: ignore + from ._models import LogFileUrlResponse # type: ignore + from ._models import LogSpecification # type: ignore + from ._models import ManagedIdentityProperties # type: ignore + from ._models import MetricDimension # type: ignore + from ._models import MetricSpecification # type: ignore + from ._models import NameAvailability # type: ignore + from ._models import NameAvailabilityParameters # type: ignore + from ._models import NetworkProfile # type: ignore + from ._models import NetworkProfileOutboundIPs # type: ignore + from ._models import OperationDetail # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationProperties # type: ignore + from ._models import PersistentDisk # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import RegenerateTestKeyRequestPayload # type: ignore + from ._models import RequiredTraffic # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceSku # type: ignore + from ._models import ResourceSkuCapabilities # type: ignore + from ._models import ResourceSkuCollection # type: ignore + from ._models import ResourceSkuLocationInfo # type: ignore + from ._models import ResourceSkuRestrictionInfo # type: ignore + from ._models import ResourceSkuRestrictions # type: ignore + from ._models import ResourceSkuZoneDetails # type: ignore + from ._models import ResourceUploadDefinition # type: ignore + from ._models import ServiceResource # type: ignore + from ._models import ServiceResourceList # type: ignore + from ._models import ServiceSpecification # type: ignore + from ._models import Sku # type: ignore + from ._models import SkuCapacity # type: ignore + from ._models import SupportedRuntimeVersion # type: ignore + from ._models import TemporaryDisk # type: ignore + from ._models import TestKeys # type: ignore + from ._models import TraceProperties # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import UserSourceInfo # type: ignore + from ._app_platform_management_client_enums import ( - ProvisioningState, - ConfigServerState, - TraceProxyState, - TrafficDirection, - ManagedIdentityType, - TestKeyType, AppResourceProvisioningState, - UserSourceType, - RuntimeVersion, + ConfigServerState, DeploymentResourceProvisioningState, DeploymentResourceStatus, - SkuScaleType, - ResourceSkuRestrictionsType, + ManagedIdentityType, + ProvisioningState, ResourceSkuRestrictionsReasonCode, - SupportedRuntimeValue, + ResourceSkuRestrictionsType, + RuntimeVersion, + SkuScaleType, SupportedRuntimePlatform, + SupportedRuntimeValue, + TestKeyType, + TraceProxyState, + TrafficDirection, + UserSourceType, ) __all__ = [ 'AppResource', + 'AppResourceCollection', 'AppResourceProperties', + 'AvailableOperations', 'AvailableRuntimeVersions', 'BindingResource', + 'BindingResourceCollection', 'BindingResourceProperties', 'CertificateProperties', 'CertificateResource', + 'CertificateResourceCollection', + 'CloudErrorBody', 'ClusterResourceProperties', 'ConfigServerGitProperty', 'ConfigServerProperties', 'ConfigServerSettings', 'CustomDomainProperties', 'CustomDomainResource', + 'CustomDomainResourceCollection', 'CustomDomainValidatePayload', 'CustomDomainValidateResult', 'DeploymentInstance', 'DeploymentResource', + 'DeploymentResourceCollection', 'DeploymentResourceProperties', 'DeploymentSettings', 'Error', @@ -189,12 +204,14 @@ 'Resource', 'ResourceSku', 'ResourceSkuCapabilities', + 'ResourceSkuCollection', 'ResourceSkuLocationInfo', 'ResourceSkuRestrictionInfo', 'ResourceSkuRestrictions', 'ResourceSkuZoneDetails', 'ResourceUploadDefinition', 'ServiceResource', + 'ServiceResourceList', 'ServiceSpecification', 'Sku', 'SkuCapacity', @@ -204,28 +221,20 @@ 'TraceProperties', 'TrackedResource', 'UserSourceInfo', - 'ServiceResourcePaged', - 'AppResourcePaged', - 'BindingResourcePaged', - 'CertificateResourcePaged', - 'CustomDomainResourcePaged', - 'DeploymentResourcePaged', - 'OperationDetailPaged', - 'ResourceSkuPaged', - 'ProvisioningState', - 'ConfigServerState', - 'TraceProxyState', - 'TrafficDirection', - 'ManagedIdentityType', - 'TestKeyType', 'AppResourceProvisioningState', - 'UserSourceType', - 'RuntimeVersion', + 'ConfigServerState', 'DeploymentResourceProvisioningState', 'DeploymentResourceStatus', - 'SkuScaleType', - 'ResourceSkuRestrictionsType', + 'ManagedIdentityType', + 'ProvisioningState', 'ResourceSkuRestrictionsReasonCode', - 'SupportedRuntimeValue', + 'ResourceSkuRestrictionsType', + 'RuntimeVersion', + 'SkuScaleType', 'SupportedRuntimePlatform', + 'SupportedRuntimeValue', + 'TestKeyType', + 'TraceProxyState', + 'TrafficDirection', + 'UserSourceType', ] diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/models/_app_platform_management_client_enums.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/models/_app_platform_management_client_enums.py index 86e2ecb6f68..21a74a5c953 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/models/_app_platform_management_client_enums.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/models/_app_platform_management_client_enums.py @@ -1,137 +1,167 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum - - -class ProvisioningState(str, Enum): - - creating = "Creating" - updating = "Updating" - deleting = "Deleting" - deleted = "Deleted" - succeeded = "Succeeded" - failed = "Failed" - moving = "Moving" - moved = "Moved" - move_failed = "MoveFailed" - - -class ConfigServerState(str, Enum): - - not_available = "NotAvailable" - deleted = "Deleted" - failed = "Failed" - succeeded = "Succeeded" - updating = "Updating" - - -class TraceProxyState(str, Enum): - - not_available = "NotAvailable" - failed = "Failed" - succeeded = "Succeeded" - updating = "Updating" - - -class TrafficDirection(str, Enum): - - inbound = "Inbound" - outbound = "Outbound" - - -class ManagedIdentityType(str, Enum): - - none = "None" - system_assigned = "SystemAssigned" - user_assigned = "UserAssigned" - system_assigned_user_assigned = "SystemAssigned,UserAssigned" - - -class TestKeyType(str, Enum): - - primary = "Primary" - secondary = "Secondary" - - -class AppResourceProvisioningState(str, Enum): - - succeeded = "Succeeded" - failed = "Failed" - creating = "Creating" - updating = "Updating" - deleting = "Deleting" - - -class UserSourceType(str, Enum): - - jar = "Jar" - net_core_zip = "NetCoreZip" - source = "Source" - - -class RuntimeVersion(str, Enum): - - java_8 = "Java_8" - java_11 = "Java_11" - net_core_31 = "NetCore_31" - - -class DeploymentResourceProvisioningState(str, Enum): - - creating = "Creating" - updating = "Updating" - succeeded = "Succeeded" - failed = "Failed" - deleting = "Deleting" - - -class DeploymentResourceStatus(str, Enum): - - unknown = "Unknown" - stopped = "Stopped" - running = "Running" - failed = "Failed" - allocating = "Allocating" - upgrading = "Upgrading" - compiling = "Compiling" - - -class SkuScaleType(str, Enum): - - none = "None" - manual = "Manual" - automatic = "Automatic" - - -class ResourceSkuRestrictionsType(str, Enum): - - location = "Location" - zone = "Zone" - - -class ResourceSkuRestrictionsReasonCode(str, Enum): - - quota_id = "QuotaId" - not_available_for_subscription = "NotAvailableForSubscription" - - -class SupportedRuntimeValue(str, Enum): - - java_8 = "Java_8" - java_11 = "Java_11" - net_core_31 = "NetCore_31" - - -class SupportedRuntimePlatform(str, Enum): - - java = "Java" - net_core = ".NET Core" +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the App + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + +class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State of the config server. + """ + + NOT_AVAILABLE = "NotAvailable" + DELETED = "Deleted" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + +class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Deployment + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of the Deployment + """ + + UNKNOWN = "Unknown" + STOPPED = "Stopped" + RUNNING = "Running" + FAILED = "Failed" + ALLOCATING = "Allocating" + UPGRADING = "Upgrading" + COMPILING = "Compiling" + +class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Service + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + DELETED = "Deleted" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + MOVING = "Moving" + MOVED = "Moved" + MOVE_FAILED = "MoveFailed" + +class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription' + """ + + QUOTA_ID = "QuotaId" + NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" + +class ResourceSkuRestrictionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Gets the type of restrictions. Possible values include: 'Location', 'Zone' + """ + + LOCATION = "Location" + ZONE = "Zone" + +class RuntimeVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Runtime version + """ + + JAVA8 = "Java_8" + JAVA11 = "Java_11" + NET_CORE31 = "NetCore_31" + +class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Gets or sets the type of the scale. + """ + + NONE = "None" + MANUAL = "Manual" + AUTOMATIC = "Automatic" + +class SupportedRuntimePlatform(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The platform of this runtime version (possible values: "Java" or ".NET"). + """ + + JAVA = "Java" + _NET_CORE = ".NET Core" + +class SupportedRuntimeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The raw value which could be passed to deployment CRUD operations. + """ + + JAVA8 = "Java_8" + JAVA11 = "Java_11" + NET_CORE31 = "NetCore_31" + +class TestKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the test key + """ + + PRIMARY = "Primary" + SECONDARY = "Secondary" + +class TraceProxyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State of the trace proxy. + """ + + NOT_AVAILABLE = "NotAvailable" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + +class TrafficDirection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The direction of required traffic + """ + + INBOUND = "Inbound" + OUTBOUND = "Outbound" + +class UserSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the source uploaded + """ + + JAR = "Jar" + NET_CORE_ZIP = "NetCoreZip" + SOURCE = "Source" diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/models/_models.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/models/_models.py index 1110020745d..8e0cc5fe573 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/models/_models.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/models/_models.py @@ -1,23 +1,18 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +import msrest.serialization -class Resource(Model): +class Resource(msrest.serialization.Model): """The core properties of ARM resources. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -39,7 +34,10 @@ class Resource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -47,11 +45,9 @@ def __init__(self, **kwargs): class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have - everything other than required location and tags. + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -73,15 +69,17 @@ class ProxyResource(Resource): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ProxyResource, self).__init__(**kwargs) class AppResource(ProxyResource): """App resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -89,14 +87,11 @@ class AppResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the App resource - :type properties: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResourceProperties - :param identity: The Managed Identity type of the app resource - :type identity: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.ManagedIdentityProperties - :param location: The GEO location of the application, always the same with - its parent resource + :param properties: Properties of the App resource. + :type properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResourceProperties + :param identity: The Managed Identity type of the app resource. + :type identity: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ManagedIdentityProperties + :param location: The GEO location of the application, always the same with its parent resource. :type location: str """ @@ -115,41 +110,65 @@ class AppResource(ProxyResource): 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.identity = kwargs.get('identity', None) self.location = kwargs.get('location', None) -class AppResourceProperties(Model): +class AppResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :param value: Collection of App resources. + :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AppResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class AppResourceProperties(msrest.serialization.Model): """App resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param public: Indicates whether the App exposes public endpoint + :param public: Indicates whether the App exposes public endpoint. :type public: bool - :ivar url: URL of the App + :ivar url: URL of the App. :vartype url: str - :ivar provisioning_state: Provisioning state of the App. Possible values - include: 'Succeeded', 'Failed', 'Creating', 'Updating', 'Deleting' + :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", + "Failed", "Creating", "Updating", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResourceProvisioningState - :param active_deployment_name: Name of the active deployment of the App + :param active_deployment_name: Name of the active deployment of the App. :type active_deployment_name: str :param fqdn: Fully qualified dns Name. :type fqdn: str :param https_only: Indicate if only https is allowed. :type https_only: bool - :ivar created_time: Date time when the resource is created - :vartype created_time: datetime - :param temporary_disk: Temporary disk settings - :type temporary_disk: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.TemporaryDisk - :param persistent_disk: Persistent disk settings - :type persistent_disk: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.PersistentDisk + :ivar created_time: Date time when the resource is created. + :vartype created_time: ~datetime.datetime + :param temporary_disk: Temporary disk settings. + :type temporary_disk: ~azure.mgmt.appplatform.v2019_05_01_preview.models.TemporaryDisk + :param persistent_disk: Persistent disk settings. + :type persistent_disk: ~azure.mgmt.appplatform.v2019_05_01_preview.models.PersistentDisk """ _validation = { @@ -170,24 +189,50 @@ class AppResourceProperties(Model): 'persistent_disk': {'key': 'persistentDisk', 'type': 'PersistentDisk'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppResourceProperties, self).__init__(**kwargs) self.public = kwargs.get('public', None) self.url = None self.provisioning_state = None self.active_deployment_name = kwargs.get('active_deployment_name', None) self.fqdn = kwargs.get('fqdn', None) - self.https_only = kwargs.get('https_only', None) + self.https_only = kwargs.get('https_only', False) self.created_time = None self.temporary_disk = kwargs.get('temporary_disk', None) self.persistent_disk = kwargs.get('persistent_disk', None) -class AvailableRuntimeVersions(Model): +class AvailableOperations(msrest.serialization.Model): + """Available operations of the service. + + :param value: Collection of available operation details. + :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationDetail] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationDetail]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AvailableOperations, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class AvailableRuntimeVersions(msrest.serialization.Model): """AvailableRuntimeVersions. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar value: A list of all supported runtime versions. :vartype value: @@ -202,7 +247,10 @@ class AvailableRuntimeVersions(Model): 'value': {'key': 'value', 'type': '[SupportedRuntimeVersion]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -210,8 +258,7 @@ def __init__(self, **kwargs): class BindingResource(ProxyResource): """Binding resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -219,9 +266,8 @@ class BindingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Binding resource - :type properties: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResourceProperties + :param properties: Properties of the Binding resource. + :type properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResourceProperties """ _validation = { @@ -237,34 +283,59 @@ class BindingResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'BindingResourceProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BindingResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class BindingResourceProperties(Model): +class BindingResourceCollection(msrest.serialization.Model): + """Object that includes an array of Binding resources and a possible link for next set. + + :param value: Collection of Binding resources. + :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BindingResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BindingResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class BindingResourceProperties(msrest.serialization.Model): """Binding resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar resource_name: The name of the bound resource + :ivar resource_name: The name of the bound resource. :vartype resource_name: str - :ivar resource_type: The standard Azure resource type of the bound - resource + :ivar resource_type: The standard Azure resource type of the bound resource. :vartype resource_type: str - :param resource_id: The Azure resource id of the bound resource + :param resource_id: The Azure resource id of the bound resource. :type resource_id: str - :param key: The key of the bound resource + :param key: The key of the bound resource. :type key: str - :param binding_parameters: Binding parameters of the Binding resource - :type binding_parameters: dict[str, object] - :ivar generated_properties: The generated Spring Boot property file for - this binding. The secret will be deducted. + :param binding_parameters: Binding parameters of the Binding resource. + :type binding_parameters: dict[str, any] + :ivar generated_properties: The generated Spring Boot property file for this binding. The + secret will be deducted. :vartype generated_properties: str - :ivar created_at: Creation time of the Binding resource + :ivar created_at: Creation time of the Binding resource. :vartype created_at: str - :ivar updated_at: Update time of the Binding resource + :ivar updated_at: Update time of the Binding resource. :vartype updated_at: str """ @@ -287,7 +358,10 @@ class BindingResourceProperties(Model): 'updated_at': {'key': 'updatedAt', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -299,11 +373,10 @@ def __init__(self, **kwargs): self.updated_at = None -class CertificateProperties(Model): +class CertificateProperties(msrest.serialization.Model): """Certificate resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -354,11 +427,14 @@ class CertificateProperties(Model): 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateProperties, self).__init__(**kwargs) self.thumbprint = None - self.vault_uri = kwargs.get('vault_uri', None) - self.key_vault_cert_name = kwargs.get('key_vault_cert_name', None) + self.vault_uri = kwargs['vault_uri'] + self.key_vault_cert_name = kwargs['key_vault_cert_name'] self.cert_version = kwargs.get('cert_version', None) self.issuer = None self.issued_date = None @@ -371,8 +447,7 @@ def __init__(self, **kwargs): class CertificateResource(ProxyResource): """Certificate resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -381,8 +456,7 @@ class CertificateResource(ProxyResource): :ivar type: The type of the resource. :vartype type: str :param properties: Properties of the certificate resource payload. - :type properties: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateProperties + :type properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateProperties """ _validation = { @@ -398,55 +472,51 @@ class CertificateResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class CloudError(Model): - """An error response from the service. +class CertificateResourceCollection(msrest.serialization.Model): + """Collection compose of certificate resources list and a possible link for next page. - :param error: - :type error: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.CloudErrorBody + :param value: The certificate resources list. + :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateResource] + :param next_link: The link to next page of certificate list. + :type next_link: str """ _attribute_map = { - 'error': {'key': 'error', 'type': 'CloudErrorBody'}, + 'value': {'key': 'value', 'type': '[CertificateResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): - super(CloudError, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class CloudErrorException(HttpOperationError): - """Server responsed with exception of type: 'CloudError'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + def __init__( + self, + **kwargs + ): + super(CertificateResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) -class CloudErrorBody(Model): +class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are - intended to be consumed programmatically. + :param code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. :type code: str - :param message: A message describing the error, intended to be suitable - for display in a user interface. + :param message: A message describing the error, intended to be suitable for display in a user + interface. :type message: str - :param target: The target of the particular error. For example, the name - of the property in error. + :param target: The target of the particular error. For example, the name of the property in + error. :type target: str :param details: A list of additional details about the error. - :type details: - list[~azure.mgmt.appplatform.v2019_05_01_preview.models.CloudErrorBody] + :type details: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -456,7 +526,10 @@ class CloudErrorBody(Model): 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CloudErrorBody, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -464,31 +537,26 @@ def __init__(self, **kwargs): self.details = kwargs.get('details', None) -class ClusterResourceProperties(Model): +class ClusterResourceProperties(msrest.serialization.Model): """Service properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Provisioning state of the Service. Possible - values include: 'Creating', 'Updating', 'Deleting', 'Deleted', - 'Succeeded', 'Failed', 'Moving', 'Moved', 'MoveFailed' + :ivar provisioning_state: Provisioning state of the Service. Possible values include: + "Creating", "Updating", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", "Moved", + "MoveFailed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.ProvisioningState - :param config_server_properties: Config server git properties of the - Service + :param config_server_properties: Config server git properties of the Service. :type config_server_properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerProperties - :param trace: Trace properties of the Service - :type trace: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.TraceProperties - :param network_profile: Network profile of the Service - :type network_profile: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.NetworkProfile - :ivar version: Version of the Service + :param trace: Trace properties of the Service. + :type trace: ~azure.mgmt.appplatform.v2019_05_01_preview.models.TraceProperties + :param network_profile: Network profile of the Service. + :type network_profile: ~azure.mgmt.appplatform.v2019_05_01_preview.models.NetworkProfile + :ivar version: Version of the Service. :vartype version: int - :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a - created resource + :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. :vartype service_id: str """ @@ -507,7 +575,10 @@ class ClusterResourceProperties(Model): 'service_id': {'key': 'serviceId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.config_server_properties = kwargs.get('config_server_properties', None) @@ -517,7 +588,7 @@ def __init__(self, **kwargs): self.service_id = None -class ConfigServerGitProperty(Model): +class ConfigServerGitProperty(msrest.serialization.Model): """Property of git. All required parameters must be populated in order to send to Azure. @@ -525,11 +596,11 @@ class ConfigServerGitProperty(Model): :param repositories: Repositories of git. :type repositories: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.GitPatternRepository] - :param uri: Required. URI of the repository + :param uri: Required. URI of the repository. :type uri: str - :param label: Label of the repository + :param label: Label of the repository. :type label: str - :param search_paths: Searching path of the repository + :param search_paths: Searching path of the repository. :type search_paths: list[str] :param username: Username of git repository basic auth. :type username: str @@ -562,10 +633,13 @@ class ConfigServerGitProperty(Model): 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = kwargs.get('repositories', None) - self.uri = kwargs.get('uri', None) + self.uri = kwargs['uri'] self.label = kwargs.get('label', None) self.search_paths = kwargs.get('search_paths', None) self.username = kwargs.get('username', None) @@ -576,21 +650,18 @@ def __init__(self, **kwargs): self.strict_host_key_checking = kwargs.get('strict_host_key_checking', None) -class ConfigServerProperties(Model): +class ConfigServerProperties(msrest.serialization.Model): """Config server git properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar state: State of the config server. Possible values include: - 'NotAvailable', 'Deleted', 'Failed', 'Succeeded', 'Updating' - :vartype state: str or - ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerState + :ivar state: State of the config server. Possible values include: "NotAvailable", "Deleted", + "Failed", "Succeeded", "Updating". + :vartype state: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerState :param error: Error when apply config server settings. :type error: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Error :param config_server: Settings of config server. - :type config_server: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerSettings + :type config_server: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerSettings """ _validation = { @@ -603,35 +674,39 @@ class ConfigServerProperties(Model): 'config_server': {'key': 'configServer', 'type': 'ConfigServerSettings'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConfigServerProperties, self).__init__(**kwargs) self.state = None self.error = kwargs.get('error', None) self.config_server = kwargs.get('config_server', None) -class ConfigServerSettings(Model): +class ConfigServerSettings(msrest.serialization.Model): """The settings of config server. :param git_property: Property of git environment. - :type git_property: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerGitProperty + :type git_property: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerGitProperty """ _attribute_map = { 'git_property': {'key': 'gitProperty', 'type': 'ConfigServerGitProperty'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = kwargs.get('git_property', None) -class CustomDomainProperties(Model): +class CustomDomainProperties(msrest.serialization.Model): """Custom domain of app resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param thumbprint: The thumbprint of bound certificate. :type thumbprint: str @@ -651,7 +726,10 @@ class CustomDomainProperties(Model): 'cert_name': {'key': 'certName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = kwargs.get('thumbprint', None) self.app_name = None @@ -661,8 +739,7 @@ def __init__(self, **kwargs): class CustomDomainResource(ProxyResource): """Custom domain resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -671,8 +748,7 @@ class CustomDomainResource(ProxyResource): :ivar type: The type of the resource. :vartype type: str :param properties: Properties of the custom domain resource. - :type properties: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainProperties + :type properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainProperties """ _validation = { @@ -688,17 +764,43 @@ class CustomDomainResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'CustomDomainProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CustomDomainResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class CustomDomainValidatePayload(Model): +class CustomDomainResourceCollection(msrest.serialization.Model): + """Collection compose of a custom domain resources list and a possible link for next page. + + :param value: The custom domain resources list. + :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResource] + :param next_link: The link to next page of custom domain list. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CustomDomainResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomDomainResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class CustomDomainValidatePayload(msrest.serialization.Model): """Custom domain validate payload. All required parameters must be populated in order to send to Azure. - :param name: Required. Name to be validated + :param name: Required. Name to be validated. :type name: str """ @@ -710,12 +812,15 @@ class CustomDomainValidatePayload(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CustomDomainValidatePayload, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + self.name = kwargs['name'] -class CustomDomainValidateResult(Model): +class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. :param is_valid: Indicates if domain name is valid. @@ -729,27 +834,29 @@ class CustomDomainValidateResult(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = kwargs.get('is_valid', None) self.message = kwargs.get('message', None) -class DeploymentInstance(Model): +class DeploymentInstance(msrest.serialization.Model): """Deployment instance payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Name of the deployment instance + :ivar name: Name of the deployment instance. :vartype name: str - :ivar status: Status of the deployment instance + :ivar status: Status of the deployment instance. :vartype status: str - :ivar reason: Failed reason of the deployment instance + :ivar reason: Failed reason of the deployment instance. :vartype reason: str - :ivar discovery_status: Discovery status of the deployment instance + :ivar discovery_status: Discovery status of the deployment instance. :vartype discovery_status: str - :ivar start_time: Start time of the deployment instance + :ivar start_time: Start time of the deployment instance. :vartype start_time: str """ @@ -769,7 +876,10 @@ class DeploymentInstance(Model): 'start_time': {'key': 'startTime', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -781,8 +891,7 @@ def __init__(self, **kwargs): class DeploymentResource(ProxyResource): """Deployment resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -790,10 +899,10 @@ class DeploymentResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Deployment resource + :param properties: Properties of the Deployment resource. :type properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource + :param sku: Sku of the Deployment resource. :type sku: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Sku """ @@ -811,42 +920,65 @@ class DeploymentResource(ProxyResource): 'sku': {'key': 'sku', 'type': 'Sku'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeploymentResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.sku = kwargs.get('sku', None) -class DeploymentResourceProperties(Model): +class DeploymentResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :param value: Collection of Deployment resources. + :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class DeploymentResourceProperties(msrest.serialization.Model): """Deployment resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param source: Uploaded source information of the deployment. - :type source: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.UserSourceInfo - :ivar app_name: App name of the deployment + :type source: ~azure.mgmt.appplatform.v2019_05_01_preview.models.UserSourceInfo + :ivar app_name: App name of the deployment. :vartype app_name: str - :param deployment_settings: Deployment settings of the Deployment + :param deployment_settings: Deployment settings of the Deployment. :type deployment_settings: ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Possible - values include: 'Creating', 'Updating', 'Succeeded', 'Failed', 'Deleting' + :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: + "Creating", "Updating", "Succeeded", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Possible values include: - 'Unknown', 'Stopped', 'Running', 'Failed', 'Allocating', 'Upgrading', - 'Compiling' + :ivar status: Status of the Deployment. Possible values include: "Unknown", "Stopped", + "Running", "Failed", "Allocating", "Upgrading", "Compiling". :vartype status: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResourceStatus - :ivar active: Indicates whether the Deployment is active + :ivar active: Indicates whether the Deployment is active. :vartype active: bool - :ivar created_time: Date time when the resource is created - :vartype created_time: datetime - :ivar instances: Collection of instances belong to the Deployment - :vartype instances: - list[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentInstance] + :ivar created_time: Date time when the resource is created. + :vartype created_time: ~datetime.datetime + :ivar instances: Collection of instances belong to the Deployment. + :vartype instances: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentInstance] """ _validation = { @@ -869,7 +1001,10 @@ class DeploymentResourceProperties(Model): 'instances': {'key': 'instances', 'type': '[DeploymentInstance]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = kwargs.get('source', None) self.app_name = None @@ -881,29 +1016,26 @@ def __init__(self, **kwargs): self.instances = None -class DeploymentSettings(Model): +class DeploymentSettings(msrest.serialization.Model): """Deployment settings payload. - :param cpu: Required CPU, basic tier should be 1, standard tier should be - in range (1, 4). Default value: 1 . + :param cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). :type cpu: int - :param memory_in_gb: Required Memory size in GB, basic tier should be in - range (1, 2), standard tier should be in range (1, 8). Default value: 1 . + :param memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), standard + tier should be in range (1, 8). :type memory_in_gb: int - :param jvm_options: JVM parameter + :param jvm_options: JVM parameter. :type jvm_options: str - :param net_core_main_entry_path: The path to the .NET executable relative - to zip root + :param net_core_main_entry_path: The path to the .NET executable relative to zip root. :type net_core_main_entry_path: str - :param instance_count: Instance count, basic tier should be in range (1, - 25), standard tier should be in range (1, 500). Default value: 1 . + :param instance_count: Instance count, basic tier should be in range (1, 25), standard tier + should be in range (1, 500). :type instance_count: int - :param environment_variables: Collection of environment variables + :param environment_variables: Collection of environment variables. :type environment_variables: dict[str, str] - :param runtime_version: Runtime version. Possible values include: - 'Java_8', 'Java_11', 'NetCore_31' - :type runtime_version: str or - ~azure.mgmt.appplatform.v2019_05_01_preview.models.RuntimeVersion + :param runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :type runtime_version: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.RuntimeVersion """ _attribute_map = { @@ -916,7 +1048,10 @@ class DeploymentSettings(Model): 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeploymentSettings, self).__init__(**kwargs) self.cpu = kwargs.get('cpu', 1) self.memory_in_gb = kwargs.get('memory_in_gb', 1) @@ -924,10 +1059,10 @@ def __init__(self, **kwargs): self.net_core_main_entry_path = kwargs.get('net_core_main_entry_path', None) self.instance_count = kwargs.get('instance_count', 1) self.environment_variables = kwargs.get('environment_variables', None) - self.runtime_version = kwargs.get('runtime_version', None) + self.runtime_version = kwargs.get('runtime_version', "Java_8") -class Error(Model): +class Error(msrest.serialization.Model): """The error code compose of code and message. :param code: The code of error. @@ -941,26 +1076,29 @@ class Error(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Error, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) -class GitPatternRepository(Model): +class GitPatternRepository(msrest.serialization.Model): """Git repository property payload. All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the repository + :param name: Required. Name of the repository. :type name: str - :param pattern: Collection of pattern of the repository + :param pattern: Collection of pattern of the repository. :type pattern: list[str] - :param uri: Required. URI of the repository + :param uri: Required. URI of the repository. :type uri: str - :param label: Label of the repository + :param label: Label of the repository. :type label: str - :param search_paths: Searching path of the repository + :param search_paths: Searching path of the repository. :type search_paths: list[str] :param username: Username of git repository basic auth. :type username: str @@ -995,11 +1133,14 @@ class GitPatternRepository(Model): 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(GitPatternRepository, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + self.name = kwargs['name'] self.pattern = kwargs.get('pattern', None) - self.uri = kwargs.get('uri', None) + self.uri = kwargs['uri'] self.label = kwargs.get('label', None) self.search_paths = kwargs.get('search_paths', None) self.username = kwargs.get('username', None) @@ -1010,12 +1151,12 @@ def __init__(self, **kwargs): self.strict_host_key_checking = kwargs.get('strict_host_key_checking', None) -class LogFileUrlResponse(Model): +class LogFileUrlResponse(msrest.serialization.Model): """Log file URL payload. All required parameters must be populated in order to send to Azure. - :param url: Required. URL of the log file + :param url: Required. URL of the log file. :type url: str """ @@ -1027,19 +1168,22 @@ class LogFileUrlResponse(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LogFileUrlResponse, self).__init__(**kwargs) - self.url = kwargs.get('url', None) + self.url = kwargs['url'] -class LogSpecification(Model): +class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :param name: Name of the log + :param name: Name of the log. :type name: str - :param display_name: Localized friendly display name of the log + :param display_name: Localized friendly display name of the log. :type display_name: str - :param blob_duration: Blob duration of the log + :param blob_duration: Blob duration of the log. :type blob_duration: str """ @@ -1049,20 +1193,22 @@ class LogSpecification(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LogSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) self.blob_duration = kwargs.get('blob_duration', None) -class ManagedIdentityProperties(Model): +class ManagedIdentityProperties(msrest.serialization.Model): """Managed identity properties retrieved from ARM request headers. - :param type: Possible values include: 'None', 'SystemAssigned', - 'UserAssigned', 'SystemAssigned,UserAssigned' - :type type: str or - ~azure.mgmt.appplatform.v2019_05_01_preview.models.ManagedIdentityType + :param type: Possible values include: "None", "SystemAssigned", "UserAssigned", + "SystemAssigned,UserAssigned". + :type type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.ManagedIdentityType :param principal_id: :type principal_id: str :param tenant_id: @@ -1075,22 +1221,25 @@ class ManagedIdentityProperties(Model): 'tenant_id': {'key': 'tenantId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.principal_id = kwargs.get('principal_id', None) self.tenant_id = kwargs.get('tenant_id', None) -class MetricDimension(Model): +class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension + :param name: Name of the dimension. :type name: str - :param display_name: Localized friendly display name of the dimension + :param display_name: Localized friendly display name of the dimension. :type display_name: str - :param to_be_exported_for_shoebox: Whether this dimension should be - included for the Shoebox export scenario + :param to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. :type to_be_exported_for_shoebox: bool """ @@ -1100,40 +1249,42 @@ class MetricDimension(Model): 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MetricDimension, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) -class MetricSpecification(Model): +class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :param name: Name of the metric + :param name: Name of the metric. :type name: str - :param display_name: Localized friendly display name of the metric + :param display_name: Localized friendly display name of the metric. :type display_name: str - :param display_description: Localized friendly description of the metric + :param display_description: Localized friendly description of the metric. :type display_description: str - :param unit: Unit that makes sense for the metric + :param unit: Unit that makes sense for the metric. :type unit: str - :param category: Name of the metric category that the metric belongs to. A - metric can only belong to a single category. + :param category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. :type category: str - :param aggregation_type: Only provide one value for this field. Valid - values: Average, Minimum, Maximum, Total, Count. + :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + Maximum, Total, Count. :type aggregation_type: str - :param supported_aggregation_types: Supported aggregation types + :param supported_aggregation_types: Supported aggregation types. :type supported_aggregation_types: list[str] - :param supported_time_grain_types: Supported time grain types + :param supported_time_grain_types: Supported time grain types. :type supported_time_grain_types: list[str] - :param fill_gap_with_zero: Optional. If set to true, then zero will be - returned for time duration where no metric is emitted/published. + :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. :type fill_gap_with_zero: bool - :param dimensions: Dimensions of the metric - :type dimensions: - list[~azure.mgmt.appplatform.v2019_05_01_preview.models.MetricDimension] + :param dimensions: Dimensions of the metric. + :type dimensions: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.MetricDimension] """ _attribute_map = { @@ -1149,7 +1300,10 @@ class MetricSpecification(Model): 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MetricSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1163,14 +1317,14 @@ def __init__(self, **kwargs): self.dimensions = kwargs.get('dimensions', None) -class NameAvailability(Model): +class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :param name_available: Indicates whether the name is available + :param name_available: Indicates whether the name is available. :type name_available: bool - :param reason: Reason why the name is not available + :param reason: Reason why the name is not available. :type reason: str - :param message: Message why the name is not available + :param message: Message why the name is not available. :type message: str """ @@ -1180,21 +1334,24 @@ class NameAvailability(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NameAvailability, self).__init__(**kwargs) self.name_available = kwargs.get('name_available', None) self.reason = kwargs.get('reason', None) self.message = kwargs.get('message', None) -class NameAvailabilityParameters(Model): +class NameAvailabilityParameters(msrest.serialization.Model): """Name availability parameters payload. All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the resource to check name availability + :param type: Required. Type of the resource to check name availability. :type type: str - :param name: Required. Name to be checked + :param name: Required. Name to be checked. :type name: str """ @@ -1208,44 +1365,44 @@ class NameAvailabilityParameters(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NameAvailabilityParameters, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.name = kwargs.get('name', None) + self.type = kwargs['type'] + self.name = kwargs['name'] -class NetworkProfile(Model): +class NetworkProfile(msrest.serialization.Model): """Service network profile payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param service_runtime_subnet_id: Fully qualified resource Id of the - subnet to host Azure Spring Cloud Service Runtime + :param service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. :type service_runtime_subnet_id: str - :param app_subnet_id: Fully qualified resource Id of the subnet to host - Azure Spring Cloud Apps + :param app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. :type app_subnet_id: str - :param service_cidr: Azure Spring Cloud service reserved CIDR + :param service_cidr: Azure Spring Cloud service reserved CIDR. :type service_cidr: str - :param service_runtime_network_resource_group: Name of the resource group - containing network resources of Azure Spring Cloud Service Runtime + :param service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. :type service_runtime_network_resource_group: str - :param app_network_resource_group: Name of the resource group containing - network resources of Azure Spring Cloud Apps + :param app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. :type app_network_resource_group: str - :ivar outbound_ips: Desired outbound IP resources for Azure Spring Cloud - instance. - :vartype outbound_ips: + :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Cloud instance. + :vartype outbound_i_ps: ~azure.mgmt.appplatform.v2019_05_01_preview.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure - Spring Cloud instance. + :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Cloud instance. :vartype required_traffics: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.RequiredTraffic] """ _validation = { - 'outbound_ips': {'readonly': True}, + 'outbound_i_ps': {'readonly': True}, 'required_traffics': {'readonly': True}, } @@ -1255,59 +1412,62 @@ class NetworkProfile(Model): 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, 'service_runtime_network_resource_group': {'key': 'serviceRuntimeNetworkResourceGroup', 'type': 'str'}, 'app_network_resource_group': {'key': 'appNetworkResourceGroup', 'type': 'str'}, - 'outbound_ips': {'key': 'outboundIPs', 'type': 'NetworkProfileOutboundIPs'}, + 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'NetworkProfileOutboundIPs'}, 'required_traffics': {'key': 'requiredTraffics', 'type': '[RequiredTraffic]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NetworkProfile, self).__init__(**kwargs) self.service_runtime_subnet_id = kwargs.get('service_runtime_subnet_id', None) self.app_subnet_id = kwargs.get('app_subnet_id', None) self.service_cidr = kwargs.get('service_cidr', None) self.service_runtime_network_resource_group = kwargs.get('service_runtime_network_resource_group', None) self.app_network_resource_group = kwargs.get('app_network_resource_group', None) - self.outbound_ips = None + self.outbound_i_ps = None self.required_traffics = None -class NetworkProfileOutboundIPs(Model): +class NetworkProfileOutboundIPs(msrest.serialization.Model): """Desired outbound IP resources for Azure Spring Cloud instance. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar public_ips: A list of public IP addresses. - :vartype public_ips: list[str] + :ivar public_i_ps: A list of public IP addresses. + :vartype public_i_ps: list[str] """ _validation = { - 'public_ips': {'readonly': True}, + 'public_i_ps': {'readonly': True}, } _attribute_map = { - 'public_ips': {'key': 'publicIPs', 'type': '[str]'}, + 'public_i_ps': {'key': 'publicIPs', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NetworkProfileOutboundIPs, self).__init__(**kwargs) - self.public_ips = None + self.public_i_ps = None -class OperationDetail(Model): +class OperationDetail(msrest.serialization.Model): """Operation detail payload. - :param name: Name of the operation + :param name: Name of the operation. :type name: str - :param is_data_action: Indicates whether the operation is a data action + :param is_data_action: Indicates whether the operation is a data action. :type is_data_action: bool - :param display: Display of the operation - :type display: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationDisplay - :param origin: Origin of the operation + :param display: Display of the operation. + :type display: ~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationDisplay + :param origin: Origin of the operation. :type origin: str - :param properties: Properties of the operation - :type properties: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationProperties + :param properties: Properties of the operation. + :type properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationProperties """ _attribute_map = { @@ -1318,7 +1478,10 @@ class OperationDetail(Model): 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OperationDetail, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.is_data_action = kwargs.get('is_data_action', None) @@ -1327,16 +1490,16 @@ def __init__(self, **kwargs): self.properties = kwargs.get('properties', None) -class OperationDisplay(Model): +class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :param provider: Resource provider of the operation + :param provider: Resource provider of the operation. :type provider: str - :param resource: Resource of the operation + :param resource: Resource of the operation. :type resource: str - :param operation: Localized friendly name for the operation + :param operation: Localized friendly name for the operation. :type operation: str - :param description: Localized friendly description for the operation + :param description: Localized friendly description for the operation. :type description: str """ @@ -1347,7 +1510,10 @@ class OperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OperationDisplay, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -1355,10 +1521,10 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) -class OperationProperties(Model): +class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :param service_specification: Service specifications of the operation + :param service_specification: Service specifications of the operation. :type service_specification: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceSpecification """ @@ -1367,22 +1533,24 @@ class OperationProperties(Model): 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OperationProperties, self).__init__(**kwargs) self.service_specification = kwargs.get('service_specification', None) -class PersistentDisk(Model): +class PersistentDisk(msrest.serialization.Model): """Persistent disk payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param size_in_gb: Size of the persistent disk in GB + :param size_in_gb: Size of the persistent disk in GB. :type size_in_gb: int - :ivar used_in_gb: Size of the used persistent disk in GB + :ivar used_in_gb: Size of the used persistent disk in GB. :vartype used_in_gb: int - :param mount_path: Mount path of the persistent disk + :param mount_path: Mount path of the persistent disk. :type mount_path: str """ @@ -1397,22 +1565,24 @@ class PersistentDisk(Model): 'mount_path': {'key': 'mountPath', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = kwargs.get('size_in_gb', None) self.used_in_gb = None self.mount_path = kwargs.get('mount_path', None) -class RegenerateTestKeyRequestPayload(Model): +class RegenerateTestKeyRequestPayload(msrest.serialization.Model): """Regenerate test key request payload. All required parameters must be populated in order to send to Azure. - :param key_type: Required. Type of the test key. Possible values include: - 'Primary', 'Secondary' - :type key_type: str or - ~azure.mgmt.appplatform.v2019_05_01_preview.models.TestKeyType + :param key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :type key_type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.TestKeyType """ _validation = { @@ -1423,29 +1593,30 @@ class RegenerateTestKeyRequestPayload(Model): 'key_type': {'key': 'keyType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) - self.key_type = kwargs.get('key_type', None) + self.key_type = kwargs['key_type'] -class RequiredTraffic(Model): +class RequiredTraffic(msrest.serialization.Model): """Required inbound or outbound traffic for Azure Spring Cloud instance. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar protocol: The protocol of required traffic + :ivar protocol: The protocol of required traffic. :vartype protocol: str - :ivar port: The port of required traffic + :ivar port: The port of required traffic. :vartype port: int - :ivar ips: The ip list of required traffic + :ivar ips: The ip list of required traffic. :vartype ips: list[str] - :ivar fqdns: The FQDN list of required traffic + :ivar fqdns: The FQDN list of required traffic. :vartype fqdns: list[str] - :ivar direction: The direction of required traffic. Possible values - include: 'Inbound', 'Outbound' - :vartype direction: str or - ~azure.mgmt.appplatform.v2019_05_01_preview.models.TrafficDirection + :ivar direction: The direction of required traffic. Possible values include: "Inbound", + "Outbound". + :vartype direction: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.TrafficDirection """ _validation = { @@ -1464,7 +1635,10 @@ class RequiredTraffic(Model): 'direction': {'key': 'direction', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -1473,7 +1647,7 @@ def __init__(self, **kwargs): self.direction = None -class ResourceSku(Model): +class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. :param resource_type: Gets the type of resource the SKU applies to. @@ -1483,16 +1657,14 @@ class ResourceSku(Model): :param tier: Gets the tier of SKU. :type tier: str :param capacity: Gets the capacity of SKU. - :type capacity: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.SkuCapacity + :type capacity: ~azure.mgmt.appplatform.v2019_05_01_preview.models.SkuCapacity :param locations: Gets the set of locations that the SKU is available. :type locations: list[str] - :param location_info: Gets a list of locations and availability zones in - those locations where the SKU is available. + :param location_info: Gets a list of locations and availability zones in those locations where + the SKU is available. :type location_info: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuLocationInfo] - :param restrictions: Gets the restrictions because of which SKU cannot be - used. This is + :param restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. :type restrictions: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictions] @@ -1508,7 +1680,10 @@ class ResourceSku(Model): 'restrictions': {'key': 'restrictions', 'type': '[ResourceSkuRestrictions]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSku, self).__init__(**kwargs) self.resource_type = kwargs.get('resource_type', None) self.name = kwargs.get('name', None) @@ -1519,7 +1694,7 @@ def __init__(self, **kwargs): self.restrictions = kwargs.get('restrictions', None) -class ResourceSkuCapabilities(Model): +class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. :param name: Gets an invariant to describe the feature. @@ -1533,21 +1708,47 @@ class ResourceSkuCapabilities(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.value = kwargs.get('value', None) -class ResourceSkuLocationInfo(Model): +class ResourceSkuCollection(msrest.serialization.Model): + """ResourceSkuCollection. + + :param value: Collection of resource SKU. + :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSku] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceSku]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceSkuCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ResourceSkuLocationInfo(msrest.serialization.Model): """ResourceSkuLocationInfo. - :param location: Gets location of the SKU + :param location: Gets location of the SKU. :type location: str :param zones: Gets list of availability zones where the SKU is supported. :type zones: list[str] - :param zone_details: Gets details of capabilities available to a SKU in - specific zones. + :param zone_details: Gets details of capabilities available to a SKU in specific zones. :type zone_details: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuZoneDetails] """ @@ -1558,17 +1759,20 @@ class ResourceSkuLocationInfo(Model): 'zone_details': {'key': 'zoneDetails', 'type': '[ResourceSkuZoneDetails]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.zones = kwargs.get('zones', None) self.zone_details = kwargs.get('zone_details', None) -class ResourceSkuRestrictionInfo(Model): +class ResourceSkuRestrictionInfo(msrest.serialization.Model): """ResourceSkuRestrictionInfo. - :param locations: Gets locations where the SKU is restricted + :param locations: Gets locations where the SKU is restricted. :type locations: list[str] :param zones: Gets list of availability zones where the SKU is restricted. :type zones: list[str] @@ -1579,29 +1783,32 @@ class ResourceSkuRestrictionInfo(Model): 'zones': {'key': 'zones', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = kwargs.get('locations', None) self.zones = kwargs.get('zones', None) -class ResourceSkuRestrictions(Model): +class ResourceSkuRestrictions(msrest.serialization.Model): """ResourceSkuRestrictions. - :param type: Gets the type of restrictions. Possible values include: - 'Location', 'Zone' + :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". :type type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictionsType - :param values: Gets the value of restrictions. If the restriction type is - set to + :param values: Gets the value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. :type values: list[str] - :param restriction_info: Gets the information about the restriction where - the SKU cannot be used. + :param restriction_info: Gets the information about the restriction where the SKU cannot be + used. :type restriction_info: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictionInfo - :param reason_code: Gets the reason for restriction. Possible values - include: 'QuotaId', 'NotAvailableForSubscription' + :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". :type reason_code: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictionsReasonCode """ @@ -1613,7 +1820,10 @@ class ResourceSkuRestrictions(Model): 'reason_code': {'key': 'reasonCode', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.values = kwargs.get('values', None) @@ -1621,14 +1831,13 @@ def __init__(self, **kwargs): self.reason_code = kwargs.get('reason_code', None) -class ResourceSkuZoneDetails(Model): +class ResourceSkuZoneDetails(msrest.serialization.Model): """ResourceSkuZoneDetails. :param name: Gets the set of zones that the SKU is available in with the specified capabilities. :type name: list[str] - :param capabilities: Gets a list of capabilities that are available for - the SKU in the + :param capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. :type capabilities: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuCapabilities] @@ -1639,18 +1848,21 @@ class ResourceSkuZoneDetails(Model): 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.capabilities = kwargs.get('capabilities', None) -class ResourceUploadDefinition(Model): +class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :param relative_path: Source relative path + :param relative_path: Source relative path. :type relative_path: str - :param upload_url: Upload URL + :param upload_url: Upload URL. :type upload_url: str """ @@ -1659,7 +1871,10 @@ class ResourceUploadDefinition(Model): 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = kwargs.get('relative_path', None) self.upload_url = kwargs.get('upload_url', None) @@ -1668,8 +1883,7 @@ def __init__(self, **kwargs): class TrackedResource(Resource): """The resource model definition for a ARM tracked top level resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -1679,7 +1893,7 @@ class TrackedResource(Resource): :vartype type: str :param location: The GEO location of the resource. :type location: str - :param tags: Tags of the service which is a list of key value pairs that + :param tags: A set of tags. Tags of the service which is a list of key value pairs that describe the resource. :type tags: dict[str, str] """ @@ -1698,7 +1912,10 @@ class TrackedResource(Resource): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TrackedResource, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.tags = kwargs.get('tags', None) @@ -1707,8 +1924,7 @@ def __init__(self, **kwargs): class ServiceResource(TrackedResource): """Service resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -1718,13 +1934,12 @@ class ServiceResource(TrackedResource): :vartype type: str :param location: The GEO location of the resource. :type location: str - :param tags: Tags of the service which is a list of key value pairs that + :param tags: A set of tags. Tags of the service which is a list of key value pairs that describe the resource. :type tags: dict[str, str] - :param properties: Properties of the Service resource - :type properties: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.ClusterResourceProperties - :param sku: Sku of the Service resource + :param properties: Properties of the Service resource. + :type properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ClusterResourceProperties + :param sku: Sku of the Service resource. :type sku: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Sku """ @@ -1744,20 +1959,46 @@ class ServiceResource(TrackedResource): 'sku': {'key': 'sku', 'type': 'Sku'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServiceResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.sku = kwargs.get('sku', None) -class ServiceSpecification(Model): +class ServiceResourceList(msrest.serialization.Model): + """Object that includes an array of Service resources and a possible link for next set. + + :param value: Collection of Service resources. + :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ServiceResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ServiceResourceList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :param log_specifications: Specifications of the Log for Azure Monitoring + :param log_specifications: Specifications of the Log for Azure Monitoring. :type log_specifications: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.LogSpecification] - :param metric_specifications: Specifications of the Metrics for Azure - Monitoring + :param metric_specifications: Specifications of the Metrics for Azure Monitoring. :type metric_specifications: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.MetricSpecification] """ @@ -1767,20 +2008,23 @@ class ServiceSpecification(Model): 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = kwargs.get('log_specifications', None) self.metric_specifications = kwargs.get('metric_specifications', None) -class Sku(Model): +class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :param name: Name of the Sku. Default value: "S0" . + :param name: Name of the Sku. :type name: str - :param tier: Tier of the Sku. Default value: "Standard" . + :param tier: Tier of the Sku. :type tier: str - :param capacity: Current capacity of the target resource + :param capacity: Current capacity of the target resource. :type capacity: int """ @@ -1790,14 +2034,17 @@ class Sku(Model): 'capacity': {'key': 'capacity', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Sku, self).__init__(**kwargs) self.name = kwargs.get('name', "S0") self.tier = kwargs.get('tier', "Standard") self.capacity = kwargs.get('capacity', None) -class SkuCapacity(Model): +class SkuCapacity(msrest.serialization.Model): """The SKU capacity. All required parameters must be populated in order to send to Azure. @@ -1808,10 +2055,9 @@ class SkuCapacity(Model): :type maximum: int :param default: Gets or sets the default. :type default: int - :param scale_type: Gets or sets the type of the scale. Possible values - include: 'None', 'Manual', 'Automatic' - :type scale_type: str or - ~azure.mgmt.appplatform.v2019_05_01_preview.models.SkuScaleType + :param scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :type scale_type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.SkuScaleType """ _validation = { @@ -1825,23 +2071,25 @@ class SkuCapacity(Model): 'scale_type': {'key': 'scaleType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SkuCapacity, self).__init__(**kwargs) - self.minimum = kwargs.get('minimum', None) + self.minimum = kwargs['minimum'] self.maximum = kwargs.get('maximum', None) self.default = kwargs.get('default', None) self.scale_type = kwargs.get('scale_type', None) -class SupportedRuntimeVersion(Model): +class SupportedRuntimeVersion(msrest.serialization.Model): """Supported deployment runtime version descriptor. - :param value: The raw value which could be passed to deployment CRUD - operations. Possible values include: 'Java_8', 'Java_11', 'NetCore_31' - :type value: str or - ~azure.mgmt.appplatform.v2019_05_01_preview.models.SupportedRuntimeValue - :param platform: The platform of this runtime version (possible values: - "Java" or ".NET"). Possible values include: 'Java', '.NET Core' + :param value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :type value: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.SupportedRuntimeValue + :param platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". :type platform: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.SupportedRuntimePlatform :param version: The detailed version (major.minor) of the platform. @@ -1854,19 +2102,22 @@ class SupportedRuntimeVersion(Model): 'version': {'key': 'version', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.platform = kwargs.get('platform', None) self.version = kwargs.get('version', None) -class TemporaryDisk(Model): +class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :param size_in_gb: Size of the temporary disk in GB + :param size_in_gb: Size of the temporary disk in GB. :type size_in_gb: int - :param mount_path: Mount path of the temporary disk + :param mount_path: Mount path of the temporary disk. :type mount_path: str """ @@ -1879,24 +2130,27 @@ class TemporaryDisk(Model): 'mount_path': {'key': 'mountPath', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = kwargs.get('size_in_gb', None) - self.mount_path = kwargs.get('mount_path', None) + self.mount_path = kwargs.get('mount_path', "/tmp") -class TestKeys(Model): +class TestKeys(msrest.serialization.Model): """Test keys payload. - :param primary_key: Primary key + :param primary_key: Primary key. :type primary_key: str - :param secondary_key: Secondary key + :param secondary_key: Secondary key. :type secondary_key: str - :param primary_test_endpoint: Primary test endpoint + :param primary_test_endpoint: Primary test endpoint. :type primary_test_endpoint: str - :param secondary_test_endpoint: Secondary test endpoint + :param secondary_test_endpoint: Secondary test endpoint. :type secondary_test_endpoint: str - :param enabled: Indicates whether the test endpoint feature enabled or not + :param enabled: Indicates whether the test endpoint feature enabled or not. :type enabled: bool """ @@ -1908,7 +2162,10 @@ class TestKeys(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TestKeys, self).__init__(**kwargs) self.primary_key = kwargs.get('primary_key', None) self.secondary_key = kwargs.get('secondary_key', None) @@ -1917,22 +2174,19 @@ def __init__(self, **kwargs): self.enabled = kwargs.get('enabled', None) -class TraceProperties(Model): +class TraceProperties(msrest.serialization.Model): """Trace properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar state: State of the trace proxy. Possible values include: - 'NotAvailable', 'Failed', 'Succeeded', 'Updating' - :vartype state: str or - ~azure.mgmt.appplatform.v2019_05_01_preview.models.TraceProxyState + :ivar state: State of the trace proxy. Possible values include: "NotAvailable", "Failed", + "Succeeded", "Updating". + :vartype state: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.TraceProxyState :param error: Error when apply trace proxy changes. :type error: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Error - :param enabled: Indicates whether enable the tracing functionality + :param enabled: Indicates whether enable the tracing functionality. :type enabled: bool - :param app_insight_instrumentation_key: Target application insight - instrumentation key + :param app_insight_instrumentation_key: Target application insight instrumentation key. :type app_insight_instrumentation_key: str """ @@ -1947,7 +2201,10 @@ class TraceProperties(Model): 'app_insight_instrumentation_key': {'key': 'appInsightInstrumentationKey', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TraceProperties, self).__init__(**kwargs) self.state = None self.error = kwargs.get('error', None) @@ -1955,19 +2212,18 @@ def __init__(self, **kwargs): self.app_insight_instrumentation_key = kwargs.get('app_insight_instrumentation_key', None) -class UserSourceInfo(Model): +class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :param type: Type of the source uploaded. Possible values include: 'Jar', - 'NetCoreZip', 'Source' - :type type: str or - ~azure.mgmt.appplatform.v2019_05_01_preview.models.UserSourceType - :param relative_path: Relative path of the storage which stores the source + :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source". + :type type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.UserSourceType + :param relative_path: Relative path of the storage which stores the source. :type relative_path: str - :param version: Version of the source + :param version: Version of the source. :type version: str - :param artifact_selector: Selector for the artifact to be used for the - deployment for multi-module projects. This should be + :param artifact_selector: Selector for the artifact to be used for the deployment for + multi-module projects. This should be the relative path to the target module/project. :type artifact_selector: str """ @@ -1979,7 +2235,10 @@ class UserSourceInfo(Model): 'artifact_selector': {'key': 'artifactSelector', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(UserSourceInfo, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.relative_path = kwargs.get('relative_path', None) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/models/_models_py3.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/models/_models_py3.py index 74599f3bd5e..2538ba5505b 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/models/_models_py3.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/models/_models_py3.py @@ -1,23 +1,22 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +from typing import Any, Dict, List, Optional, Union +import msrest.serialization -class Resource(Model): +from ._app_platform_management_client_enums import * + + +class Resource(msrest.serialization.Model): """The core properties of ARM resources. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -39,7 +38,10 @@ class Resource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -47,11 +49,9 @@ def __init__(self, **kwargs) -> None: class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have - everything other than required location and tags. + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -73,15 +73,17 @@ class ProxyResource(Resource): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ProxyResource, self).__init__(**kwargs) class AppResource(ProxyResource): """App resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -89,14 +91,11 @@ class AppResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the App resource - :type properties: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResourceProperties - :param identity: The Managed Identity type of the app resource - :type identity: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.ManagedIdentityProperties - :param location: The GEO location of the application, always the same with - its parent resource + :param properties: Properties of the App resource. + :type properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResourceProperties + :param identity: The Managed Identity type of the app resource. + :type identity: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ManagedIdentityProperties + :param location: The GEO location of the application, always the same with its parent resource. :type location: str """ @@ -115,41 +114,72 @@ class AppResource(ProxyResource): 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, *, properties=None, identity=None, location: str=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["AppResourceProperties"] = None, + identity: Optional["ManagedIdentityProperties"] = None, + location: Optional[str] = None, + **kwargs + ): super(AppResource, self).__init__(**kwargs) self.properties = properties self.identity = identity self.location = location -class AppResourceProperties(Model): +class AppResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :param value: Collection of App resources. + :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["AppResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(AppResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AppResourceProperties(msrest.serialization.Model): """App resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param public: Indicates whether the App exposes public endpoint + :param public: Indicates whether the App exposes public endpoint. :type public: bool - :ivar url: URL of the App + :ivar url: URL of the App. :vartype url: str - :ivar provisioning_state: Provisioning state of the App. Possible values - include: 'Succeeded', 'Failed', 'Creating', 'Updating', 'Deleting' + :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", + "Failed", "Creating", "Updating", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResourceProvisioningState - :param active_deployment_name: Name of the active deployment of the App + :param active_deployment_name: Name of the active deployment of the App. :type active_deployment_name: str :param fqdn: Fully qualified dns Name. :type fqdn: str :param https_only: Indicate if only https is allowed. :type https_only: bool - :ivar created_time: Date time when the resource is created - :vartype created_time: datetime - :param temporary_disk: Temporary disk settings - :type temporary_disk: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.TemporaryDisk - :param persistent_disk: Persistent disk settings - :type persistent_disk: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.PersistentDisk + :ivar created_time: Date time when the resource is created. + :vartype created_time: ~datetime.datetime + :param temporary_disk: Temporary disk settings. + :type temporary_disk: ~azure.mgmt.appplatform.v2019_05_01_preview.models.TemporaryDisk + :param persistent_disk: Persistent disk settings. + :type persistent_disk: ~azure.mgmt.appplatform.v2019_05_01_preview.models.PersistentDisk """ _validation = { @@ -170,7 +200,17 @@ class AppResourceProperties(Model): 'persistent_disk': {'key': 'persistentDisk', 'type': 'PersistentDisk'}, } - def __init__(self, *, public: bool=None, active_deployment_name: str=None, fqdn: str=None, https_only: bool=None, temporary_disk=None, persistent_disk=None, **kwargs) -> None: + def __init__( + self, + *, + public: Optional[bool] = None, + active_deployment_name: Optional[str] = None, + fqdn: Optional[str] = None, + https_only: Optional[bool] = False, + temporary_disk: Optional["TemporaryDisk"] = None, + persistent_disk: Optional["PersistentDisk"] = None, + **kwargs + ): super(AppResourceProperties, self).__init__(**kwargs) self.public = public self.url = None @@ -183,11 +223,37 @@ def __init__(self, *, public: bool=None, active_deployment_name: str=None, fqdn: self.persistent_disk = persistent_disk -class AvailableRuntimeVersions(Model): +class AvailableOperations(msrest.serialization.Model): + """Available operations of the service. + + :param value: Collection of available operation details. + :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationDetail] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationDetail]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["OperationDetail"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(AvailableOperations, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AvailableRuntimeVersions(msrest.serialization.Model): """AvailableRuntimeVersions. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar value: A list of all supported runtime versions. :vartype value: @@ -202,7 +268,10 @@ class AvailableRuntimeVersions(Model): 'value': {'key': 'value', 'type': '[SupportedRuntimeVersion]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -210,8 +279,7 @@ def __init__(self, **kwargs) -> None: class BindingResource(ProxyResource): """Binding resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -219,9 +287,8 @@ class BindingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Binding resource - :type properties: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResourceProperties + :param properties: Properties of the Binding resource. + :type properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResourceProperties """ _validation = { @@ -237,34 +304,64 @@ class BindingResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'BindingResourceProperties'}, } - def __init__(self, *, properties=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["BindingResourceProperties"] = None, + **kwargs + ): super(BindingResource, self).__init__(**kwargs) self.properties = properties -class BindingResourceProperties(Model): +class BindingResourceCollection(msrest.serialization.Model): + """Object that includes an array of Binding resources and a possible link for next set. + + :param value: Collection of Binding resources. + :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BindingResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["BindingResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(BindingResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BindingResourceProperties(msrest.serialization.Model): """Binding resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar resource_name: The name of the bound resource + :ivar resource_name: The name of the bound resource. :vartype resource_name: str - :ivar resource_type: The standard Azure resource type of the bound - resource + :ivar resource_type: The standard Azure resource type of the bound resource. :vartype resource_type: str - :param resource_id: The Azure resource id of the bound resource + :param resource_id: The Azure resource id of the bound resource. :type resource_id: str - :param key: The key of the bound resource + :param key: The key of the bound resource. :type key: str - :param binding_parameters: Binding parameters of the Binding resource - :type binding_parameters: dict[str, object] - :ivar generated_properties: The generated Spring Boot property file for - this binding. The secret will be deducted. + :param binding_parameters: Binding parameters of the Binding resource. + :type binding_parameters: dict[str, any] + :ivar generated_properties: The generated Spring Boot property file for this binding. The + secret will be deducted. :vartype generated_properties: str - :ivar created_at: Creation time of the Binding resource + :ivar created_at: Creation time of the Binding resource. :vartype created_at: str - :ivar updated_at: Update time of the Binding resource + :ivar updated_at: Update time of the Binding resource. :vartype updated_at: str """ @@ -287,7 +384,14 @@ class BindingResourceProperties(Model): 'updated_at': {'key': 'updatedAt', 'type': 'str'}, } - def __init__(self, *, resource_id: str=None, key: str=None, binding_parameters=None, **kwargs) -> None: + def __init__( + self, + *, + resource_id: Optional[str] = None, + key: Optional[str] = None, + binding_parameters: Optional[Dict[str, Any]] = None, + **kwargs + ): super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -299,11 +403,10 @@ def __init__(self, *, resource_id: str=None, key: str=None, binding_parameters=N self.updated_at = None -class CertificateProperties(Model): +class CertificateProperties(msrest.serialization.Model): """Certificate resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -354,7 +457,14 @@ class CertificateProperties(Model): 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, } - def __init__(self, *, vault_uri: str, key_vault_cert_name: str, cert_version: str=None, **kwargs) -> None: + def __init__( + self, + *, + vault_uri: str, + key_vault_cert_name: str, + cert_version: Optional[str] = None, + **kwargs + ): super(CertificateProperties, self).__init__(**kwargs) self.thumbprint = None self.vault_uri = vault_uri @@ -371,8 +481,7 @@ def __init__(self, *, vault_uri: str, key_vault_cert_name: str, cert_version: st class CertificateResource(ProxyResource): """Certificate resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -381,8 +490,7 @@ class CertificateResource(ProxyResource): :ivar type: The type of the resource. :vartype type: str :param properties: Properties of the certificate resource payload. - :type properties: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateProperties + :type properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateProperties """ _validation = { @@ -398,55 +506,56 @@ class CertificateResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, } - def __init__(self, *, properties=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["CertificateProperties"] = None, + **kwargs + ): super(CertificateResource, self).__init__(**kwargs) self.properties = properties -class CloudError(Model): - """An error response from the service. +class CertificateResourceCollection(msrest.serialization.Model): + """Collection compose of certificate resources list and a possible link for next page. - :param error: - :type error: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.CloudErrorBody + :param value: The certificate resources list. + :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateResource] + :param next_link: The link to next page of certificate list. + :type next_link: str """ _attribute_map = { - 'error': {'key': 'error', 'type': 'CloudErrorBody'}, - } - - def __init__(self, *, error=None, **kwargs) -> None: - super(CloudError, self).__init__(**kwargs) - self.error = error - - -class CloudErrorException(HttpOperationError): - """Server responsed with exception of type: 'CloudError'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + 'value': {'key': 'value', 'type': '[CertificateResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["CertificateResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(CertificateResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link -class CloudErrorBody(Model): +class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are - intended to be consumed programmatically. + :param code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. :type code: str - :param message: A message describing the error, intended to be suitable - for display in a user interface. + :param message: A message describing the error, intended to be suitable for display in a user + interface. :type message: str - :param target: The target of the particular error. For example, the name - of the property in error. + :param target: The target of the particular error. For example, the name of the property in + error. :type target: str :param details: A list of additional details about the error. - :type details: - list[~azure.mgmt.appplatform.v2019_05_01_preview.models.CloudErrorBody] + :type details: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -456,7 +565,15 @@ class CloudErrorBody(Model): 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, } - def __init__(self, *, code: str=None, message: str=None, target: str=None, details=None, **kwargs) -> None: + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["CloudErrorBody"]] = None, + **kwargs + ): super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -464,31 +581,26 @@ def __init__(self, *, code: str=None, message: str=None, target: str=None, detai self.details = details -class ClusterResourceProperties(Model): +class ClusterResourceProperties(msrest.serialization.Model): """Service properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Provisioning state of the Service. Possible - values include: 'Creating', 'Updating', 'Deleting', 'Deleted', - 'Succeeded', 'Failed', 'Moving', 'Moved', 'MoveFailed' + :ivar provisioning_state: Provisioning state of the Service. Possible values include: + "Creating", "Updating", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", "Moved", + "MoveFailed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.ProvisioningState - :param config_server_properties: Config server git properties of the - Service + :param config_server_properties: Config server git properties of the Service. :type config_server_properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerProperties - :param trace: Trace properties of the Service - :type trace: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.TraceProperties - :param network_profile: Network profile of the Service - :type network_profile: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.NetworkProfile - :ivar version: Version of the Service + :param trace: Trace properties of the Service. + :type trace: ~azure.mgmt.appplatform.v2019_05_01_preview.models.TraceProperties + :param network_profile: Network profile of the Service. + :type network_profile: ~azure.mgmt.appplatform.v2019_05_01_preview.models.NetworkProfile + :ivar version: Version of the Service. :vartype version: int - :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a - created resource + :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. :vartype service_id: str """ @@ -507,7 +619,14 @@ class ClusterResourceProperties(Model): 'service_id': {'key': 'serviceId', 'type': 'str'}, } - def __init__(self, *, config_server_properties=None, trace=None, network_profile=None, **kwargs) -> None: + def __init__( + self, + *, + config_server_properties: Optional["ConfigServerProperties"] = None, + trace: Optional["TraceProperties"] = None, + network_profile: Optional["NetworkProfile"] = None, + **kwargs + ): super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.config_server_properties = config_server_properties @@ -517,7 +636,7 @@ def __init__(self, *, config_server_properties=None, trace=None, network_profile self.service_id = None -class ConfigServerGitProperty(Model): +class ConfigServerGitProperty(msrest.serialization.Model): """Property of git. All required parameters must be populated in order to send to Azure. @@ -525,11 +644,11 @@ class ConfigServerGitProperty(Model): :param repositories: Repositories of git. :type repositories: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.GitPatternRepository] - :param uri: Required. URI of the repository + :param uri: Required. URI of the repository. :type uri: str - :param label: Label of the repository + :param label: Label of the repository. :type label: str - :param search_paths: Searching path of the repository + :param search_paths: Searching path of the repository. :type search_paths: list[str] :param username: Username of git repository basic auth. :type username: str @@ -562,7 +681,21 @@ class ConfigServerGitProperty(Model): 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, } - def __init__(self, *, uri: str, repositories=None, label: str=None, search_paths=None, username: str=None, password: str=None, host_key: str=None, host_key_algorithm: str=None, private_key: str=None, strict_host_key_checking: bool=None, **kwargs) -> None: + def __init__( + self, + *, + uri: str, + repositories: Optional[List["GitPatternRepository"]] = None, + label: Optional[str] = None, + search_paths: Optional[List[str]] = None, + username: Optional[str] = None, + password: Optional[str] = None, + host_key: Optional[str] = None, + host_key_algorithm: Optional[str] = None, + private_key: Optional[str] = None, + strict_host_key_checking: Optional[bool] = None, + **kwargs + ): super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = repositories self.uri = uri @@ -576,21 +709,18 @@ def __init__(self, *, uri: str, repositories=None, label: str=None, search_paths self.strict_host_key_checking = strict_host_key_checking -class ConfigServerProperties(Model): +class ConfigServerProperties(msrest.serialization.Model): """Config server git properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar state: State of the config server. Possible values include: - 'NotAvailable', 'Deleted', 'Failed', 'Succeeded', 'Updating' - :vartype state: str or - ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerState + :ivar state: State of the config server. Possible values include: "NotAvailable", "Deleted", + "Failed", "Succeeded", "Updating". + :vartype state: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerState :param error: Error when apply config server settings. :type error: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Error :param config_server: Settings of config server. - :type config_server: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerSettings + :type config_server: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerSettings """ _validation = { @@ -603,35 +733,44 @@ class ConfigServerProperties(Model): 'config_server': {'key': 'configServer', 'type': 'ConfigServerSettings'}, } - def __init__(self, *, error=None, config_server=None, **kwargs) -> None: + def __init__( + self, + *, + error: Optional["Error"] = None, + config_server: Optional["ConfigServerSettings"] = None, + **kwargs + ): super(ConfigServerProperties, self).__init__(**kwargs) self.state = None self.error = error self.config_server = config_server -class ConfigServerSettings(Model): +class ConfigServerSettings(msrest.serialization.Model): """The settings of config server. :param git_property: Property of git environment. - :type git_property: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerGitProperty + :type git_property: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ConfigServerGitProperty """ _attribute_map = { 'git_property': {'key': 'gitProperty', 'type': 'ConfigServerGitProperty'}, } - def __init__(self, *, git_property=None, **kwargs) -> None: + def __init__( + self, + *, + git_property: Optional["ConfigServerGitProperty"] = None, + **kwargs + ): super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = git_property -class CustomDomainProperties(Model): +class CustomDomainProperties(msrest.serialization.Model): """Custom domain of app resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param thumbprint: The thumbprint of bound certificate. :type thumbprint: str @@ -651,7 +790,13 @@ class CustomDomainProperties(Model): 'cert_name': {'key': 'certName', 'type': 'str'}, } - def __init__(self, *, thumbprint: str=None, cert_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + thumbprint: Optional[str] = None, + cert_name: Optional[str] = None, + **kwargs + ): super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = thumbprint self.app_name = None @@ -661,8 +806,7 @@ def __init__(self, *, thumbprint: str=None, cert_name: str=None, **kwargs) -> No class CustomDomainResource(ProxyResource): """Custom domain resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -671,8 +815,7 @@ class CustomDomainResource(ProxyResource): :ivar type: The type of the resource. :vartype type: str :param properties: Properties of the custom domain resource. - :type properties: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainProperties + :type properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainProperties """ _validation = { @@ -688,17 +831,48 @@ class CustomDomainResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'CustomDomainProperties'}, } - def __init__(self, *, properties=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["CustomDomainProperties"] = None, + **kwargs + ): super(CustomDomainResource, self).__init__(**kwargs) self.properties = properties -class CustomDomainValidatePayload(Model): +class CustomDomainResourceCollection(msrest.serialization.Model): + """Collection compose of a custom domain resources list and a possible link for next page. + + :param value: The custom domain resources list. + :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResource] + :param next_link: The link to next page of custom domain list. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CustomDomainResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["CustomDomainResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(CustomDomainResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CustomDomainValidatePayload(msrest.serialization.Model): """Custom domain validate payload. All required parameters must be populated in order to send to Azure. - :param name: Required. Name to be validated + :param name: Required. Name to be validated. :type name: str """ @@ -710,12 +884,17 @@ class CustomDomainValidatePayload(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, name: str, **kwargs) -> None: + def __init__( + self, + *, + name: str, + **kwargs + ): super(CustomDomainValidatePayload, self).__init__(**kwargs) self.name = name -class CustomDomainValidateResult(Model): +class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. :param is_valid: Indicates if domain name is valid. @@ -729,27 +908,32 @@ class CustomDomainValidateResult(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, is_valid: bool=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + is_valid: Optional[bool] = None, + message: Optional[str] = None, + **kwargs + ): super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.message = message -class DeploymentInstance(Model): +class DeploymentInstance(msrest.serialization.Model): """Deployment instance payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Name of the deployment instance + :ivar name: Name of the deployment instance. :vartype name: str - :ivar status: Status of the deployment instance + :ivar status: Status of the deployment instance. :vartype status: str - :ivar reason: Failed reason of the deployment instance + :ivar reason: Failed reason of the deployment instance. :vartype reason: str - :ivar discovery_status: Discovery status of the deployment instance + :ivar discovery_status: Discovery status of the deployment instance. :vartype discovery_status: str - :ivar start_time: Start time of the deployment instance + :ivar start_time: Start time of the deployment instance. :vartype start_time: str """ @@ -769,7 +953,10 @@ class DeploymentInstance(Model): 'start_time': {'key': 'startTime', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -781,8 +968,7 @@ def __init__(self, **kwargs) -> None: class DeploymentResource(ProxyResource): """Deployment resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -790,10 +976,10 @@ class DeploymentResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Deployment resource + :param properties: Properties of the Deployment resource. :type properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource + :param sku: Sku of the Deployment resource. :type sku: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Sku """ @@ -811,42 +997,71 @@ class DeploymentResource(ProxyResource): 'sku': {'key': 'sku', 'type': 'Sku'}, } - def __init__(self, *, properties=None, sku=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["DeploymentResourceProperties"] = None, + sku: Optional["Sku"] = None, + **kwargs + ): super(DeploymentResource, self).__init__(**kwargs) self.properties = properties self.sku = sku -class DeploymentResourceProperties(Model): +class DeploymentResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :param value: Collection of Deployment resources. + :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["DeploymentResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(DeploymentResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DeploymentResourceProperties(msrest.serialization.Model): """Deployment resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param source: Uploaded source information of the deployment. - :type source: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.UserSourceInfo - :ivar app_name: App name of the deployment + :type source: ~azure.mgmt.appplatform.v2019_05_01_preview.models.UserSourceInfo + :ivar app_name: App name of the deployment. :vartype app_name: str - :param deployment_settings: Deployment settings of the Deployment + :param deployment_settings: Deployment settings of the Deployment. :type deployment_settings: ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Possible - values include: 'Creating', 'Updating', 'Succeeded', 'Failed', 'Deleting' + :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: + "Creating", "Updating", "Succeeded", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Possible values include: - 'Unknown', 'Stopped', 'Running', 'Failed', 'Allocating', 'Upgrading', - 'Compiling' + :ivar status: Status of the Deployment. Possible values include: "Unknown", "Stopped", + "Running", "Failed", "Allocating", "Upgrading", "Compiling". :vartype status: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResourceStatus - :ivar active: Indicates whether the Deployment is active + :ivar active: Indicates whether the Deployment is active. :vartype active: bool - :ivar created_time: Date time when the resource is created - :vartype created_time: datetime - :ivar instances: Collection of instances belong to the Deployment - :vartype instances: - list[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentInstance] + :ivar created_time: Date time when the resource is created. + :vartype created_time: ~datetime.datetime + :ivar instances: Collection of instances belong to the Deployment. + :vartype instances: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentInstance] """ _validation = { @@ -869,7 +1084,13 @@ class DeploymentResourceProperties(Model): 'instances': {'key': 'instances', 'type': '[DeploymentInstance]'}, } - def __init__(self, *, source=None, deployment_settings=None, **kwargs) -> None: + def __init__( + self, + *, + source: Optional["UserSourceInfo"] = None, + deployment_settings: Optional["DeploymentSettings"] = None, + **kwargs + ): super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = source self.app_name = None @@ -881,29 +1102,26 @@ def __init__(self, *, source=None, deployment_settings=None, **kwargs) -> None: self.instances = None -class DeploymentSettings(Model): +class DeploymentSettings(msrest.serialization.Model): """Deployment settings payload. - :param cpu: Required CPU, basic tier should be 1, standard tier should be - in range (1, 4). Default value: 1 . + :param cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). :type cpu: int - :param memory_in_gb: Required Memory size in GB, basic tier should be in - range (1, 2), standard tier should be in range (1, 8). Default value: 1 . + :param memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), standard + tier should be in range (1, 8). :type memory_in_gb: int - :param jvm_options: JVM parameter + :param jvm_options: JVM parameter. :type jvm_options: str - :param net_core_main_entry_path: The path to the .NET executable relative - to zip root + :param net_core_main_entry_path: The path to the .NET executable relative to zip root. :type net_core_main_entry_path: str - :param instance_count: Instance count, basic tier should be in range (1, - 25), standard tier should be in range (1, 500). Default value: 1 . + :param instance_count: Instance count, basic tier should be in range (1, 25), standard tier + should be in range (1, 500). :type instance_count: int - :param environment_variables: Collection of environment variables + :param environment_variables: Collection of environment variables. :type environment_variables: dict[str, str] - :param runtime_version: Runtime version. Possible values include: - 'Java_8', 'Java_11', 'NetCore_31' - :type runtime_version: str or - ~azure.mgmt.appplatform.v2019_05_01_preview.models.RuntimeVersion + :param runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :type runtime_version: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.RuntimeVersion """ _attribute_map = { @@ -916,7 +1134,18 @@ class DeploymentSettings(Model): 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, } - def __init__(self, *, cpu: int=1, memory_in_gb: int=1, jvm_options: str=None, net_core_main_entry_path: str=None, instance_count: int=1, environment_variables=None, runtime_version=None, **kwargs) -> None: + def __init__( + self, + *, + cpu: Optional[int] = 1, + memory_in_gb: Optional[int] = 1, + jvm_options: Optional[str] = None, + net_core_main_entry_path: Optional[str] = None, + instance_count: Optional[int] = 1, + environment_variables: Optional[Dict[str, str]] = None, + runtime_version: Optional[Union[str, "RuntimeVersion"]] = "Java_8", + **kwargs + ): super(DeploymentSettings, self).__init__(**kwargs) self.cpu = cpu self.memory_in_gb = memory_in_gb @@ -927,7 +1156,7 @@ def __init__(self, *, cpu: int=1, memory_in_gb: int=1, jvm_options: str=None, ne self.runtime_version = runtime_version -class Error(Model): +class Error(msrest.serialization.Model): """The error code compose of code and message. :param code: The code of error. @@ -941,26 +1170,32 @@ class Error(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): super(Error, self).__init__(**kwargs) self.code = code self.message = message -class GitPatternRepository(Model): +class GitPatternRepository(msrest.serialization.Model): """Git repository property payload. All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the repository + :param name: Required. Name of the repository. :type name: str - :param pattern: Collection of pattern of the repository + :param pattern: Collection of pattern of the repository. :type pattern: list[str] - :param uri: Required. URI of the repository + :param uri: Required. URI of the repository. :type uri: str - :param label: Label of the repository + :param label: Label of the repository. :type label: str - :param search_paths: Searching path of the repository + :param search_paths: Searching path of the repository. :type search_paths: list[str] :param username: Username of git repository basic auth. :type username: str @@ -995,7 +1230,22 @@ class GitPatternRepository(Model): 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, } - def __init__(self, *, name: str, uri: str, pattern=None, label: str=None, search_paths=None, username: str=None, password: str=None, host_key: str=None, host_key_algorithm: str=None, private_key: str=None, strict_host_key_checking: bool=None, **kwargs) -> None: + def __init__( + self, + *, + name: str, + uri: str, + pattern: Optional[List[str]] = None, + label: Optional[str] = None, + search_paths: Optional[List[str]] = None, + username: Optional[str] = None, + password: Optional[str] = None, + host_key: Optional[str] = None, + host_key_algorithm: Optional[str] = None, + private_key: Optional[str] = None, + strict_host_key_checking: Optional[bool] = None, + **kwargs + ): super(GitPatternRepository, self).__init__(**kwargs) self.name = name self.pattern = pattern @@ -1010,12 +1260,12 @@ def __init__(self, *, name: str, uri: str, pattern=None, label: str=None, search self.strict_host_key_checking = strict_host_key_checking -class LogFileUrlResponse(Model): +class LogFileUrlResponse(msrest.serialization.Model): """Log file URL payload. All required parameters must be populated in order to send to Azure. - :param url: Required. URL of the log file + :param url: Required. URL of the log file. :type url: str """ @@ -1027,19 +1277,24 @@ class LogFileUrlResponse(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, *, url: str, **kwargs) -> None: + def __init__( + self, + *, + url: str, + **kwargs + ): super(LogFileUrlResponse, self).__init__(**kwargs) self.url = url -class LogSpecification(Model): +class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :param name: Name of the log + :param name: Name of the log. :type name: str - :param display_name: Localized friendly display name of the log + :param display_name: Localized friendly display name of the log. :type display_name: str - :param blob_duration: Blob duration of the log + :param blob_duration: Blob duration of the log. :type blob_duration: str """ @@ -1049,20 +1304,26 @@ class LogSpecification(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, *, name: str=None, display_name: str=None, blob_duration: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name self.blob_duration = blob_duration -class ManagedIdentityProperties(Model): +class ManagedIdentityProperties(msrest.serialization.Model): """Managed identity properties retrieved from ARM request headers. - :param type: Possible values include: 'None', 'SystemAssigned', - 'UserAssigned', 'SystemAssigned,UserAssigned' - :type type: str or - ~azure.mgmt.appplatform.v2019_05_01_preview.models.ManagedIdentityType + :param type: Possible values include: "None", "SystemAssigned", "UserAssigned", + "SystemAssigned,UserAssigned". + :type type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.ManagedIdentityType :param principal_id: :type principal_id: str :param tenant_id: @@ -1075,22 +1336,29 @@ class ManagedIdentityProperties(Model): 'tenant_id': {'key': 'tenantId', 'type': 'str'}, } - def __init__(self, *, type=None, principal_id: str=None, tenant_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + type: Optional[Union[str, "ManagedIdentityType"]] = None, + principal_id: Optional[str] = None, + tenant_id: Optional[str] = None, + **kwargs + ): super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = type self.principal_id = principal_id self.tenant_id = tenant_id -class MetricDimension(Model): +class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension + :param name: Name of the dimension. :type name: str - :param display_name: Localized friendly display name of the dimension + :param display_name: Localized friendly display name of the dimension. :type display_name: str - :param to_be_exported_for_shoebox: Whether this dimension should be - included for the Shoebox export scenario + :param to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. :type to_be_exported_for_shoebox: bool """ @@ -1100,40 +1368,46 @@ class MetricDimension(Model): 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } - def __init__(self, *, name: str=None, display_name: str=None, to_be_exported_for_shoebox: bool=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + **kwargs + ): super(MetricDimension, self).__init__(**kwargs) self.name = name self.display_name = display_name self.to_be_exported_for_shoebox = to_be_exported_for_shoebox -class MetricSpecification(Model): +class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :param name: Name of the metric + :param name: Name of the metric. :type name: str - :param display_name: Localized friendly display name of the metric + :param display_name: Localized friendly display name of the metric. :type display_name: str - :param display_description: Localized friendly description of the metric + :param display_description: Localized friendly description of the metric. :type display_description: str - :param unit: Unit that makes sense for the metric + :param unit: Unit that makes sense for the metric. :type unit: str - :param category: Name of the metric category that the metric belongs to. A - metric can only belong to a single category. + :param category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. :type category: str - :param aggregation_type: Only provide one value for this field. Valid - values: Average, Minimum, Maximum, Total, Count. + :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + Maximum, Total, Count. :type aggregation_type: str - :param supported_aggregation_types: Supported aggregation types + :param supported_aggregation_types: Supported aggregation types. :type supported_aggregation_types: list[str] - :param supported_time_grain_types: Supported time grain types + :param supported_time_grain_types: Supported time grain types. :type supported_time_grain_types: list[str] - :param fill_gap_with_zero: Optional. If set to true, then zero will be - returned for time duration where no metric is emitted/published. + :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. :type fill_gap_with_zero: bool - :param dimensions: Dimensions of the metric - :type dimensions: - list[~azure.mgmt.appplatform.v2019_05_01_preview.models.MetricDimension] + :param dimensions: Dimensions of the metric. + :type dimensions: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.MetricDimension] """ _attribute_map = { @@ -1149,7 +1423,21 @@ class MetricSpecification(Model): 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, } - def __init__(self, *, name: str=None, display_name: str=None, display_description: str=None, unit: str=None, category: str=None, aggregation_type: str=None, supported_aggregation_types=None, supported_time_grain_types=None, fill_gap_with_zero: bool=None, dimensions=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + category: Optional[str] = None, + aggregation_type: Optional[str] = None, + supported_aggregation_types: Optional[List[str]] = None, + supported_time_grain_types: Optional[List[str]] = None, + fill_gap_with_zero: Optional[bool] = None, + dimensions: Optional[List["MetricDimension"]] = None, + **kwargs + ): super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1163,14 +1451,14 @@ def __init__(self, *, name: str=None, display_name: str=None, display_descriptio self.dimensions = dimensions -class NameAvailability(Model): +class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :param name_available: Indicates whether the name is available + :param name_available: Indicates whether the name is available. :type name_available: bool - :param reason: Reason why the name is not available + :param reason: Reason why the name is not available. :type reason: str - :param message: Message why the name is not available + :param message: Message why the name is not available. :type message: str """ @@ -1180,21 +1468,28 @@ class NameAvailability(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, name_available: bool=None, reason: str=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): super(NameAvailability, self).__init__(**kwargs) self.name_available = name_available self.reason = reason self.message = message -class NameAvailabilityParameters(Model): +class NameAvailabilityParameters(msrest.serialization.Model): """Name availability parameters payload. All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the resource to check name availability + :param type: Required. Type of the resource to check name availability. :type type: str - :param name: Required. Name to be checked + :param name: Required. Name to be checked. :type name: str """ @@ -1208,44 +1503,47 @@ class NameAvailabilityParameters(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, type: str, name: str, **kwargs) -> None: + def __init__( + self, + *, + type: str, + name: str, + **kwargs + ): super(NameAvailabilityParameters, self).__init__(**kwargs) self.type = type self.name = name -class NetworkProfile(Model): +class NetworkProfile(msrest.serialization.Model): """Service network profile payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param service_runtime_subnet_id: Fully qualified resource Id of the - subnet to host Azure Spring Cloud Service Runtime + :param service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. :type service_runtime_subnet_id: str - :param app_subnet_id: Fully qualified resource Id of the subnet to host - Azure Spring Cloud Apps + :param app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. :type app_subnet_id: str - :param service_cidr: Azure Spring Cloud service reserved CIDR + :param service_cidr: Azure Spring Cloud service reserved CIDR. :type service_cidr: str - :param service_runtime_network_resource_group: Name of the resource group - containing network resources of Azure Spring Cloud Service Runtime + :param service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. :type service_runtime_network_resource_group: str - :param app_network_resource_group: Name of the resource group containing - network resources of Azure Spring Cloud Apps + :param app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. :type app_network_resource_group: str - :ivar outbound_ips: Desired outbound IP resources for Azure Spring Cloud - instance. - :vartype outbound_ips: + :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Cloud instance. + :vartype outbound_i_ps: ~azure.mgmt.appplatform.v2019_05_01_preview.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure - Spring Cloud instance. + :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Cloud instance. :vartype required_traffics: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.RequiredTraffic] """ _validation = { - 'outbound_ips': {'readonly': True}, + 'outbound_i_ps': {'readonly': True}, 'required_traffics': {'readonly': True}, } @@ -1255,59 +1553,68 @@ class NetworkProfile(Model): 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, 'service_runtime_network_resource_group': {'key': 'serviceRuntimeNetworkResourceGroup', 'type': 'str'}, 'app_network_resource_group': {'key': 'appNetworkResourceGroup', 'type': 'str'}, - 'outbound_ips': {'key': 'outboundIPs', 'type': 'NetworkProfileOutboundIPs'}, + 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'NetworkProfileOutboundIPs'}, 'required_traffics': {'key': 'requiredTraffics', 'type': '[RequiredTraffic]'}, } - def __init__(self, *, service_runtime_subnet_id: str=None, app_subnet_id: str=None, service_cidr: str=None, service_runtime_network_resource_group: str=None, app_network_resource_group: str=None, **kwargs) -> None: + def __init__( + self, + *, + service_runtime_subnet_id: Optional[str] = None, + app_subnet_id: Optional[str] = None, + service_cidr: Optional[str] = None, + service_runtime_network_resource_group: Optional[str] = None, + app_network_resource_group: Optional[str] = None, + **kwargs + ): super(NetworkProfile, self).__init__(**kwargs) self.service_runtime_subnet_id = service_runtime_subnet_id self.app_subnet_id = app_subnet_id self.service_cidr = service_cidr self.service_runtime_network_resource_group = service_runtime_network_resource_group self.app_network_resource_group = app_network_resource_group - self.outbound_ips = None + self.outbound_i_ps = None self.required_traffics = None -class NetworkProfileOutboundIPs(Model): +class NetworkProfileOutboundIPs(msrest.serialization.Model): """Desired outbound IP resources for Azure Spring Cloud instance. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar public_ips: A list of public IP addresses. - :vartype public_ips: list[str] + :ivar public_i_ps: A list of public IP addresses. + :vartype public_i_ps: list[str] """ _validation = { - 'public_ips': {'readonly': True}, + 'public_i_ps': {'readonly': True}, } _attribute_map = { - 'public_ips': {'key': 'publicIPs', 'type': '[str]'}, + 'public_i_ps': {'key': 'publicIPs', 'type': '[str]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(NetworkProfileOutboundIPs, self).__init__(**kwargs) - self.public_ips = None + self.public_i_ps = None -class OperationDetail(Model): +class OperationDetail(msrest.serialization.Model): """Operation detail payload. - :param name: Name of the operation + :param name: Name of the operation. :type name: str - :param is_data_action: Indicates whether the operation is a data action + :param is_data_action: Indicates whether the operation is a data action. :type is_data_action: bool - :param display: Display of the operation - :type display: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationDisplay - :param origin: Origin of the operation + :param display: Display of the operation. + :type display: ~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationDisplay + :param origin: Origin of the operation. :type origin: str - :param properties: Properties of the operation - :type properties: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationProperties + :param properties: Properties of the operation. + :type properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationProperties """ _attribute_map = { @@ -1318,7 +1625,16 @@ class OperationDetail(Model): 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } - def __init__(self, *, name: str=None, is_data_action: bool=None, display=None, origin: str=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + properties: Optional["OperationProperties"] = None, + **kwargs + ): super(OperationDetail, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action @@ -1327,16 +1643,16 @@ def __init__(self, *, name: str=None, is_data_action: bool=None, display=None, o self.properties = properties -class OperationDisplay(Model): +class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :param provider: Resource provider of the operation + :param provider: Resource provider of the operation. :type provider: str - :param resource: Resource of the operation + :param resource: Resource of the operation. :type resource: str - :param operation: Localized friendly name for the operation + :param operation: Localized friendly name for the operation. :type operation: str - :param description: Localized friendly description for the operation + :param description: Localized friendly description for the operation. :type description: str """ @@ -1347,7 +1663,15 @@ class OperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1355,10 +1679,10 @@ def __init__(self, *, provider: str=None, resource: str=None, operation: str=Non self.description = description -class OperationProperties(Model): +class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :param service_specification: Service specifications of the operation + :param service_specification: Service specifications of the operation. :type service_specification: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceSpecification """ @@ -1367,22 +1691,26 @@ class OperationProperties(Model): 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, *, service_specification=None, **kwargs) -> None: + def __init__( + self, + *, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification -class PersistentDisk(Model): +class PersistentDisk(msrest.serialization.Model): """Persistent disk payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param size_in_gb: Size of the persistent disk in GB + :param size_in_gb: Size of the persistent disk in GB. :type size_in_gb: int - :ivar used_in_gb: Size of the used persistent disk in GB + :ivar used_in_gb: Size of the used persistent disk in GB. :vartype used_in_gb: int - :param mount_path: Mount path of the persistent disk + :param mount_path: Mount path of the persistent disk. :type mount_path: str """ @@ -1397,22 +1725,27 @@ class PersistentDisk(Model): 'mount_path': {'key': 'mountPath', 'type': 'str'}, } - def __init__(self, *, size_in_gb: int=None, mount_path: str=None, **kwargs) -> None: + def __init__( + self, + *, + size_in_gb: Optional[int] = None, + mount_path: Optional[str] = None, + **kwargs + ): super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.used_in_gb = None self.mount_path = mount_path -class RegenerateTestKeyRequestPayload(Model): +class RegenerateTestKeyRequestPayload(msrest.serialization.Model): """Regenerate test key request payload. All required parameters must be populated in order to send to Azure. - :param key_type: Required. Type of the test key. Possible values include: - 'Primary', 'Secondary' - :type key_type: str or - ~azure.mgmt.appplatform.v2019_05_01_preview.models.TestKeyType + :param key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :type key_type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.TestKeyType """ _validation = { @@ -1423,29 +1756,32 @@ class RegenerateTestKeyRequestPayload(Model): 'key_type': {'key': 'keyType', 'type': 'str'}, } - def __init__(self, *, key_type, **kwargs) -> None: + def __init__( + self, + *, + key_type: Union[str, "TestKeyType"], + **kwargs + ): super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) self.key_type = key_type -class RequiredTraffic(Model): +class RequiredTraffic(msrest.serialization.Model): """Required inbound or outbound traffic for Azure Spring Cloud instance. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar protocol: The protocol of required traffic + :ivar protocol: The protocol of required traffic. :vartype protocol: str - :ivar port: The port of required traffic + :ivar port: The port of required traffic. :vartype port: int - :ivar ips: The ip list of required traffic + :ivar ips: The ip list of required traffic. :vartype ips: list[str] - :ivar fqdns: The FQDN list of required traffic + :ivar fqdns: The FQDN list of required traffic. :vartype fqdns: list[str] - :ivar direction: The direction of required traffic. Possible values - include: 'Inbound', 'Outbound' - :vartype direction: str or - ~azure.mgmt.appplatform.v2019_05_01_preview.models.TrafficDirection + :ivar direction: The direction of required traffic. Possible values include: "Inbound", + "Outbound". + :vartype direction: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.TrafficDirection """ _validation = { @@ -1464,7 +1800,10 @@ class RequiredTraffic(Model): 'direction': {'key': 'direction', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -1473,7 +1812,7 @@ def __init__(self, **kwargs) -> None: self.direction = None -class ResourceSku(Model): +class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. :param resource_type: Gets the type of resource the SKU applies to. @@ -1483,16 +1822,14 @@ class ResourceSku(Model): :param tier: Gets the tier of SKU. :type tier: str :param capacity: Gets the capacity of SKU. - :type capacity: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.SkuCapacity + :type capacity: ~azure.mgmt.appplatform.v2019_05_01_preview.models.SkuCapacity :param locations: Gets the set of locations that the SKU is available. :type locations: list[str] - :param location_info: Gets a list of locations and availability zones in - those locations where the SKU is available. + :param location_info: Gets a list of locations and availability zones in those locations where + the SKU is available. :type location_info: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuLocationInfo] - :param restrictions: Gets the restrictions because of which SKU cannot be - used. This is + :param restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. :type restrictions: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictions] @@ -1508,7 +1845,18 @@ class ResourceSku(Model): 'restrictions': {'key': 'restrictions', 'type': '[ResourceSkuRestrictions]'}, } - def __init__(self, *, resource_type: str=None, name: str=None, tier: str=None, capacity=None, locations=None, location_info=None, restrictions=None, **kwargs) -> None: + def __init__( + self, + *, + resource_type: Optional[str] = None, + name: Optional[str] = None, + tier: Optional[str] = None, + capacity: Optional["SkuCapacity"] = None, + locations: Optional[List[str]] = None, + location_info: Optional[List["ResourceSkuLocationInfo"]] = None, + restrictions: Optional[List["ResourceSkuRestrictions"]] = None, + **kwargs + ): super(ResourceSku, self).__init__(**kwargs) self.resource_type = resource_type self.name = name @@ -1519,7 +1867,7 @@ def __init__(self, *, resource_type: str=None, name: str=None, tier: str=None, c self.restrictions = restrictions -class ResourceSkuCapabilities(Model): +class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. :param name: Gets an invariant to describe the feature. @@ -1533,21 +1881,53 @@ class ResourceSkuCapabilities(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, *, name: str=None, value: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = name self.value = value -class ResourceSkuLocationInfo(Model): +class ResourceSkuCollection(msrest.serialization.Model): + """ResourceSkuCollection. + + :param value: Collection of resource SKU. + :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSku] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceSku]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ResourceSku"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ResourceSkuCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ResourceSkuLocationInfo(msrest.serialization.Model): """ResourceSkuLocationInfo. - :param location: Gets location of the SKU + :param location: Gets location of the SKU. :type location: str :param zones: Gets list of availability zones where the SKU is supported. :type zones: list[str] - :param zone_details: Gets details of capabilities available to a SKU in - specific zones. + :param zone_details: Gets details of capabilities available to a SKU in specific zones. :type zone_details: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuZoneDetails] """ @@ -1558,17 +1938,24 @@ class ResourceSkuLocationInfo(Model): 'zone_details': {'key': 'zoneDetails', 'type': '[ResourceSkuZoneDetails]'}, } - def __init__(self, *, location: str=None, zones=None, zone_details=None, **kwargs) -> None: + def __init__( + self, + *, + location: Optional[str] = None, + zones: Optional[List[str]] = None, + zone_details: Optional[List["ResourceSkuZoneDetails"]] = None, + **kwargs + ): super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = location self.zones = zones self.zone_details = zone_details -class ResourceSkuRestrictionInfo(Model): +class ResourceSkuRestrictionInfo(msrest.serialization.Model): """ResourceSkuRestrictionInfo. - :param locations: Gets locations where the SKU is restricted + :param locations: Gets locations where the SKU is restricted. :type locations: list[str] :param zones: Gets list of availability zones where the SKU is restricted. :type zones: list[str] @@ -1579,29 +1966,35 @@ class ResourceSkuRestrictionInfo(Model): 'zones': {'key': 'zones', 'type': '[str]'}, } - def __init__(self, *, locations=None, zones=None, **kwargs) -> None: + def __init__( + self, + *, + locations: Optional[List[str]] = None, + zones: Optional[List[str]] = None, + **kwargs + ): super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = locations self.zones = zones -class ResourceSkuRestrictions(Model): +class ResourceSkuRestrictions(msrest.serialization.Model): """ResourceSkuRestrictions. - :param type: Gets the type of restrictions. Possible values include: - 'Location', 'Zone' + :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". :type type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictionsType - :param values: Gets the value of restrictions. If the restriction type is - set to + :param values: Gets the value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. :type values: list[str] - :param restriction_info: Gets the information about the restriction where - the SKU cannot be used. + :param restriction_info: Gets the information about the restriction where the SKU cannot be + used. :type restriction_info: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictionInfo - :param reason_code: Gets the reason for restriction. Possible values - include: 'QuotaId', 'NotAvailableForSubscription' + :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". :type reason_code: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuRestrictionsReasonCode """ @@ -1613,7 +2006,15 @@ class ResourceSkuRestrictions(Model): 'reason_code': {'key': 'reasonCode', 'type': 'str'}, } - def __init__(self, *, type=None, values=None, restriction_info=None, reason_code=None, **kwargs) -> None: + def __init__( + self, + *, + type: Optional[Union[str, "ResourceSkuRestrictionsType"]] = None, + values: Optional[List[str]] = None, + restriction_info: Optional["ResourceSkuRestrictionInfo"] = None, + reason_code: Optional[Union[str, "ResourceSkuRestrictionsReasonCode"]] = None, + **kwargs + ): super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = type self.values = values @@ -1621,14 +2022,13 @@ def __init__(self, *, type=None, values=None, restriction_info=None, reason_code self.reason_code = reason_code -class ResourceSkuZoneDetails(Model): +class ResourceSkuZoneDetails(msrest.serialization.Model): """ResourceSkuZoneDetails. :param name: Gets the set of zones that the SKU is available in with the specified capabilities. :type name: list[str] - :param capabilities: Gets a list of capabilities that are available for - the SKU in the + :param capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. :type capabilities: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuCapabilities] @@ -1639,18 +2039,24 @@ class ResourceSkuZoneDetails(Model): 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, } - def __init__(self, *, name=None, capabilities=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[List[str]] = None, + capabilities: Optional[List["ResourceSkuCapabilities"]] = None, + **kwargs + ): super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = name self.capabilities = capabilities -class ResourceUploadDefinition(Model): +class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :param relative_path: Source relative path + :param relative_path: Source relative path. :type relative_path: str - :param upload_url: Upload URL + :param upload_url: Upload URL. :type upload_url: str """ @@ -1659,7 +2065,13 @@ class ResourceUploadDefinition(Model): 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, } - def __init__(self, *, relative_path: str=None, upload_url: str=None, **kwargs) -> None: + def __init__( + self, + *, + relative_path: Optional[str] = None, + upload_url: Optional[str] = None, + **kwargs + ): super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = relative_path self.upload_url = upload_url @@ -1668,8 +2080,7 @@ def __init__(self, *, relative_path: str=None, upload_url: str=None, **kwargs) - class TrackedResource(Resource): """The resource model definition for a ARM tracked top level resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -1679,7 +2090,7 @@ class TrackedResource(Resource): :vartype type: str :param location: The GEO location of the resource. :type location: str - :param tags: Tags of the service which is a list of key value pairs that + :param tags: A set of tags. Tags of the service which is a list of key value pairs that describe the resource. :type tags: dict[str, str] """ @@ -1698,7 +2109,13 @@ class TrackedResource(Resource): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, location: str=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(TrackedResource, self).__init__(**kwargs) self.location = location self.tags = tags @@ -1707,8 +2124,7 @@ def __init__(self, *, location: str=None, tags=None, **kwargs) -> None: class ServiceResource(TrackedResource): """Service resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -1718,13 +2134,12 @@ class ServiceResource(TrackedResource): :vartype type: str :param location: The GEO location of the resource. :type location: str - :param tags: Tags of the service which is a list of key value pairs that + :param tags: A set of tags. Tags of the service which is a list of key value pairs that describe the resource. :type tags: dict[str, str] - :param properties: Properties of the Service resource - :type properties: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.ClusterResourceProperties - :param sku: Sku of the Service resource + :param properties: Properties of the Service resource. + :type properties: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ClusterResourceProperties + :param sku: Sku of the Service resource. :type sku: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Sku """ @@ -1744,20 +2159,54 @@ class ServiceResource(TrackedResource): 'sku': {'key': 'sku', 'type': 'Sku'}, } - def __init__(self, *, location: str=None, tags=None, properties=None, sku=None, **kwargs) -> None: + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional["ClusterResourceProperties"] = None, + sku: Optional["Sku"] = None, + **kwargs + ): super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.properties = properties self.sku = sku -class ServiceSpecification(Model): +class ServiceResourceList(msrest.serialization.Model): + """Object that includes an array of Service resources and a possible link for next set. + + :param value: Collection of Service resources. + :type value: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ServiceResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ServiceResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ServiceResourceList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :param log_specifications: Specifications of the Log for Azure Monitoring + :param log_specifications: Specifications of the Log for Azure Monitoring. :type log_specifications: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.LogSpecification] - :param metric_specifications: Specifications of the Metrics for Azure - Monitoring + :param metric_specifications: Specifications of the Metrics for Azure Monitoring. :type metric_specifications: list[~azure.mgmt.appplatform.v2019_05_01_preview.models.MetricSpecification] """ @@ -1767,20 +2216,26 @@ class ServiceSpecification(Model): 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, } - def __init__(self, *, log_specifications=None, metric_specifications=None, **kwargs) -> None: + def __init__( + self, + *, + log_specifications: Optional[List["LogSpecification"]] = None, + metric_specifications: Optional[List["MetricSpecification"]] = None, + **kwargs + ): super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications -class Sku(Model): +class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :param name: Name of the Sku. Default value: "S0" . + :param name: Name of the Sku. :type name: str - :param tier: Tier of the Sku. Default value: "Standard" . + :param tier: Tier of the Sku. :type tier: str - :param capacity: Current capacity of the target resource + :param capacity: Current capacity of the target resource. :type capacity: int """ @@ -1790,14 +2245,21 @@ class Sku(Model): 'capacity': {'key': 'capacity', 'type': 'int'}, } - def __init__(self, *, name: str="S0", tier: str="Standard", capacity: int=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = "S0", + tier: Optional[str] = "Standard", + capacity: Optional[int] = None, + **kwargs + ): super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier self.capacity = capacity -class SkuCapacity(Model): +class SkuCapacity(msrest.serialization.Model): """The SKU capacity. All required parameters must be populated in order to send to Azure. @@ -1808,10 +2270,9 @@ class SkuCapacity(Model): :type maximum: int :param default: Gets or sets the default. :type default: int - :param scale_type: Gets or sets the type of the scale. Possible values - include: 'None', 'Manual', 'Automatic' - :type scale_type: str or - ~azure.mgmt.appplatform.v2019_05_01_preview.models.SkuScaleType + :param scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :type scale_type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.SkuScaleType """ _validation = { @@ -1825,7 +2286,15 @@ class SkuCapacity(Model): 'scale_type': {'key': 'scaleType', 'type': 'str'}, } - def __init__(self, *, minimum: int, maximum: int=None, default: int=None, scale_type=None, **kwargs) -> None: + def __init__( + self, + *, + minimum: int, + maximum: Optional[int] = None, + default: Optional[int] = None, + scale_type: Optional[Union[str, "SkuScaleType"]] = None, + **kwargs + ): super(SkuCapacity, self).__init__(**kwargs) self.minimum = minimum self.maximum = maximum @@ -1833,15 +2302,14 @@ def __init__(self, *, minimum: int, maximum: int=None, default: int=None, scale_ self.scale_type = scale_type -class SupportedRuntimeVersion(Model): +class SupportedRuntimeVersion(msrest.serialization.Model): """Supported deployment runtime version descriptor. - :param value: The raw value which could be passed to deployment CRUD - operations. Possible values include: 'Java_8', 'Java_11', 'NetCore_31' - :type value: str or - ~azure.mgmt.appplatform.v2019_05_01_preview.models.SupportedRuntimeValue - :param platform: The platform of this runtime version (possible values: - "Java" or ".NET"). Possible values include: 'Java', '.NET Core' + :param value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :type value: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.SupportedRuntimeValue + :param platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". :type platform: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.SupportedRuntimePlatform :param version: The detailed version (major.minor) of the platform. @@ -1854,19 +2322,26 @@ class SupportedRuntimeVersion(Model): 'version': {'key': 'version', 'type': 'str'}, } - def __init__(self, *, value=None, platform=None, version: str=None, **kwargs) -> None: + def __init__( + self, + *, + value: Optional[Union[str, "SupportedRuntimeValue"]] = None, + platform: Optional[Union[str, "SupportedRuntimePlatform"]] = None, + version: Optional[str] = None, + **kwargs + ): super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = value self.platform = platform self.version = version -class TemporaryDisk(Model): +class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :param size_in_gb: Size of the temporary disk in GB + :param size_in_gb: Size of the temporary disk in GB. :type size_in_gb: int - :param mount_path: Mount path of the temporary disk + :param mount_path: Mount path of the temporary disk. :type mount_path: str """ @@ -1879,24 +2354,30 @@ class TemporaryDisk(Model): 'mount_path': {'key': 'mountPath', 'type': 'str'}, } - def __init__(self, *, size_in_gb: int=None, mount_path: str=None, **kwargs) -> None: + def __init__( + self, + *, + size_in_gb: Optional[int] = None, + mount_path: Optional[str] = "/tmp", + **kwargs + ): super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.mount_path = mount_path -class TestKeys(Model): +class TestKeys(msrest.serialization.Model): """Test keys payload. - :param primary_key: Primary key + :param primary_key: Primary key. :type primary_key: str - :param secondary_key: Secondary key + :param secondary_key: Secondary key. :type secondary_key: str - :param primary_test_endpoint: Primary test endpoint + :param primary_test_endpoint: Primary test endpoint. :type primary_test_endpoint: str - :param secondary_test_endpoint: Secondary test endpoint + :param secondary_test_endpoint: Secondary test endpoint. :type secondary_test_endpoint: str - :param enabled: Indicates whether the test endpoint feature enabled or not + :param enabled: Indicates whether the test endpoint feature enabled or not. :type enabled: bool """ @@ -1908,7 +2389,16 @@ class TestKeys(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, *, primary_key: str=None, secondary_key: str=None, primary_test_endpoint: str=None, secondary_test_endpoint: str=None, enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + primary_key: Optional[str] = None, + secondary_key: Optional[str] = None, + primary_test_endpoint: Optional[str] = None, + secondary_test_endpoint: Optional[str] = None, + enabled: Optional[bool] = None, + **kwargs + ): super(TestKeys, self).__init__(**kwargs) self.primary_key = primary_key self.secondary_key = secondary_key @@ -1917,22 +2407,19 @@ def __init__(self, *, primary_key: str=None, secondary_key: str=None, primary_te self.enabled = enabled -class TraceProperties(Model): +class TraceProperties(msrest.serialization.Model): """Trace properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar state: State of the trace proxy. Possible values include: - 'NotAvailable', 'Failed', 'Succeeded', 'Updating' - :vartype state: str or - ~azure.mgmt.appplatform.v2019_05_01_preview.models.TraceProxyState + :ivar state: State of the trace proxy. Possible values include: "NotAvailable", "Failed", + "Succeeded", "Updating". + :vartype state: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.TraceProxyState :param error: Error when apply trace proxy changes. :type error: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Error - :param enabled: Indicates whether enable the tracing functionality + :param enabled: Indicates whether enable the tracing functionality. :type enabled: bool - :param app_insight_instrumentation_key: Target application insight - instrumentation key + :param app_insight_instrumentation_key: Target application insight instrumentation key. :type app_insight_instrumentation_key: str """ @@ -1947,7 +2434,14 @@ class TraceProperties(Model): 'app_insight_instrumentation_key': {'key': 'appInsightInstrumentationKey', 'type': 'str'}, } - def __init__(self, *, error=None, enabled: bool=None, app_insight_instrumentation_key: str=None, **kwargs) -> None: + def __init__( + self, + *, + error: Optional["Error"] = None, + enabled: Optional[bool] = None, + app_insight_instrumentation_key: Optional[str] = None, + **kwargs + ): super(TraceProperties, self).__init__(**kwargs) self.state = None self.error = error @@ -1955,19 +2449,18 @@ def __init__(self, *, error=None, enabled: bool=None, app_insight_instrumentatio self.app_insight_instrumentation_key = app_insight_instrumentation_key -class UserSourceInfo(Model): +class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :param type: Type of the source uploaded. Possible values include: 'Jar', - 'NetCoreZip', 'Source' - :type type: str or - ~azure.mgmt.appplatform.v2019_05_01_preview.models.UserSourceType - :param relative_path: Relative path of the storage which stores the source + :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source". + :type type: str or ~azure.mgmt.appplatform.v2019_05_01_preview.models.UserSourceType + :param relative_path: Relative path of the storage which stores the source. :type relative_path: str - :param version: Version of the source + :param version: Version of the source. :type version: str - :param artifact_selector: Selector for the artifact to be used for the - deployment for multi-module projects. This should be + :param artifact_selector: Selector for the artifact to be used for the deployment for + multi-module projects. This should be the relative path to the target module/project. :type artifact_selector: str """ @@ -1979,7 +2472,15 @@ class UserSourceInfo(Model): 'artifact_selector': {'key': 'artifactSelector', 'type': 'str'}, } - def __init__(self, *, type=None, relative_path: str=None, version: str=None, artifact_selector: str=None, **kwargs) -> None: + def __init__( + self, + *, + type: Optional[Union[str, "UserSourceType"]] = None, + relative_path: Optional[str] = None, + version: Optional[str] = None, + artifact_selector: Optional[str] = None, + **kwargs + ): super(UserSourceInfo, self).__init__(**kwargs) self.type = type self.relative_path = relative_path diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/models/_paged_models.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/models/_paged_models.py deleted file mode 100644 index 3338dac377b..00000000000 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/models/_paged_models.py +++ /dev/null @@ -1,118 +0,0 @@ -# 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. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class ServiceResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`ServiceResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ServiceResource]'} - } - - def __init__(self, *args, **kwargs): - - super(ServiceResourcePaged, self).__init__(*args, **kwargs) -class AppResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`AppResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[AppResource]'} - } - - def __init__(self, *args, **kwargs): - - super(AppResourcePaged, self).__init__(*args, **kwargs) -class BindingResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`BindingResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[BindingResource]'} - } - - def __init__(self, *args, **kwargs): - - super(BindingResourcePaged, self).__init__(*args, **kwargs) -class CertificateResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`CertificateResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CertificateResource]'} - } - - def __init__(self, *args, **kwargs): - - super(CertificateResourcePaged, self).__init__(*args, **kwargs) -class CustomDomainResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`CustomDomainResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CustomDomainResource]'} - } - - def __init__(self, *args, **kwargs): - - super(CustomDomainResourcePaged, self).__init__(*args, **kwargs) -class DeploymentResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`DeploymentResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeploymentResource]'} - } - - def __init__(self, *args, **kwargs): - - super(DeploymentResourcePaged, self).__init__(*args, **kwargs) -class OperationDetailPaged(Paged): - """ - A paging container for iterating over a list of :class:`OperationDetail ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[OperationDetail]'} - } - - def __init__(self, *args, **kwargs): - - super(OperationDetailPaged, self).__init__(*args, **kwargs) -class ResourceSkuPaged(Paged): - """ - A paging container for iterating over a list of :class:`ResourceSku ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ResourceSku]'} - } - - def __init__(self, *args, **kwargs): - - super(ResourceSkuPaged, self).__init__(*args, **kwargs) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/__init__.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/__init__.py index de8f71f38f0..52627bc6018 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/__init__.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/__init__.py @@ -1,12 +1,9 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from ._services_operations import ServicesOperations diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_apps_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_apps_operations.py index 9ae13765156..3f791b54467 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_apps_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_apps_operations.py @@ -1,530 +1,594 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class AppsOperations(object): """AppsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2019_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2019-05-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-05-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, app_name, sync_status=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + sync_status=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" """Get an App and its properties. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status + :param sync_status: Indicates whether sync status. :type sync_status: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppResource or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResource, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if sync_status is not None: query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AppResource', response) + deserialized = self._deserialize('AppResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, service_name, app_name, app_resource, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(app_resource, 'AppResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AppResource', response) + deserialized = self._deserialize('AppResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('AppResource', response) + deserialized = self._deserialize('AppResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, service_name, app_name, app_resource, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.AppResource"] """Create a new App or update an exiting App. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param app_resource: Parameters for the create or update operation - :type app_resource: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns AppResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource]] - :raises: :class:`CloudError` + :param app_resource: Parameters for the create or update operation. + :type app_resource: ~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - app_resource=app_resource, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('AppResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def delete( - self, resource_group_name, service_name, app_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Operation to delete an App. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} + if cls: + return cls(pipeline_response, None, {}) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def _update_initial( - self, resource_group_name, service_name, app_name, app_resource, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(app_resource, 'AppResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AppResource', response) + deserialized = self._deserialize('AppResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('AppResource', response) + deserialized = self._deserialize('AppResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, service_name, app_name, app_resource, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.AppResource"] """Operation to update an exiting App. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param app_resource: Parameters for the update operation - :type app_resource: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns AppResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource]] - :raises: :class:`CloudError` + :param app_resource: Parameters for the update operation. + :type app_resource: ~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - app_resource=app_resource, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('AppResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def list( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AppResourceCollection"] """Handles requests to list all resources in a Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppResource - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResourcePaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.AppResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore def get_resource_upload_url( - self, resource_group_name, service_name, app_name, custom_headers=None, raw=False, **operation_config): - """Get an resource upload URL for an App, which may be artifacts or source - archive. - - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceUploadDefinition" + """Get an resource upload URL for an App, which may be artifacts or source archive. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ResourceUploadDefinition or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceUploadDefinition - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceUploadDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceUploadDefinition + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL - url = self.get_resource_upload_url.metadata['url'] + url = self.get_resource_upload_url.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ResourceUploadDefinition', response) + deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_bindings_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_bindings_operations.py index 83ebe124109..9b461988205 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_bindings_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_bindings_operations.py @@ -1,51 +1,63 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class BindingsOperations(object): """BindingsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2019_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2019-05-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-05-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, app_name, binding_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" """Get a Binding and its properties. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -53,69 +65,68 @@ def get( :type app_name: str :param binding_name: The name of the Binding resource. :type binding_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BindingResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BindingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str') + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BindingResource', response) + deserialized = self._deserialize('BindingResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def create_or_update( - self, resource_group_name, service_name, app_name, binding_name, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" """Create a new Binding or update an exiting Binding. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -123,78 +134,74 @@ def create_or_update( :type app_name: str :param binding_name: The name of the Binding resource. :type binding_name: str - :param properties: Properties of the Binding resource - :type properties: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResourceProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BindingResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param binding_resource: Parameters for the create or update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BindingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResource + :raises: ~azure.core.exceptions.HttpResponseError """ - binding_resource = models.BindingResource(properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] + url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str') + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(binding_resource, 'BindingResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BindingResource', response) + deserialized = self._deserialize('BindingResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def delete( - self, resource_group_name, service_name, app_name, binding_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Operation to delete a Binding. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -202,60 +209,65 @@ def delete( :type app_name: str :param binding_name: The name of the Binding resource. :type binding_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str') + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def update( - self, resource_group_name, service_name, app_name, binding_name, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" """Operation to update an exiting Binding. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -263,144 +275,137 @@ def update( :type app_name: str :param binding_name: The name of the Binding resource. :type binding_name: str - :param properties: Properties of the Binding resource - :type properties: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResourceProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BindingResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param binding_resource: Parameters for the update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BindingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResource + :raises: ~azure.core.exceptions.HttpResponseError """ - binding_resource = models.BindingResource(properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str') + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(binding_resource, 'BindingResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BindingResource', response) + deserialized = self._deserialize('BindingResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def list( - self, resource_group_name, service_name, app_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.BindingResourceCollection"] """Handles requests to list all resources in an App. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of BindingResource - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResourcePaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.BindingResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.BindingResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_certificates_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_certificates_operations.py index fc34fb799ec..2278aec78e3 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_certificates_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_certificates_operations.py @@ -1,315 +1,319 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class CertificatesOperations(object): """CertificatesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2019_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2019-05-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-05-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, certificate_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateResource" """Get the certificate resource. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param certificate_name: The name of the certificate resource. :type certificate_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CertificateResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateResource - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateResource', response) + deserialized = self._deserialize('CertificateResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore def create_or_update( - self, resource_group_name, service_name, certificate_name, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + certificate_resource, # type: "_models.CertificateResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateResource" """Create or update certificate resource. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param certificate_name: The name of the certificate resource. :type certificate_name: str - :param properties: Properties of the certificate resource payload. - :type properties: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CertificateResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateResource - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param certificate_resource: Parameters for the create or update operation. + :type certificate_resource: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateResource + :raises: ~azure.core.exceptions.HttpResponseError """ - certificate_resource = models.CertificateResource(properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] + url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(certificate_resource, 'CertificateResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_resource, 'CertificateResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateResource', response) + deserialized = self._deserialize('CertificateResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore def delete( - self, resource_group_name, service_name, certificate_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete the certificate resource. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param certificate_name: The name of the certificate resource. :type certificate_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore def list( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CertificateResourceCollection"] """List all the certificates of one user. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CertificateResource - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateResourcePaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.CertificateResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CertificateResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_custom_domains_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_custom_domains_operations.py index aeec8066df5..9f096ceaa36 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_custom_domains_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_custom_domains_operations.py @@ -1,51 +1,63 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class CustomDomainsOperations(object): """CustomDomainsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2019_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2019-05-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-05-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, app_name, domain_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" """Get the custom domain of one lifecycle application. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -53,69 +65,68 @@ def get( :type app_name: str :param domain_name: The name of the custom domain resource. :type domain_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CustomDomainResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResource - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str') + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CustomDomainResource', response) + deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def create_or_update( - self, resource_group_name, service_name, app_name, domain_name, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" """Create or update custom domain of one lifecycle application. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -123,78 +134,74 @@ def create_or_update( :type app_name: str :param domain_name: The name of the custom domain resource. :type domain_name: str - :param properties: Properties of the custom domain resource. - :type properties: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CustomDomainResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResource - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError """ - domain_resource = models.CustomDomainResource(properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] + url = self.create_or_update.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str') + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CustomDomainResource', response) + deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def delete( - self, resource_group_name, service_name, app_name, domain_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete the custom domain of one lifecycle application. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -202,60 +209,65 @@ def delete( :type app_name: str :param domain_name: The name of the custom domain resource. :type domain_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str') + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def patch( - self, resource_group_name, service_name, app_name, domain_name, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" """Update custom domain of one lifecycle application. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -263,219 +275,209 @@ def patch( :type app_name: str :param domain_name: The name of the custom domain resource. :type domain_name: str - :param properties: Properties of the custom domain resource. - :type properties: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CustomDomainResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResource - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError """ - domain_resource = models.CustomDomainResource(properties=properties) + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.patch.metadata['url'] + url = self.patch.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str') + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CustomDomainResource', response) + deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} + patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def list( - self, resource_group_name, service_name, app_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CustomDomainResourceCollection"] """List the custom domains of one lifecycle application. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CustomDomainResource - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResourcePaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CustomDomainResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore def validate( - self, resource_group_name, service_name, app_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + validate_payload, # type: "_models.CustomDomainValidatePayload" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainValidateResult" """Check the resource name is valid as well as not in use. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param name: Name to be validated - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CustomDomainValidateResult or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainValidateResult - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param validate_payload: + :type validate_payload: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainValidatePayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.CustomDomainValidateResult + :raises: ~azure.core.exceptions.HttpResponseError """ - validate_payload = models.CustomDomainValidatePayload(name=name) + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.validate.metadata['url'] + url = self.validate.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CustomDomainValidateResult', response) + deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/validate'} + validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/validate'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_deployments_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_deployments_operations.py index b599cbbc1ce..17e1d62979b 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_deployments_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_deployments_operations.py @@ -1,53 +1,65 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class DeploymentsOperations(object): """DeploymentsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2019_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2019-05-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-05-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" """Get a Deployment and its properties. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -55,127 +67,133 @@ def get( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DeploymentResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, service_name, app_name, deployment_name, properties=None, sku=None, custom_headers=None, raw=False, **operation_config): - deployment_resource = models.DeploymentResource(properties=properties, sku=sku) + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, service_name, app_name, deployment_name, properties=None, sku=None, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentResource"] """Create a new Deployment or update an exiting Deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -183,61 +201,81 @@ def create_or_update( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param properties: Properties of the Deployment resource - :type properties: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource - :type sku: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Sku - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns DeploymentResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource]] - :raises: :class:`CloudError` + :param deployment_resource: Parameters for the create or update operation. + :type deployment_resource: ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - properties=properties, - sku=sku, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('DeploymentResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def delete( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Operation to delete a Deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -245,116 +283,127 @@ def delete( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} + if cls: + return cls(pipeline_response, None, {}) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def _update_initial( - self, resource_group_name, service_name, app_name, deployment_name, properties=None, sku=None, custom_headers=None, raw=False, **operation_config): - deployment_resource = models.DeploymentResource(properties=properties, sku=sku) + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, service_name, app_name, deployment_name, properties=None, sku=None, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentResource"] """Operation to update an exiting Deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -362,260 +411,296 @@ def update( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param properties: Properties of the Deployment resource - :type properties: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource - :type sku: ~azure.mgmt.appplatform.v2019_05_01_preview.models.Sku - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns DeploymentResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource]] - :raises: :class:`CloudError` + :param deployment_resource: Parameters for the update operation. + :type deployment_resource: ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - properties=properties, - sku=sku, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('DeploymentResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def list( - self, resource_group_name, service_name, app_name, version=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + version=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentResourceCollection"] """Handles requests to list all resources in an App. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed + :param version: Version of the deployments to be listed. :type version: list[str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DeploymentResource - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResourcePaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if version is not None: - query_parameters['version'] = self._serialize.query("version", version, '[str]', div=',') + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DeploymentResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore def list_cluster_all_deployments( - self, resource_group_name, service_name, version=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + version=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentResourceCollection"] """List deployments for a certain service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed + :param version: Version of the deployments to be listed. :type version: list[str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DeploymentResource - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResourcePaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_cluster_all_deployments.metadata['url'] + url = self.list_cluster_all_deployments.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if version is not None: - query_parameters['version'] = self._serialize.query("version", version, '[str]', div=',') + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DeploymentResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_cluster_all_deployments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} + return pipeline_response + return ItemPaged( + get_next, extract_data + ) + list_cluster_all_deployments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore def _start_initial( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL - url = self.start.metadata['url'] + url = self._start_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def start( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + + def begin_start( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Start the deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -623,88 +708,124 @@ def start( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore def _stop_initial( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL - url = self.stop.metadata['url'] + url = self._stop_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def stop( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + + def begin_stop( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Stop the deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -712,88 +833,124 @@ def stop( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore def _restart_initial( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL - url = self.restart.metadata['url'] + url = self._restart_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def restart( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + + def begin_restart( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Restart the deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -801,48 +958,75 @@ def restart( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore def get_log_file_url( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.LogFileUrlResponse"] """Get deployment log file URL. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -850,58 +1034,52 @@ def get_log_file_url( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: LogFileUrlResponse or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.LogFileUrlResponse - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogFileUrlResponse, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.LogFileUrlResponse or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LogFileUrlResponse"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL - url = self.get_log_file_url.metadata['url'] + url = self.get_log_file_url.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('LogFileUrlResponse', response) + deserialized = self._deserialize('LogFileUrlResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} + get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_operations.py index 8c2898d9179..ec98a8ef76a 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_operations.py @@ -1,103 +1,109 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class Operations(object): """Operations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2019_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2019-05-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-05-01-preview" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): - """Lists all of the available REST API operations of the - Microsoft.AppPlatform provider. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of OperationDetail - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationDetailPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.OperationDetail] - :raises: :class:`CloudError` + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AvailableOperations"] + """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailableOperations or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.AvailableOperations] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] - + url = self.list.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AvailableOperations', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.OperationDetailPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_runtime_versions_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_runtime_versions_operations.py index d3eaac0f5b0..d050faed238 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_runtime_versions_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_runtime_versions_operations.py @@ -1,93 +1,92 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class RuntimeVersionsOperations(object): """RuntimeVersionsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2019_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2019-05-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-05-01-preview" - - self.config = config + self._config = config def list_runtime_versions( - self, custom_headers=None, raw=False, **operation_config): - """Lists all of the available runtime versions supported by - Microsoft.AppPlatform provider. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AvailableRuntimeVersions or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.AvailableRuntimeVersions - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + self, + **kwargs # type: Any + ): + # type: (...) -> "_models.AvailableRuntimeVersions" + """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailableRuntimeVersions, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.AvailableRuntimeVersions + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableRuntimeVersions"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL - url = self.list_runtime_versions.metadata['url'] + url = self.list_runtime_versions.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AvailableRuntimeVersions', response) + deserialized = self._deserialize('AvailableRuntimeVersions', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_services_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_services_operations.py index b545584a020..8908a38ac8d 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_services_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_services_operations.py @@ -1,857 +1,928 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class ServicesOperations(object): """ServicesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2019_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2019-05-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-05-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" """Get a Service and its properties. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ServiceResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ServiceResource', response) + deserialized = self._deserialize('ServiceResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, service_name, resource, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(resource, 'ServiceResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ServiceResource', response) + deserialized = self._deserialize('ServiceResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('ServiceResource', response) + deserialized = self._deserialize('ServiceResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, service_name, resource, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ServiceResource"] """Create a new Service or update an exiting Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param resource: Parameters for the create or update operation - :type resource: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns ServiceResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource]] - :raises: :class:`CloudError` + :param resource: Parameters for the create or update operation. + :type resource: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('ServiceResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _delete_initial( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + if cls: + return cls(pipeline_response, None, {}) - def delete( - self, resource_group_name, service_name, custom_headers=None, raw=False, polling=True, **operation_config): + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _update_initial( - self, resource_group_name, service_name, resource, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(resource, 'ServiceResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ServiceResource', response) + deserialized = self._deserialize('ServiceResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('ServiceResource', response) + deserialized = self._deserialize('ServiceResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, service_name, resource, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ServiceResource"] """Operation to update an exiting Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param resource: Parameters for the update operation - :type resource: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns ServiceResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource]] - :raises: :class:`CloudError` + :param resource: Parameters for the update operation. + :type resource: ~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('ServiceResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def list_test_keys( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """List test keys for a Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TestKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.TestKeys or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL - url = self.list_test_keys.metadata['url'] + url = self.list_test_keys.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('TestKeys', response) + deserialized = self._deserialize('TestKeys', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore def regenerate_test_key( - self, resource_group_name, service_name, key_type, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + regenerate_test_key_request, # type: "_models.RegenerateTestKeyRequestPayload" + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """Regenerate a test key for a Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param key_type: Type of the test key. Possible values include: - 'Primary', 'Secondary' - :type key_type: str or - ~azure.mgmt.appplatform.v2019_05_01_preview.models.TestKeyType - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TestKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.TestKeys or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param regenerate_test_key_request: Parameters for the operation. + :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2019_05_01_preview.models.RegenerateTestKeyRequestPayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError """ - regenerate_test_key_request = models.RegenerateTestKeyRequestPayload(key_type=key_type) + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.regenerate_test_key.metadata['url'] + url = self.regenerate_test_key.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('TestKeys', response) + deserialized = self._deserialize('TestKeys', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore def disable_test_endpoint( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): - """ - - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """disable_test_endpoint. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL - url = self.disable_test_endpoint.metadata['url'] + url = self.disable_test_endpoint.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} + if cls: + return cls(pipeline_response, None, {}) - def enable_test_endpoint( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): - """ + disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + def enable_test_endpoint( + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" + """enable_test_endpoint. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TestKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.TestKeys or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + # Construct URL - url = self.enable_test_endpoint.metadata['url'] + url = self.enable_test_endpoint.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('TestKeys', response) + deserialized = self._deserialize('TestKeys', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore def check_name_availability( - self, location, type, name, custom_headers=None, raw=False, **operation_config): + self, + location, # type: str + availability_parameters, # type: "_models.NameAvailabilityParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.NameAvailability" """Checks that the resource name is valid and is not already in use. - :param location: the region + :param location: the region. :type location: str - :param type: Type of the resource to check name availability - :type type: str - :param name: Name to be checked - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: NameAvailability or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.NameAvailability or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param availability_parameters: Parameters supplied to the operation. + :type availability_parameters: ~azure.mgmt.appplatform.v2019_05_01_preview.models.NameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2019_05_01_preview.models.NameAvailability + :raises: ~azure.core.exceptions.HttpResponseError """ - availability_parameters = models.NameAvailabilityParameters(type=type, name=name) + cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailability"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.check_name_availability.metadata['url'] + url = self.check_name_availability.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('NameAvailability', response) + deserialized = self._deserialize('NameAvailability', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore def list_by_subscription( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServiceResourceList"] """Handles requests to list all resources in a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ServiceResource - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResourcePaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_subscription.metadata['url'] + url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ServiceResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ServiceResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore def list( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServiceResourceList"] """Handles requests to list all resources in a resource group. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ServiceResource - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResourcePaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ServiceResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ServiceResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_sku_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_sku_operations.py index a67afa4c3c2..092aacde06d 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_sku_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/operations/_sku_operations.py @@ -1,106 +1,113 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class SkuOperations(object): """SkuOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2019_05_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2019-05-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-05-01-preview" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ResourceSkuCollection"] + """list. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-05-01-preview" + accept = "application/json" - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceSku - :rtype: - ~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSkuPaged[~azure.mgmt.appplatform.v2019_05_01_preview.models.ResourceSku] - :raises: :class:`CloudError` - """ def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceSkuPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/py.typed b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/__init__.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/__init__.py index ee44eafce0f..d2ddf950056 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/__init__.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/__init__.py @@ -1,19 +1,19 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._configuration import AppPlatformManagementClientConfiguration from ._app_platform_management_client import AppPlatformManagementClient -__all__ = ['AppPlatformManagementClient', 'AppPlatformManagementClientConfiguration'] - -from .version import VERSION +from ._version import VERSION __version__ = VERSION +__all__ = ['AppPlatformManagementClient'] +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/_app_platform_management_client.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/_app_platform_management_client.py index ca5a03e81bd..bbb07fef27c 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/_app_platform_management_client.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/_app_platform_management_client.py @@ -1,16 +1,22 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import SDKClient -from msrest import Serializer, Deserializer +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import AppPlatformManagementClientConfiguration from .operations import ServicesOperations @@ -27,75 +33,107 @@ from . import models -class AppPlatformManagementClient(SDKClient): - """REST API for Azure Spring Cloud +class AppPlatformManagementClient(object): + """REST API for Azure Spring Cloud. - :ivar config: Configuration for client. - :vartype config: AppPlatformManagementClientConfiguration - - :ivar services: Services operations + :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2020_07_01.operations.ServicesOperations - :ivar config_servers: ConfigServers operations + :ivar config_servers: ConfigServersOperations operations :vartype config_servers: azure.mgmt.appplatform.v2020_07_01.operations.ConfigServersOperations - :ivar monitoring_settings: MonitoringSettings operations + :ivar monitoring_settings: MonitoringSettingsOperations operations :vartype monitoring_settings: azure.mgmt.appplatform.v2020_07_01.operations.MonitoringSettingsOperations - :ivar apps: Apps operations + :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2020_07_01.operations.AppsOperations - :ivar bindings: Bindings operations + :ivar bindings: BindingsOperations operations :vartype bindings: azure.mgmt.appplatform.v2020_07_01.operations.BindingsOperations - :ivar certificates: Certificates operations + :ivar certificates: CertificatesOperations operations :vartype certificates: azure.mgmt.appplatform.v2020_07_01.operations.CertificatesOperations - :ivar custom_domains: CustomDomains operations + :ivar custom_domains: CustomDomainsOperations operations :vartype custom_domains: azure.mgmt.appplatform.v2020_07_01.operations.CustomDomainsOperations - :ivar deployments: Deployments operations + :ivar deployments: DeploymentsOperations operations :vartype deployments: azure.mgmt.appplatform.v2020_07_01.operations.DeploymentsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2020_07_01.operations.Operations - :ivar runtime_versions: RuntimeVersions operations + :ivar runtime_versions: RuntimeVersionsOperations operations :vartype runtime_versions: azure.mgmt.appplatform.v2020_07_01.operations.RuntimeVersionsOperations - :ivar skus: Skus operations + :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2020_07_01.operations.SkusOperations - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Gets subscription ID which uniquely identify the - Microsoft Azure subscription. The subscription ID forms part of the URI - for every service call. + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = AppPlatformManagementClientConfiguration(credentials, subscription_id, base_url) - super(AppPlatformManagementClient, self).__init__(self.config.credentials, self.config) + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2020-07-01' self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.services = ServicesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.config_servers = ConfigServersOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.monitoring_settings = MonitoringSettingsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.apps = AppsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.bindings = BindingsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.certificates = CertificatesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.custom_domains = CustomDomainsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.deployments = DeploymentsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.operations = Operations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.runtime_versions = RuntimeVersionsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.skus = SkusOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> AppPlatformManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/_configuration.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/_configuration.py index 5a7f3752f05..2e027c53459 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/_configuration.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/_configuration.py @@ -1,50 +1,71 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrestazure import AzureConfiguration -from .version import VERSION +from typing import TYPE_CHECKING +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class AppPlatformManagementClientConfiguration(Configuration): + """Configuration for AppPlatformManagementClient. -class AppPlatformManagementClientConfiguration(AzureConfiguration): - """Configuration for AppPlatformManagementClient Note that all parameters used to create this instance are saved as instance attributes. - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Gets subscription ID which uniquely identify the - Microsoft Azure subscription. The subscription ID forms part of the URI - for every service call. + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - if not base_url: - base_url = 'https://management.azure.com' - - super(AppPlatformManagementClientConfiguration, self).__init__(base_url) - - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) - self.add_user_agent('azure-mgmt-appplatform/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials + self.credential = credential self.subscription_id = subscription_id + self.api_version = "2020-07-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/_metadata.json b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/_metadata.json new file mode 100644 index 00000000000..1f417c7fc3f --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/_metadata.json @@ -0,0 +1,113 @@ +{ + "chosen_version": "2020-07-01", + "total_api_version_list": ["2020-07-01"], + "client": { + "name": "AppPlatformManagementClient", + "filename": "_app_platform_management_client", + "description": "REST API for Azure Spring Cloud.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "services": "ServicesOperations", + "config_servers": "ConfigServersOperations", + "monitoring_settings": "MonitoringSettingsOperations", + "apps": "AppsOperations", + "bindings": "BindingsOperations", + "certificates": "CertificatesOperations", + "custom_domains": "CustomDomainsOperations", + "deployments": "DeploymentsOperations", + "operations": "Operations", + "runtime_versions": "RuntimeVersionsOperations", + "skus": "SkusOperations" + } +} \ No newline at end of file diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/version.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/_version.py similarity index 82% rename from src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/version.py rename to src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/_version.py index 91d3d3040ed..92453d8691d 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2019_05_01_preview/version.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/_version.py @@ -1,13 +1,9 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2019-05-01-preview" - +VERSION = "6.1.0" diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/__init__.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/__init__.py new file mode 100644 index 00000000000..39f10548873 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/__init__.py @@ -0,0 +1,10 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._app_platform_management_client import AppPlatformManagementClient +__all__ = ['AppPlatformManagementClient'] diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/_app_platform_management_client.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/_app_platform_management_client.py new file mode 100644 index 00000000000..497d1a0e0b0 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/_app_platform_management_client.py @@ -0,0 +1,132 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import ServicesOperations +from .operations import ConfigServersOperations +from .operations import MonitoringSettingsOperations +from .operations import AppsOperations +from .operations import BindingsOperations +from .operations import CertificatesOperations +from .operations import CustomDomainsOperations +from .operations import DeploymentsOperations +from .operations import Operations +from .operations import RuntimeVersionsOperations +from .operations import SkusOperations +from .. import models + + +class AppPlatformManagementClient(object): + """REST API for Azure Spring Cloud. + + :ivar services: ServicesOperations operations + :vartype services: azure.mgmt.appplatform.v2020_07_01.aio.operations.ServicesOperations + :ivar config_servers: ConfigServersOperations operations + :vartype config_servers: azure.mgmt.appplatform.v2020_07_01.aio.operations.ConfigServersOperations + :ivar monitoring_settings: MonitoringSettingsOperations operations + :vartype monitoring_settings: azure.mgmt.appplatform.v2020_07_01.aio.operations.MonitoringSettingsOperations + :ivar apps: AppsOperations operations + :vartype apps: azure.mgmt.appplatform.v2020_07_01.aio.operations.AppsOperations + :ivar bindings: BindingsOperations operations + :vartype bindings: azure.mgmt.appplatform.v2020_07_01.aio.operations.BindingsOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.appplatform.v2020_07_01.aio.operations.CertificatesOperations + :ivar custom_domains: CustomDomainsOperations operations + :vartype custom_domains: azure.mgmt.appplatform.v2020_07_01.aio.operations.CustomDomainsOperations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: azure.mgmt.appplatform.v2020_07_01.aio.operations.DeploymentsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.appplatform.v2020_07_01.aio.operations.Operations + :ivar runtime_versions: RuntimeVersionsOperations operations + :vartype runtime_versions: azure.mgmt.appplatform.v2020_07_01.aio.operations.RuntimeVersionsOperations + :ivar skus: SkusOperations operations + :vartype skus: azure.mgmt.appplatform.v2020_07_01.aio.operations.SkusOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.services = ServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "AppPlatformManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/_configuration.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/_configuration.py new file mode 100644 index 00000000000..101a93f7aef --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/_configuration.py @@ -0,0 +1,67 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class AppPlatformManagementClientConfiguration(Configuration): + """Configuration for AppPlatformManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-07-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/__init__.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/__init__.py new file mode 100644 index 00000000000..aa6fe5cd0cf --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/__init__.py @@ -0,0 +1,33 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._services_operations import ServicesOperations +from ._config_servers_operations import ConfigServersOperations +from ._monitoring_settings_operations import MonitoringSettingsOperations +from ._apps_operations import AppsOperations +from ._bindings_operations import BindingsOperations +from ._certificates_operations import CertificatesOperations +from ._custom_domains_operations import CustomDomainsOperations +from ._deployments_operations import DeploymentsOperations +from ._operations import Operations +from ._runtime_versions_operations import RuntimeVersionsOperations +from ._skus_operations import SkusOperations + +__all__ = [ + 'ServicesOperations', + 'ConfigServersOperations', + 'MonitoringSettingsOperations', + 'AppsOperations', + 'BindingsOperations', + 'CertificatesOperations', + 'CustomDomainsOperations', + 'DeploymentsOperations', + 'Operations', + 'RuntimeVersionsOperations', + 'SkusOperations', +] diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_apps_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_apps_operations.py new file mode 100644 index 00000000000..96a7b447e45 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_apps_operations.py @@ -0,0 +1,712 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AppsOperations: + """AppsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_07_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + sync_status: Optional[str] = None, + **kwargs: Any + ) -> "_models.AppResource": + """Get an App and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param sync_status: Indicates whether sync status. + :type sync_status: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if sync_status is not None: + query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.AppResource"]: + """Create a new App or update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param app_resource: Parameters for the create or update operation. + :type app_resource: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.AppResource"]: + """Operation to update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param app_resource: Parameters for the update operation. + :type app_resource: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.AppResourceCollection"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AppResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AppResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + + async def get_resource_upload_url( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> "_models.ResourceUploadDefinition": + """Get an resource upload URL for an App, which may be artifacts or source archive. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceUploadDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.ResourceUploadDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get_resource_upload_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore + + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: "_models.CustomDomainValidatePayload", + **kwargs: Any + ) -> "_models.CustomDomainValidateResult": + """Check the resource name is valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param validate_payload: Custom domain payload to be validated. + :type validate_payload: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainValidatePayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainValidateResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.validate_domain.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_bindings_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_bindings_operations.py new file mode 100644 index 00000000000..732cfe5da5c --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_bindings_operations.py @@ -0,0 +1,602 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BindingsOperations: + """BindingsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_07_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> "_models.BindingResource": + """Get a Binding and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BindingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.BindingResource"]: + """Create a new Binding or update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :param binding_resource: Parameters for the create or update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete a Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.BindingResource"]: + """Operation to update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :param binding_resource: Parameters for the update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BindingResourceCollection"]: + """Handles requests to list all resources in an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_certificates_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_certificates_operations.py new file mode 100644 index 00000000000..6407846b0e5 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_certificates_operations.py @@ -0,0 +1,437 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CertificatesOperations: + """CertificatesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_07_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> "_models.CertificateResource": + """Get the certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> "_models.CertificateResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_resource, 'CertificateResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.CertificateResource"]: + """Create or update certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :param certificate_resource: Parameters for the create or update operation. + :type certificate_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + certificate_resource=certificate_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.CertificateResourceCollection"]: + """List all the certificates of one user. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_config_servers_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_config_servers_operations.py new file mode 100644 index 00000000000..7e48efe0d06 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_config_servers_operations.py @@ -0,0 +1,489 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConfigServersOperations: + """ConfigServersOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_07_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ConfigServerResource": + """Get the config server and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigServerResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + async def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigServerResource"]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param config_server_resource: Parameters for the update operation. + :type config_server_resource: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + async def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigServerResource"]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param config_server_resource: Parameters for the update operation. + :type config_server_resource: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + async def _validate_initial( + self, + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> "_models.ConfigServerSettingsValidateResult": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigServerSettingsValidateResult"]: + """Check if the config server settings are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param config_server_settings: Config server settings to be validated. + :type config_server_settings: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_settings=config_server_settings, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_custom_domains_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_custom_domains_operations.py new file mode 100644 index 00000000000..46bb8daccbc --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_custom_domains_operations.py @@ -0,0 +1,602 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CustomDomainsOperations: + """CustomDomainsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_07_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.CustomDomainResource": + """Get the custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.CustomDomainResource"]: + """Create or update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.CustomDomainResource"]: + """Update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.CustomDomainResourceCollection"]: + """List the custom domains of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_deployments_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_deployments_operations.py new file mode 100644 index 00000000000..36566cc712b --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_deployments_operations.py @@ -0,0 +1,1125 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DeploymentsOperations: + """DeploymentsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_07_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> "_models.DeploymentResource": + """Get a Deployment and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.DeploymentResource"]: + """Create a new Deployment or update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param deployment_resource: Parameters for the create or update operation. + :type deployment_resource: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete a Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.DeploymentResource"]: + """Operation to update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param deployment_resource: Parameters for the update operation. + :type deployment_resource: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DeploymentResourceCollection"]: + """Handles requests to list all resources in an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param version: Version of the deployments to be listed. + :type version: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore + + def list_for_cluster( + self, + resource_group_name: str, + service_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DeploymentResourceCollection"]: + """List deployments for a certain service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param version: Version of the deployments to be listed. + :type version: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_for_cluster.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore + + async def _start_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + + async def begin_start( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Start the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + + async def _stop_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + + async def begin_stop( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Stop the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._stop_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + + async def _restart_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + + async def begin_restart( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restart the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + + async def get_log_file_url( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> Optional["_models.LogFileUrlResponse"]: + """Get deployment log file URL. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogFileUrlResponse, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.LogFileUrlResponse or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LogFileUrlResponse"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get_log_file_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LogFileUrlResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_monitoring_settings_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_monitoring_settings_operations.py new file mode 100644 index 00000000000..4dc1442371f --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_monitoring_settings_operations.py @@ -0,0 +1,360 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MonitoringSettingsOperations: + """MonitoringSettingsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_07_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.MonitoringSettingResource": + """Get the Monitoring Setting and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoringSettingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + async def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.MonitoringSettingResource"]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + async def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.MonitoringSettingResource"]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_operations.py new file mode 100644 index 00000000000..d114e98657e --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_operations.py @@ -0,0 +1,104 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_07_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.AvailableOperations"]: + """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailableOperations or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AvailableOperations] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AvailableOperations', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_runtime_versions_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_runtime_versions_operations.py new file mode 100644 index 00000000000..1d3ccd3dbfe --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_runtime_versions_operations.py @@ -0,0 +1,87 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RuntimeVersionsOperations: + """RuntimeVersionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_07_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list_runtime_versions( + self, + **kwargs: Any + ) -> "_models.AvailableRuntimeVersions": + """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailableRuntimeVersions, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.AvailableRuntimeVersions + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableRuntimeVersions"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.list_runtime_versions.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AvailableRuntimeVersions', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_services_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_services_operations.py new file mode 100644 index 00000000000..092b2ee09fc --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_services_operations.py @@ -0,0 +1,913 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ServicesOperations: + """ServicesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_07_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ServiceResource": + """Get a Service and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ServiceResource"]: + """Create a new Service or update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param resource: Parameters for the create or update operation. + :type resource: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ServiceResource"]: + """Operation to update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param resource: Parameters for the update operation. + :type resource: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def list_test_keys( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": + """List test keys for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.list_test_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + + async def regenerate_test_key( + self, + resource_group_name: str, + service_name: str, + regenerate_test_key_request: "_models.RegenerateTestKeyRequestPayload", + **kwargs: Any + ) -> "_models.TestKeys": + """Regenerate a test key for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param regenerate_test_key_request: Parameters for the operation. + :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2020_07_01.models.RegenerateTestKeyRequestPayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_test_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore + + async def disable_test_endpoint( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: + """Disable test endpoint functionality for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.disable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + + async def enable_test_endpoint( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": + """Enable test endpoint functionality for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.enable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore + + async def check_name_availability( + self, + location: str, + availability_parameters: "_models.NameAvailabilityParameters", + **kwargs: Any + ) -> "_models.NameAvailability": + """Checks that the resource name is valid and is not already in use. + + :param location: the region. + :type location: str + :param availability_parameters: Parameters supplied to the operation. + :type availability_parameters: ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailability + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailability"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NameAvailability', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ServiceResourceList"]: + """Handles requests to list all resources in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ServiceResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + + def list( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ServiceResourceList"]: + """Handles requests to list all resources in a resource group. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ServiceResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_skus_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_skus_operations.py new file mode 100644 index 00000000000..c7de60e3a3f --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/aio/operations/_skus_operations.py @@ -0,0 +1,108 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SkusOperations: + """SkusOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_07_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ResourceSkuCollection"]: + """Lists all of the available skus of the Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/models/__init__.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/models/__init__.py index 938b11a517a..5659fe3dbc3 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/models/__init__.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/models/__init__.py @@ -1,22 +1,24 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- try: from ._models_py3 import AppResource + from ._models_py3 import AppResourceCollection from ._models_py3 import AppResourceProperties + from ._models_py3 import AvailableOperations from ._models_py3 import AvailableRuntimeVersions from ._models_py3 import BindingResource + from ._models_py3 import BindingResourceCollection from ._models_py3 import BindingResourceProperties from ._models_py3 import CertificateProperties from ._models_py3 import CertificateResource + from ._models_py3 import CertificateResourceCollection + from ._models_py3 import CloudErrorBody from ._models_py3 import ClusterResourceProperties from ._models_py3 import ConfigServerGitProperty from ._models_py3 import ConfigServerProperties @@ -26,10 +28,12 @@ from ._models_py3 import ConfigServerSettingsValidateResult from ._models_py3 import CustomDomainProperties from ._models_py3 import CustomDomainResource + from ._models_py3 import CustomDomainResourceCollection from ._models_py3 import CustomDomainValidatePayload from ._models_py3 import CustomDomainValidateResult from ._models_py3 import DeploymentInstance from ._models_py3 import DeploymentResource + from ._models_py3 import DeploymentResourceCollection from ._models_py3 import DeploymentResourceProperties from ._models_py3 import DeploymentSettings from ._models_py3 import Error @@ -55,12 +59,14 @@ from ._models_py3 import Resource from ._models_py3 import ResourceSku from ._models_py3 import ResourceSkuCapabilities + from ._models_py3 import ResourceSkuCollection from ._models_py3 import ResourceSkuLocationInfo from ._models_py3 import ResourceSkuRestrictionInfo from ._models_py3 import ResourceSkuRestrictions from ._models_py3 import ResourceSkuZoneDetails from ._models_py3 import ResourceUploadDefinition from ._models_py3 import ServiceResource + from ._models_py3 import ServiceResourceList from ._models_py3 import ServiceSpecification from ._models_py3 import Sku from ._models_py3 import SkuCapacity @@ -70,100 +76,107 @@ from ._models_py3 import TrackedResource from ._models_py3 import UserSourceInfo except (SyntaxError, ImportError): - from ._models import AppResource - from ._models import AppResourceProperties - from ._models import AvailableRuntimeVersions - from ._models import BindingResource - from ._models import BindingResourceProperties - from ._models import CertificateProperties - from ._models import CertificateResource - from ._models import ClusterResourceProperties - from ._models import ConfigServerGitProperty - from ._models import ConfigServerProperties - from ._models import ConfigServerResource - from ._models import ConfigServerSettings - from ._models import ConfigServerSettingsErrorRecord - from ._models import ConfigServerSettingsValidateResult - from ._models import CustomDomainProperties - from ._models import CustomDomainResource - from ._models import CustomDomainValidatePayload - from ._models import CustomDomainValidateResult - from ._models import DeploymentInstance - from ._models import DeploymentResource - from ._models import DeploymentResourceProperties - from ._models import DeploymentSettings - from ._models import Error - from ._models import GitPatternRepository - from ._models import LogFileUrlResponse - from ._models import LogSpecification - from ._models import ManagedIdentityProperties - from ._models import MetricDimension - from ._models import MetricSpecification - from ._models import MonitoringSettingProperties - from ._models import MonitoringSettingResource - from ._models import NameAvailability - from ._models import NameAvailabilityParameters - from ._models import NetworkProfile - from ._models import NetworkProfileOutboundIPs - from ._models import OperationDetail - from ._models import OperationDisplay - from ._models import OperationProperties - from ._models import PersistentDisk - from ._models import ProxyResource - from ._models import RegenerateTestKeyRequestPayload - from ._models import RequiredTraffic - from ._models import Resource - from ._models import ResourceSku - from ._models import ResourceSkuCapabilities - from ._models import ResourceSkuLocationInfo - from ._models import ResourceSkuRestrictionInfo - from ._models import ResourceSkuRestrictions - from ._models import ResourceSkuZoneDetails - from ._models import ResourceUploadDefinition - from ._models import ServiceResource - from ._models import ServiceSpecification - from ._models import Sku - from ._models import SkuCapacity - from ._models import SupportedRuntimeVersion - from ._models import TemporaryDisk - from ._models import TestKeys - from ._models import TrackedResource - from ._models import UserSourceInfo -from ._paged_models import AppResourcePaged -from ._paged_models import BindingResourcePaged -from ._paged_models import CertificateResourcePaged -from ._paged_models import CustomDomainResourcePaged -from ._paged_models import DeploymentResourcePaged -from ._paged_models import OperationDetailPaged -from ._paged_models import ResourceSkuPaged -from ._paged_models import ServiceResourcePaged + from ._models import AppResource # type: ignore + from ._models import AppResourceCollection # type: ignore + from ._models import AppResourceProperties # type: ignore + from ._models import AvailableOperations # type: ignore + from ._models import AvailableRuntimeVersions # type: ignore + from ._models import BindingResource # type: ignore + from ._models import BindingResourceCollection # type: ignore + from ._models import BindingResourceProperties # type: ignore + from ._models import CertificateProperties # type: ignore + from ._models import CertificateResource # type: ignore + from ._models import CertificateResourceCollection # type: ignore + from ._models import CloudErrorBody # type: ignore + from ._models import ClusterResourceProperties # type: ignore + from ._models import ConfigServerGitProperty # type: ignore + from ._models import ConfigServerProperties # type: ignore + from ._models import ConfigServerResource # type: ignore + from ._models import ConfigServerSettings # type: ignore + from ._models import ConfigServerSettingsErrorRecord # type: ignore + from ._models import ConfigServerSettingsValidateResult # type: ignore + from ._models import CustomDomainProperties # type: ignore + from ._models import CustomDomainResource # type: ignore + from ._models import CustomDomainResourceCollection # type: ignore + from ._models import CustomDomainValidatePayload # type: ignore + from ._models import CustomDomainValidateResult # type: ignore + from ._models import DeploymentInstance # type: ignore + from ._models import DeploymentResource # type: ignore + from ._models import DeploymentResourceCollection # type: ignore + from ._models import DeploymentResourceProperties # type: ignore + from ._models import DeploymentSettings # type: ignore + from ._models import Error # type: ignore + from ._models import GitPatternRepository # type: ignore + from ._models import LogFileUrlResponse # type: ignore + from ._models import LogSpecification # type: ignore + from ._models import ManagedIdentityProperties # type: ignore + from ._models import MetricDimension # type: ignore + from ._models import MetricSpecification # type: ignore + from ._models import MonitoringSettingProperties # type: ignore + from ._models import MonitoringSettingResource # type: ignore + from ._models import NameAvailability # type: ignore + from ._models import NameAvailabilityParameters # type: ignore + from ._models import NetworkProfile # type: ignore + from ._models import NetworkProfileOutboundIPs # type: ignore + from ._models import OperationDetail # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationProperties # type: ignore + from ._models import PersistentDisk # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import RegenerateTestKeyRequestPayload # type: ignore + from ._models import RequiredTraffic # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceSku # type: ignore + from ._models import ResourceSkuCapabilities # type: ignore + from ._models import ResourceSkuCollection # type: ignore + from ._models import ResourceSkuLocationInfo # type: ignore + from ._models import ResourceSkuRestrictionInfo # type: ignore + from ._models import ResourceSkuRestrictions # type: ignore + from ._models import ResourceSkuZoneDetails # type: ignore + from ._models import ResourceUploadDefinition # type: ignore + from ._models import ServiceResource # type: ignore + from ._models import ServiceResourceList # type: ignore + from ._models import ServiceSpecification # type: ignore + from ._models import Sku # type: ignore + from ._models import SkuCapacity # type: ignore + from ._models import SupportedRuntimeVersion # type: ignore + from ._models import TemporaryDisk # type: ignore + from ._models import TestKeys # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import UserSourceInfo # type: ignore + from ._app_platform_management_client_enums import ( - ProvisioningState, - TrafficDirection, - ManagedIdentityType, - ConfigServerState, - MonitoringSettingState, - TestKeyType, AppResourceProvisioningState, - UserSourceType, - RuntimeVersion, + ConfigServerState, DeploymentResourceProvisioningState, DeploymentResourceStatus, - SkuScaleType, - ResourceSkuRestrictionsType, + ManagedIdentityType, + MonitoringSettingState, + ProvisioningState, ResourceSkuRestrictionsReasonCode, - SupportedRuntimeValue, + ResourceSkuRestrictionsType, + RuntimeVersion, + SkuScaleType, SupportedRuntimePlatform, + SupportedRuntimeValue, + TestKeyType, + TrafficDirection, + UserSourceType, ) __all__ = [ 'AppResource', + 'AppResourceCollection', 'AppResourceProperties', + 'AvailableOperations', 'AvailableRuntimeVersions', 'BindingResource', + 'BindingResourceCollection', 'BindingResourceProperties', 'CertificateProperties', 'CertificateResource', + 'CertificateResourceCollection', + 'CloudErrorBody', 'ClusterResourceProperties', 'ConfigServerGitProperty', 'ConfigServerProperties', @@ -173,10 +186,12 @@ 'ConfigServerSettingsValidateResult', 'CustomDomainProperties', 'CustomDomainResource', + 'CustomDomainResourceCollection', 'CustomDomainValidatePayload', 'CustomDomainValidateResult', 'DeploymentInstance', 'DeploymentResource', + 'DeploymentResourceCollection', 'DeploymentResourceProperties', 'DeploymentSettings', 'Error', @@ -202,12 +217,14 @@ 'Resource', 'ResourceSku', 'ResourceSkuCapabilities', + 'ResourceSkuCollection', 'ResourceSkuLocationInfo', 'ResourceSkuRestrictionInfo', 'ResourceSkuRestrictions', 'ResourceSkuZoneDetails', 'ResourceUploadDefinition', 'ServiceResource', + 'ServiceResourceList', 'ServiceSpecification', 'Sku', 'SkuCapacity', @@ -216,28 +233,20 @@ 'TestKeys', 'TrackedResource', 'UserSourceInfo', - 'ServiceResourcePaged', - 'AppResourcePaged', - 'BindingResourcePaged', - 'CertificateResourcePaged', - 'CustomDomainResourcePaged', - 'DeploymentResourcePaged', - 'OperationDetailPaged', - 'ResourceSkuPaged', - 'ProvisioningState', - 'TrafficDirection', - 'ManagedIdentityType', - 'ConfigServerState', - 'MonitoringSettingState', - 'TestKeyType', 'AppResourceProvisioningState', - 'UserSourceType', - 'RuntimeVersion', + 'ConfigServerState', 'DeploymentResourceProvisioningState', 'DeploymentResourceStatus', - 'SkuScaleType', - 'ResourceSkuRestrictionsType', + 'ManagedIdentityType', + 'MonitoringSettingState', + 'ProvisioningState', 'ResourceSkuRestrictionsReasonCode', - 'SupportedRuntimeValue', + 'ResourceSkuRestrictionsType', + 'RuntimeVersion', + 'SkuScaleType', 'SupportedRuntimePlatform', + 'SupportedRuntimeValue', + 'TestKeyType', + 'TrafficDirection', + 'UserSourceType', ] diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/models/_app_platform_management_client_enums.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/models/_app_platform_management_client_enums.py index 5ae8632fbad..5ac8dede62c 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/models/_app_platform_management_client_enums.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/models/_app_platform_management_client_enums.py @@ -1,135 +1,167 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum - - -class ProvisioningState(str, Enum): - - creating = "Creating" - updating = "Updating" - deleting = "Deleting" - deleted = "Deleted" - succeeded = "Succeeded" - failed = "Failed" - moving = "Moving" - moved = "Moved" - move_failed = "MoveFailed" - - -class TrafficDirection(str, Enum): - - inbound = "Inbound" - outbound = "Outbound" - - -class ManagedIdentityType(str, Enum): - - none = "None" - system_assigned = "SystemAssigned" - user_assigned = "UserAssigned" - system_assigned_user_assigned = "SystemAssigned,UserAssigned" - - -class ConfigServerState(str, Enum): - - not_available = "NotAvailable" - deleted = "Deleted" - failed = "Failed" - succeeded = "Succeeded" - updating = "Updating" - - -class MonitoringSettingState(str, Enum): - - not_available = "NotAvailable" - failed = "Failed" - succeeded = "Succeeded" - updating = "Updating" - - -class TestKeyType(str, Enum): - - primary = "Primary" - secondary = "Secondary" - - -class AppResourceProvisioningState(str, Enum): - - succeeded = "Succeeded" - failed = "Failed" - creating = "Creating" - updating = "Updating" - - -class UserSourceType(str, Enum): - - jar = "Jar" - net_core_zip = "NetCoreZip" - source = "Source" - - -class RuntimeVersion(str, Enum): - - java_8 = "Java_8" - java_11 = "Java_11" - net_core_31 = "NetCore_31" - - -class DeploymentResourceProvisioningState(str, Enum): - - creating = "Creating" - updating = "Updating" - succeeded = "Succeeded" - failed = "Failed" - - -class DeploymentResourceStatus(str, Enum): - - unknown = "Unknown" - stopped = "Stopped" - running = "Running" - failed = "Failed" - allocating = "Allocating" - upgrading = "Upgrading" - compiling = "Compiling" - - -class SkuScaleType(str, Enum): - - none = "None" - manual = "Manual" - automatic = "Automatic" - - -class ResourceSkuRestrictionsType(str, Enum): - - location = "Location" - zone = "Zone" - - -class ResourceSkuRestrictionsReasonCode(str, Enum): - - quota_id = "QuotaId" - not_available_for_subscription = "NotAvailableForSubscription" - - -class SupportedRuntimeValue(str, Enum): - - java_8 = "Java_8" - java_11 = "Java_11" - net_core_31 = "NetCore_31" - - -class SupportedRuntimePlatform(str, Enum): - - java = "Java" - net_core = ".NET Core" +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the App + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CREATING = "Creating" + UPDATING = "Updating" + +class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State of the config server. + """ + + NOT_AVAILABLE = "NotAvailable" + DELETED = "Deleted" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + +class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Deployment + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + +class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of the Deployment + """ + + UNKNOWN = "Unknown" + STOPPED = "Stopped" + RUNNING = "Running" + FAILED = "Failed" + ALLOCATING = "Allocating" + UPGRADING = "Upgrading" + COMPILING = "Compiling" + +class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the managed identity + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + +class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State of the Monitoring Setting. + """ + + NOT_AVAILABLE = "NotAvailable" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Service + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + DELETED = "Deleted" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + MOVING = "Moving" + MOVED = "Moved" + MOVE_FAILED = "MoveFailed" + +class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription' + """ + + QUOTA_ID = "QuotaId" + NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" + +class ResourceSkuRestrictionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Gets the type of restrictions. Possible values include: 'Location', 'Zone' + """ + + LOCATION = "Location" + ZONE = "Zone" + +class RuntimeVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Runtime version + """ + + JAVA8 = "Java_8" + JAVA11 = "Java_11" + NET_CORE31 = "NetCore_31" + +class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Gets or sets the type of the scale. + """ + + NONE = "None" + MANUAL = "Manual" + AUTOMATIC = "Automatic" + +class SupportedRuntimePlatform(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The platform of this runtime version (possible values: "Java" or ".NET"). + """ + + JAVA = "Java" + _NET_CORE = ".NET Core" + +class SupportedRuntimeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The raw value which could be passed to deployment CRUD operations. + """ + + JAVA8 = "Java_8" + JAVA11 = "Java_11" + NET_CORE31 = "NetCore_31" + +class TestKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the test key + """ + + PRIMARY = "Primary" + SECONDARY = "Secondary" + +class TrafficDirection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The direction of required traffic + """ + + INBOUND = "Inbound" + OUTBOUND = "Outbound" + +class UserSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the source uploaded + """ + + JAR = "Jar" + NET_CORE_ZIP = "NetCoreZip" + SOURCE = "Source" diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/models/_models.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/models/_models.py index 38e3860602e..10db354c88f 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/models/_models.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/models/_models.py @@ -1,23 +1,18 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +import msrest.serialization -class Resource(Model): +class Resource(msrest.serialization.Model): """The core properties of ARM resources. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -39,7 +34,10 @@ class Resource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -47,11 +45,9 @@ def __init__(self, **kwargs): class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have - everything other than required location and tags. + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -73,15 +69,17 @@ class ProxyResource(Resource): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ProxyResource, self).__init__(**kwargs) class AppResource(ProxyResource): """App resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -89,14 +87,11 @@ class AppResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the App resource - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.AppResourceProperties - :param identity: The Managed Identity type of the app resource - :type identity: - ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityProperties - :param location: The GEO location of the application, always the same with - its parent resource + :param properties: Properties of the App resource. + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.AppResourceProperties + :param identity: The Managed Identity type of the app resource. + :type identity: ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityProperties + :param location: The GEO location of the application, always the same with its parent resource. :type location: str """ @@ -115,41 +110,65 @@ class AppResource(ProxyResource): 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.identity = kwargs.get('identity', None) self.location = kwargs.get('location', None) -class AppResourceProperties(Model): +class AppResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :param value: Collection of App resources. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AppResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class AppResourceProperties(msrest.serialization.Model): """App resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param public: Indicates whether the App exposes public endpoint + :param public: Indicates whether the App exposes public endpoint. :type public: bool - :ivar url: URL of the App + :ivar url: URL of the App. :vartype url: str - :ivar provisioning_state: Provisioning state of the App. Possible values - include: 'Succeeded', 'Failed', 'Creating', 'Updating' + :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", + "Failed", "Creating", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_07_01.models.AppResourceProvisioningState - :param active_deployment_name: Name of the active deployment of the App + :param active_deployment_name: Name of the active deployment of the App. :type active_deployment_name: str :param fqdn: Fully qualified dns Name. :type fqdn: str :param https_only: Indicate if only https is allowed. :type https_only: bool - :ivar created_time: Date time when the resource is created - :vartype created_time: datetime - :param temporary_disk: Temporary disk settings - :type temporary_disk: - ~azure.mgmt.appplatform.v2020_07_01.models.TemporaryDisk - :param persistent_disk: Persistent disk settings - :type persistent_disk: - ~azure.mgmt.appplatform.v2020_07_01.models.PersistentDisk + :ivar created_time: Date time when the resource is created. + :vartype created_time: ~datetime.datetime + :param temporary_disk: Temporary disk settings. + :type temporary_disk: ~azure.mgmt.appplatform.v2020_07_01.models.TemporaryDisk + :param persistent_disk: Persistent disk settings. + :type persistent_disk: ~azure.mgmt.appplatform.v2020_07_01.models.PersistentDisk """ _validation = { @@ -170,28 +189,53 @@ class AppResourceProperties(Model): 'persistent_disk': {'key': 'persistentDisk', 'type': 'PersistentDisk'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppResourceProperties, self).__init__(**kwargs) self.public = kwargs.get('public', None) self.url = None self.provisioning_state = None self.active_deployment_name = kwargs.get('active_deployment_name', None) self.fqdn = kwargs.get('fqdn', None) - self.https_only = kwargs.get('https_only', None) + self.https_only = kwargs.get('https_only', False) self.created_time = None self.temporary_disk = kwargs.get('temporary_disk', None) self.persistent_disk = kwargs.get('persistent_disk', None) -class AvailableRuntimeVersions(Model): +class AvailableOperations(msrest.serialization.Model): + """Available operations of the service. + + :param value: Collection of available operation details. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.OperationDetail] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationDetail]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AvailableOperations, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class AvailableRuntimeVersions(msrest.serialization.Model): """AvailableRuntimeVersions. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar value: A list of all supported runtime versions. - :vartype value: - list[~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimeVersion] + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimeVersion] """ _validation = { @@ -202,7 +246,10 @@ class AvailableRuntimeVersions(Model): 'value': {'key': 'value', 'type': '[SupportedRuntimeVersion]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -210,8 +257,7 @@ def __init__(self, **kwargs): class BindingResource(ProxyResource): """Binding resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -219,9 +265,8 @@ class BindingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Binding resource - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceProperties + :param properties: Properties of the Binding resource. + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceProperties """ _validation = { @@ -237,34 +282,59 @@ class BindingResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'BindingResourceProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BindingResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class BindingResourceProperties(Model): +class BindingResourceCollection(msrest.serialization.Model): + """Object that includes an array of Binding resources and a possible link for next set. + + :param value: Collection of Binding resources. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BindingResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BindingResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class BindingResourceProperties(msrest.serialization.Model): """Binding resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar resource_name: The name of the bound resource + :ivar resource_name: The name of the bound resource. :vartype resource_name: str - :ivar resource_type: The standard Azure resource type of the bound - resource + :ivar resource_type: The standard Azure resource type of the bound resource. :vartype resource_type: str - :param resource_id: The Azure resource id of the bound resource + :param resource_id: The Azure resource id of the bound resource. :type resource_id: str - :param key: The key of the bound resource + :param key: The key of the bound resource. :type key: str - :param binding_parameters: Binding parameters of the Binding resource - :type binding_parameters: dict[str, object] - :ivar generated_properties: The generated Spring Boot property file for - this binding. The secret will be deducted. + :param binding_parameters: Binding parameters of the Binding resource. + :type binding_parameters: dict[str, any] + :ivar generated_properties: The generated Spring Boot property file for this binding. The + secret will be deducted. :vartype generated_properties: str - :ivar created_at: Creation time of the Binding resource + :ivar created_at: Creation time of the Binding resource. :vartype created_at: str - :ivar updated_at: Update time of the Binding resource + :ivar updated_at: Update time of the Binding resource. :vartype updated_at: str """ @@ -287,7 +357,10 @@ class BindingResourceProperties(Model): 'updated_at': {'key': 'updatedAt', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -299,11 +372,10 @@ def __init__(self, **kwargs): self.updated_at = None -class CertificateProperties(Model): +class CertificateProperties(msrest.serialization.Model): """Certificate resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -354,11 +426,14 @@ class CertificateProperties(Model): 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateProperties, self).__init__(**kwargs) self.thumbprint = None - self.vault_uri = kwargs.get('vault_uri', None) - self.key_vault_cert_name = kwargs.get('key_vault_cert_name', None) + self.vault_uri = kwargs['vault_uri'] + self.key_vault_cert_name = kwargs['key_vault_cert_name'] self.cert_version = kwargs.get('cert_version', None) self.issuer = None self.issued_date = None @@ -371,8 +446,7 @@ def __init__(self, **kwargs): class CertificateResource(ProxyResource): """Certificate resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -381,8 +455,7 @@ class CertificateResource(ProxyResource): :ivar type: The type of the resource. :vartype type: str :param properties: Properties of the certificate resource payload. - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.CertificateProperties + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateProperties """ _validation = { @@ -398,54 +471,51 @@ class CertificateResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class CloudError(Model): - """An error response from the service. +class CertificateResourceCollection(msrest.serialization.Model): + """Collection compose of certificate resources list and a possible link for next page. - :param error: An error response from the service. - :type error: ~azure.mgmt.appplatform.v2020_07_01.models.CloudErrorBody + :param value: The certificate resources list. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] + :param next_link: The link to next page of certificate list. + :type next_link: str """ _attribute_map = { - 'error': {'key': 'error', 'type': 'CloudErrorBody'}, + 'value': {'key': 'value', 'type': '[CertificateResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): - super(CloudError, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class CloudErrorException(HttpOperationError): - """Server responsed with exception of type: 'CloudError'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + def __init__( + self, + **kwargs + ): + super(CertificateResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) -class CloudErrorBody(Model): +class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are - intended to be consumed programmatically. + :param code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. :type code: str - :param message: A message describing the error, intended to be suitable - for display in a user interface. + :param message: A message describing the error, intended to be suitable for display in a user + interface. :type message: str - :param target: The target of the particular error. For example, the name - of the property in error. + :param target: The target of the particular error. For example, the name of the property in + error. :type target: str :param details: A list of additional details about the error. - :type details: - list[~azure.mgmt.appplatform.v2020_07_01.models.CloudErrorBody] + :type details: list[~azure.mgmt.appplatform.v2020_07_01.models.CloudErrorBody] """ _attribute_map = { @@ -455,7 +525,10 @@ class CloudErrorBody(Model): 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CloudErrorBody, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -463,24 +536,21 @@ def __init__(self, **kwargs): self.details = kwargs.get('details', None) -class ClusterResourceProperties(Model): +class ClusterResourceProperties(msrest.serialization.Model): """Service properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Provisioning state of the Service. Possible - values include: 'Creating', 'Updating', 'Deleting', 'Deleted', - 'Succeeded', 'Failed', 'Moving', 'Moved', 'MoveFailed' + :ivar provisioning_state: Provisioning state of the Service. Possible values include: + "Creating", "Updating", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", "Moved", + "MoveFailed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_07_01.models.ProvisioningState - :param network_profile: Network profile of the Service - :type network_profile: - ~azure.mgmt.appplatform.v2020_07_01.models.NetworkProfile - :ivar version: Version of the Service + :param network_profile: Network profile of the Service. + :type network_profile: ~azure.mgmt.appplatform.v2020_07_01.models.NetworkProfile + :ivar version: Version of the Service. :vartype version: int - :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a - created resource + :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. :vartype service_id: str """ @@ -497,7 +567,10 @@ class ClusterResourceProperties(Model): 'service_id': {'key': 'serviceId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.network_profile = kwargs.get('network_profile', None) @@ -505,19 +578,18 @@ def __init__(self, **kwargs): self.service_id = None -class ConfigServerGitProperty(Model): +class ConfigServerGitProperty(msrest.serialization.Model): """Property of git. All required parameters must be populated in order to send to Azure. :param repositories: Repositories of git. - :type repositories: - list[~azure.mgmt.appplatform.v2020_07_01.models.GitPatternRepository] - :param uri: Required. URI of the repository + :type repositories: list[~azure.mgmt.appplatform.v2020_07_01.models.GitPatternRepository] + :param uri: Required. URI of the repository. :type uri: str - :param label: Label of the repository + :param label: Label of the repository. :type label: str - :param search_paths: Searching path of the repository + :param search_paths: Searching path of the repository. :type search_paths: list[str] :param username: Username of git repository basic auth. :type username: str @@ -550,10 +622,13 @@ class ConfigServerGitProperty(Model): 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = kwargs.get('repositories', None) - self.uri = kwargs.get('uri', None) + self.uri = kwargs['uri'] self.label = kwargs.get('label', None) self.search_paths = kwargs.get('search_paths', None) self.username = kwargs.get('username', None) @@ -564,21 +639,19 @@ def __init__(self, **kwargs): self.strict_host_key_checking = kwargs.get('strict_host_key_checking', None) -class ConfigServerProperties(Model): +class ConfigServerProperties(msrest.serialization.Model): """Config server git properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: State of the config server. Possible values - include: 'NotAvailable', 'Deleted', 'Failed', 'Succeeded', 'Updating' + :ivar provisioning_state: State of the config server. Possible values include: "NotAvailable", + "Deleted", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerState :param error: Error when apply config server settings. :type error: ~azure.mgmt.appplatform.v2020_07_01.models.Error :param config_server: Settings of config server. - :type config_server: - ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings + :type config_server: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings """ _validation = { @@ -591,7 +664,10 @@ class ConfigServerProperties(Model): 'config_server': {'key': 'configServer', 'type': 'ConfigServerSettings'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConfigServerProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = kwargs.get('error', None) @@ -601,8 +677,7 @@ def __init__(self, **kwargs): class ConfigServerResource(ProxyResource): """Config Server resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -610,9 +685,8 @@ class ConfigServerResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Config Server resource - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerProperties + :param properties: Properties of the Config Server resource. + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerProperties """ _validation = { @@ -628,36 +702,41 @@ class ConfigServerResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'ConfigServerProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConfigServerResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class ConfigServerSettings(Model): +class ConfigServerSettings(msrest.serialization.Model): """The settings of config server. :param git_property: Property of git environment. - :type git_property: - ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerGitProperty + :type git_property: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerGitProperty """ _attribute_map = { 'git_property': {'key': 'gitProperty', 'type': 'ConfigServerGitProperty'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = kwargs.get('git_property', None) -class ConfigServerSettingsErrorRecord(Model): +class ConfigServerSettingsErrorRecord(msrest.serialization.Model): """Error record of the config server settings. - :param name: The name of the config server settings error record + :param name: The name of the config server settings error record. :type name: str - :param uri: The uri of the config server settings error record + :param uri: The uri of the config server settings error record. :type uri: str - :param messages: The detail error messages of the record + :param messages: The detail error messages of the record. :type messages: list[str] """ @@ -667,21 +746,23 @@ class ConfigServerSettingsErrorRecord(Model): 'messages': {'key': 'messages', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.uri = kwargs.get('uri', None) self.messages = kwargs.get('messages', None) -class ConfigServerSettingsValidateResult(Model): +class ConfigServerSettingsValidateResult(msrest.serialization.Model): """Validation result for config server settings. - :param is_valid: Indicate if the config server settings are valid + :param is_valid: Indicate if the config server settings are valid. :type is_valid: bool - :param details: The detail validation results - :type details: - list[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsErrorRecord] + :param details: The detail validation results. + :type details: list[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsErrorRecord] """ _attribute_map = { @@ -689,17 +770,19 @@ class ConfigServerSettingsValidateResult(Model): 'details': {'key': 'details', 'type': '[ConfigServerSettingsErrorRecord]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) self.is_valid = kwargs.get('is_valid', None) self.details = kwargs.get('details', None) -class CustomDomainProperties(Model): +class CustomDomainProperties(msrest.serialization.Model): """Custom domain of app resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param thumbprint: The thumbprint of bound certificate. :type thumbprint: str @@ -719,7 +802,10 @@ class CustomDomainProperties(Model): 'cert_name': {'key': 'certName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = kwargs.get('thumbprint', None) self.app_name = None @@ -729,8 +815,7 @@ def __init__(self, **kwargs): class CustomDomainResource(ProxyResource): """Custom domain resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -739,8 +824,7 @@ class CustomDomainResource(ProxyResource): :ivar type: The type of the resource. :vartype type: str :param properties: Properties of the custom domain resource. - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainProperties + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainProperties """ _validation = { @@ -756,17 +840,43 @@ class CustomDomainResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'CustomDomainProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CustomDomainResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class CustomDomainValidatePayload(Model): +class CustomDomainResourceCollection(msrest.serialization.Model): + """Collection compose of a custom domain resources list and a possible link for next page. + + :param value: The custom domain resources list. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] + :param next_link: The link to next page of custom domain list. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CustomDomainResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomDomainResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class CustomDomainValidatePayload(msrest.serialization.Model): """Custom domain validate payload. All required parameters must be populated in order to send to Azure. - :param name: Required. Name to be validated + :param name: Required. Name to be validated. :type name: str """ @@ -778,12 +888,15 @@ class CustomDomainValidatePayload(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CustomDomainValidatePayload, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + self.name = kwargs['name'] -class CustomDomainValidateResult(Model): +class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. :param is_valid: Indicates if domain name is valid. @@ -797,27 +910,29 @@ class CustomDomainValidateResult(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = kwargs.get('is_valid', None) self.message = kwargs.get('message', None) -class DeploymentInstance(Model): +class DeploymentInstance(msrest.serialization.Model): """Deployment instance payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Name of the deployment instance + :ivar name: Name of the deployment instance. :vartype name: str - :ivar status: Status of the deployment instance + :ivar status: Status of the deployment instance. :vartype status: str - :ivar reason: Failed reason of the deployment instance + :ivar reason: Failed reason of the deployment instance. :vartype reason: str - :ivar discovery_status: Discovery status of the deployment instance + :ivar discovery_status: Discovery status of the deployment instance. :vartype discovery_status: str - :ivar start_time: Start time of the deployment instance + :ivar start_time: Start time of the deployment instance. :vartype start_time: str """ @@ -837,7 +952,10 @@ class DeploymentInstance(Model): 'start_time': {'key': 'startTime', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -849,8 +967,7 @@ def __init__(self, **kwargs): class DeploymentResource(ProxyResource): """Deployment resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -858,10 +975,9 @@ class DeploymentResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Deployment resource - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource + :param properties: Properties of the Deployment resource. + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceProperties + :param sku: Sku of the Deployment resource. :type sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku """ @@ -879,41 +995,63 @@ class DeploymentResource(ProxyResource): 'sku': {'key': 'sku', 'type': 'Sku'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeploymentResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.sku = kwargs.get('sku', None) -class DeploymentResourceProperties(Model): +class DeploymentResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :param value: Collection of Deployment resources. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class DeploymentResourceProperties(msrest.serialization.Model): """Deployment resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param source: Uploaded source information of the deployment. :type source: ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceInfo - :ivar app_name: App name of the deployment + :ivar app_name: App name of the deployment. :vartype app_name: str - :param deployment_settings: Deployment settings of the Deployment - :type deployment_settings: - ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Possible - values include: 'Creating', 'Updating', 'Succeeded', 'Failed' + :param deployment_settings: Deployment settings of the Deployment. + :type deployment_settings: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentSettings + :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: + "Creating", "Updating", "Succeeded", "Failed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Possible values include: - 'Unknown', 'Stopped', 'Running', 'Failed', 'Allocating', 'Upgrading', - 'Compiling' - :vartype status: str or - ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceStatus - :ivar active: Indicates whether the Deployment is active + :ivar status: Status of the Deployment. Possible values include: "Unknown", "Stopped", + "Running", "Failed", "Allocating", "Upgrading", "Compiling". + :vartype status: str or ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceStatus + :ivar active: Indicates whether the Deployment is active. :vartype active: bool - :ivar created_time: Date time when the resource is created - :vartype created_time: datetime - :ivar instances: Collection of instances belong to the Deployment - :vartype instances: - list[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentInstance] + :ivar created_time: Date time when the resource is created. + :vartype created_time: ~datetime.datetime + :ivar instances: Collection of instances belong to the Deployment. + :vartype instances: list[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentInstance] """ _validation = { @@ -936,7 +1074,10 @@ class DeploymentResourceProperties(Model): 'instances': {'key': 'instances', 'type': '[DeploymentInstance]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = kwargs.get('source', None) self.app_name = None @@ -948,26 +1089,23 @@ def __init__(self, **kwargs): self.instances = None -class DeploymentSettings(Model): +class DeploymentSettings(msrest.serialization.Model): """Deployment settings payload. - :param cpu: Required CPU, basic tier should be 1, standard tier should be - in range (1, 4). Default value: 1 . + :param cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). :type cpu: int - :param memory_in_gb: Required Memory size in GB, basic tier should be in - range (1, 2), standard tier should be in range (1, 8). Default value: 1 . + :param memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), standard + tier should be in range (1, 8). :type memory_in_gb: int - :param jvm_options: JVM parameter + :param jvm_options: JVM parameter. :type jvm_options: str - :param net_core_main_entry_path: The path to the .NET executable relative - to zip root + :param net_core_main_entry_path: The path to the .NET executable relative to zip root. :type net_core_main_entry_path: str - :param environment_variables: Collection of environment variables + :param environment_variables: Collection of environment variables. :type environment_variables: dict[str, str] - :param runtime_version: Runtime version. Possible values include: - 'Java_8', 'Java_11', 'NetCore_31' - :type runtime_version: str or - ~azure.mgmt.appplatform.v2020_07_01.models.RuntimeVersion + :param runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :type runtime_version: str or ~azure.mgmt.appplatform.v2020_07_01.models.RuntimeVersion """ _attribute_map = { @@ -979,17 +1117,20 @@ class DeploymentSettings(Model): 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeploymentSettings, self).__init__(**kwargs) self.cpu = kwargs.get('cpu', 1) self.memory_in_gb = kwargs.get('memory_in_gb', 1) self.jvm_options = kwargs.get('jvm_options', None) self.net_core_main_entry_path = kwargs.get('net_core_main_entry_path', None) self.environment_variables = kwargs.get('environment_variables', None) - self.runtime_version = kwargs.get('runtime_version', None) + self.runtime_version = kwargs.get('runtime_version', "Java_8") -class Error(Model): +class Error(msrest.serialization.Model): """The error code compose of code and message. :param code: The code of error. @@ -1003,26 +1144,29 @@ class Error(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Error, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) -class GitPatternRepository(Model): +class GitPatternRepository(msrest.serialization.Model): """Git repository property payload. All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the repository + :param name: Required. Name of the repository. :type name: str - :param pattern: Collection of pattern of the repository + :param pattern: Collection of pattern of the repository. :type pattern: list[str] - :param uri: Required. URI of the repository + :param uri: Required. URI of the repository. :type uri: str - :param label: Label of the repository + :param label: Label of the repository. :type label: str - :param search_paths: Searching path of the repository + :param search_paths: Searching path of the repository. :type search_paths: list[str] :param username: Username of git repository basic auth. :type username: str @@ -1057,11 +1201,14 @@ class GitPatternRepository(Model): 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(GitPatternRepository, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + self.name = kwargs['name'] self.pattern = kwargs.get('pattern', None) - self.uri = kwargs.get('uri', None) + self.uri = kwargs['uri'] self.label = kwargs.get('label', None) self.search_paths = kwargs.get('search_paths', None) self.username = kwargs.get('username', None) @@ -1072,12 +1219,12 @@ def __init__(self, **kwargs): self.strict_host_key_checking = kwargs.get('strict_host_key_checking', None) -class LogFileUrlResponse(Model): +class LogFileUrlResponse(msrest.serialization.Model): """Log file URL payload. All required parameters must be populated in order to send to Azure. - :param url: Required. URL of the log file + :param url: Required. URL of the log file. :type url: str """ @@ -1089,19 +1236,22 @@ class LogFileUrlResponse(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LogFileUrlResponse, self).__init__(**kwargs) - self.url = kwargs.get('url', None) + self.url = kwargs['url'] -class LogSpecification(Model): +class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :param name: Name of the log + :param name: Name of the log. :type name: str - :param display_name: Localized friendly display name of the log + :param display_name: Localized friendly display name of the log. :type display_name: str - :param blob_duration: Blob duration of the log + :param blob_duration: Blob duration of the log. :type blob_duration: str """ @@ -1111,23 +1261,25 @@ class LogSpecification(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LogSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) self.blob_duration = kwargs.get('blob_duration', None) -class ManagedIdentityProperties(Model): +class ManagedIdentityProperties(msrest.serialization.Model): """Managed identity properties retrieved from ARM request headers. - :param type: Type of the managed identity. Possible values include: - 'None', 'SystemAssigned', 'UserAssigned', 'SystemAssigned,UserAssigned' - :type type: str or - ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityType - :param principal_id: Principal Id + :param type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :type type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityType + :param principal_id: Principal Id. :type principal_id: str - :param tenant_id: Tenant Id + :param tenant_id: Tenant Id. :type tenant_id: str """ @@ -1137,60 +1289,70 @@ class ManagedIdentityProperties(Model): 'tenant_id': {'key': 'tenantId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.principal_id = kwargs.get('principal_id', None) self.tenant_id = kwargs.get('tenant_id', None) -class MetricDimension(Model): +class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension + :param name: Name of the dimension. :type name: str - :param display_name: Localized friendly display name of the dimension + :param display_name: Localized friendly display name of the dimension. :type display_name: str + :param to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :type to_be_exported_for_shoebox: bool """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'display_name': {'key': 'displayName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MetricDimension, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) + self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) -class MetricSpecification(Model): +class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :param name: Name of the metric + :param name: Name of the metric. :type name: str - :param display_name: Localized friendly display name of the metric + :param display_name: Localized friendly display name of the metric. :type display_name: str - :param display_description: Localized friendly description of the metric + :param display_description: Localized friendly description of the metric. :type display_description: str - :param unit: Unit that makes sense for the metric + :param unit: Unit that makes sense for the metric. :type unit: str - :param category: Name of the metric category that the metric belongs to. A - metric can only belong to a single category. + :param category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. :type category: str - :param aggregation_type: Only provide one value for this field. Valid - values: Average, Minimum, Maximum, Total, Count. + :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + Maximum, Total, Count. :type aggregation_type: str - :param supported_aggregation_types: Supported aggregation types + :param supported_aggregation_types: Supported aggregation types. :type supported_aggregation_types: list[str] - :param supported_time_grain_types: Supported time grain types + :param supported_time_grain_types: Supported time grain types. :type supported_time_grain_types: list[str] - :param fill_gap_with_zero: Optional. If set to true, then zero will be - returned for time duration where no metric is emitted/published. + :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. :type fill_gap_with_zero: bool - :param dimensions: Dimensions of the metric - :type dimensions: - list[~azure.mgmt.appplatform.v2020_07_01.models.MetricDimension] + :param dimensions: Dimensions of the metric. + :type dimensions: list[~azure.mgmt.appplatform.v2020_07_01.models.MetricDimension] """ _attribute_map = { @@ -1206,7 +1368,10 @@ class MetricSpecification(Model): 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MetricSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1220,22 +1385,20 @@ def __init__(self, **kwargs): self.dimensions = kwargs.get('dimensions', None) -class MonitoringSettingProperties(Model): +class MonitoringSettingProperties(msrest.serialization.Model): """Monitoring Setting properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: State of the Monitoring Setting. Possible values - include: 'NotAvailable', 'Failed', 'Succeeded', 'Updating' + :ivar provisioning_state: State of the Monitoring Setting. Possible values include: + "NotAvailable", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingState :param error: Error when apply Monitoring Setting changes. :type error: ~azure.mgmt.appplatform.v2020_07_01.models.Error - :param trace_enabled: Indicates whether enable the trace functionality + :param trace_enabled: Indicates whether enable the trace functionality. :type trace_enabled: bool - :param app_insights_instrumentation_key: Target application insight - instrumentation key + :param app_insights_instrumentation_key: Target application insight instrumentation key. :type app_insights_instrumentation_key: str """ @@ -1250,7 +1413,10 @@ class MonitoringSettingProperties(Model): 'app_insights_instrumentation_key': {'key': 'appInsightsInstrumentationKey', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MonitoringSettingProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = kwargs.get('error', None) @@ -1261,8 +1427,7 @@ def __init__(self, **kwargs): class MonitoringSettingResource(ProxyResource): """Monitoring Setting resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -1270,9 +1435,8 @@ class MonitoringSettingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Monitoring Setting resource - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingProperties + :param properties: Properties of the Monitoring Setting resource. + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingProperties """ _validation = { @@ -1288,19 +1452,22 @@ class MonitoringSettingResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'MonitoringSettingProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MonitoringSettingResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class NameAvailability(Model): +class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :param name_available: Indicates whether the name is available + :param name_available: Indicates whether the name is available. :type name_available: bool - :param reason: Reason why the name is not available + :param reason: Reason why the name is not available. :type reason: str - :param message: Message why the name is not available + :param message: Message why the name is not available. :type message: str """ @@ -1310,21 +1477,24 @@ class NameAvailability(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NameAvailability, self).__init__(**kwargs) self.name_available = kwargs.get('name_available', None) self.reason = kwargs.get('reason', None) self.message = kwargs.get('message', None) -class NameAvailabilityParameters(Model): +class NameAvailabilityParameters(msrest.serialization.Model): """Name availability parameters payload. All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the resource to check name availability + :param type: Required. Type of the resource to check name availability. :type type: str - :param name: Required. Name to be checked + :param name: Required. Name to be checked. :type name: str """ @@ -1338,44 +1508,42 @@ class NameAvailabilityParameters(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NameAvailabilityParameters, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.name = kwargs.get('name', None) + self.type = kwargs['type'] + self.name = kwargs['name'] -class NetworkProfile(Model): +class NetworkProfile(msrest.serialization.Model): """Service network profile payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param service_runtime_subnet_id: Fully qualified resource Id of the - subnet to host Azure Spring Cloud Service Runtime + :param service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. :type service_runtime_subnet_id: str - :param app_subnet_id: Fully qualified resource Id of the subnet to host - Azure Spring Cloud Apps + :param app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. :type app_subnet_id: str - :param service_cidr: Azure Spring Cloud service reserved CIDR + :param service_cidr: Azure Spring Cloud service reserved CIDR. :type service_cidr: str - :param service_runtime_network_resource_group: Name of the resource group - containing network resources of Azure Spring Cloud Service Runtime + :param service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. :type service_runtime_network_resource_group: str - :param app_network_resource_group: Name of the resource group containing - network resources of Azure Spring Cloud Apps + :param app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. :type app_network_resource_group: str - :ivar outbound_ips: Desired outbound IP resources for Azure Spring Cloud - instance. - :vartype outbound_ips: - ~azure.mgmt.appplatform.v2020_07_01.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure - Spring Cloud instance. - :vartype required_traffics: - list[~azure.mgmt.appplatform.v2020_07_01.models.RequiredTraffic] + :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Cloud instance. + :vartype outbound_i_ps: ~azure.mgmt.appplatform.v2020_07_01.models.NetworkProfileOutboundIPs + :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Cloud instance. + :vartype required_traffics: list[~azure.mgmt.appplatform.v2020_07_01.models.RequiredTraffic] """ _validation = { - 'outbound_ips': {'readonly': True}, + 'outbound_i_ps': {'readonly': True}, 'required_traffics': {'readonly': True}, } @@ -1385,58 +1553,62 @@ class NetworkProfile(Model): 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, 'service_runtime_network_resource_group': {'key': 'serviceRuntimeNetworkResourceGroup', 'type': 'str'}, 'app_network_resource_group': {'key': 'appNetworkResourceGroup', 'type': 'str'}, - 'outbound_ips': {'key': 'outboundIPs', 'type': 'NetworkProfileOutboundIPs'}, + 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'NetworkProfileOutboundIPs'}, 'required_traffics': {'key': 'requiredTraffics', 'type': '[RequiredTraffic]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NetworkProfile, self).__init__(**kwargs) self.service_runtime_subnet_id = kwargs.get('service_runtime_subnet_id', None) self.app_subnet_id = kwargs.get('app_subnet_id', None) self.service_cidr = kwargs.get('service_cidr', None) self.service_runtime_network_resource_group = kwargs.get('service_runtime_network_resource_group', None) self.app_network_resource_group = kwargs.get('app_network_resource_group', None) - self.outbound_ips = None + self.outbound_i_ps = None self.required_traffics = None -class NetworkProfileOutboundIPs(Model): +class NetworkProfileOutboundIPs(msrest.serialization.Model): """Desired outbound IP resources for Azure Spring Cloud instance. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar public_ips: A list of public IP addresses. - :vartype public_ips: list[str] + :ivar public_i_ps: A list of public IP addresses. + :vartype public_i_ps: list[str] """ _validation = { - 'public_ips': {'readonly': True}, + 'public_i_ps': {'readonly': True}, } _attribute_map = { - 'public_ips': {'key': 'publicIPs', 'type': '[str]'}, + 'public_i_ps': {'key': 'publicIPs', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NetworkProfileOutboundIPs, self).__init__(**kwargs) - self.public_ips = None + self.public_i_ps = None -class OperationDetail(Model): +class OperationDetail(msrest.serialization.Model): """Operation detail payload. - :param name: Name of the operation + :param name: Name of the operation. :type name: str - :param is_data_action: Indicates whether the operation is a data action + :param is_data_action: Indicates whether the operation is a data action. :type is_data_action: bool - :param display: Display of the operation + :param display: Display of the operation. :type display: ~azure.mgmt.appplatform.v2020_07_01.models.OperationDisplay - :param origin: Origin of the operation + :param origin: Origin of the operation. :type origin: str - :param properties: Properties of the operation - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.OperationProperties + :param properties: Properties of the operation. + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.OperationProperties """ _attribute_map = { @@ -1447,7 +1619,10 @@ class OperationDetail(Model): 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OperationDetail, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.is_data_action = kwargs.get('is_data_action', None) @@ -1456,16 +1631,16 @@ def __init__(self, **kwargs): self.properties = kwargs.get('properties', None) -class OperationDisplay(Model): +class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :param provider: Resource provider of the operation + :param provider: Resource provider of the operation. :type provider: str - :param resource: Resource of the operation + :param resource: Resource of the operation. :type resource: str - :param operation: Localized friendly name for the operation + :param operation: Localized friendly name for the operation. :type operation: str - :param description: Localized friendly description for the operation + :param description: Localized friendly description for the operation. :type description: str """ @@ -1476,7 +1651,10 @@ class OperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OperationDisplay, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -1484,34 +1662,35 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) -class OperationProperties(Model): +class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :param service_specification: Service specifications of the operation - :type service_specification: - ~azure.mgmt.appplatform.v2020_07_01.models.ServiceSpecification + :param service_specification: Service specifications of the operation. + :type service_specification: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceSpecification """ _attribute_map = { 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OperationProperties, self).__init__(**kwargs) self.service_specification = kwargs.get('service_specification', None) -class PersistentDisk(Model): +class PersistentDisk(msrest.serialization.Model): """Persistent disk payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param size_in_gb: Size of the persistent disk in GB + :param size_in_gb: Size of the persistent disk in GB. :type size_in_gb: int - :ivar used_in_gb: Size of the used persistent disk in GB + :ivar used_in_gb: Size of the used persistent disk in GB. :vartype used_in_gb: int - :param mount_path: Mount path of the persistent disk + :param mount_path: Mount path of the persistent disk. :type mount_path: str """ @@ -1526,22 +1705,24 @@ class PersistentDisk(Model): 'mount_path': {'key': 'mountPath', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = kwargs.get('size_in_gb', None) self.used_in_gb = None self.mount_path = kwargs.get('mount_path', None) -class RegenerateTestKeyRequestPayload(Model): +class RegenerateTestKeyRequestPayload(msrest.serialization.Model): """Regenerate test key request payload. All required parameters must be populated in order to send to Azure. - :param key_type: Required. Type of the test key. Possible values include: - 'Primary', 'Secondary' - :type key_type: str or - ~azure.mgmt.appplatform.v2020_07_01.models.TestKeyType + :param key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :type key_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.TestKeyType """ _validation = { @@ -1552,29 +1733,30 @@ class RegenerateTestKeyRequestPayload(Model): 'key_type': {'key': 'keyType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) - self.key_type = kwargs.get('key_type', None) + self.key_type = kwargs['key_type'] -class RequiredTraffic(Model): +class RequiredTraffic(msrest.serialization.Model): """Required inbound or outbound traffic for Azure Spring Cloud instance. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar protocol: The protocol of required traffic + :ivar protocol: The protocol of required traffic. :vartype protocol: str - :ivar port: The port of required traffic + :ivar port: The port of required traffic. :vartype port: int - :ivar ips: The ip list of required traffic + :ivar ips: The ip list of required traffic. :vartype ips: list[str] - :ivar fqdns: The FQDN list of required traffic + :ivar fqdns: The FQDN list of required traffic. :vartype fqdns: list[str] - :ivar direction: The direction of required traffic. Possible values - include: 'Inbound', 'Outbound' - :vartype direction: str or - ~azure.mgmt.appplatform.v2020_07_01.models.TrafficDirection + :ivar direction: The direction of required traffic. Possible values include: "Inbound", + "Outbound". + :vartype direction: str or ~azure.mgmt.appplatform.v2020_07_01.models.TrafficDirection """ _validation = { @@ -1593,7 +1775,10 @@ class RequiredTraffic(Model): 'direction': {'key': 'direction', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -1602,7 +1787,7 @@ def __init__(self, **kwargs): self.direction = None -class ResourceSku(Model): +class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. :param resource_type: Gets the type of resource the SKU applies to. @@ -1615,15 +1800,12 @@ class ResourceSku(Model): :type capacity: ~azure.mgmt.appplatform.v2020_07_01.models.SkuCapacity :param locations: Gets the set of locations that the SKU is available. :type locations: list[str] - :param location_info: Gets a list of locations and availability zones in - those locations where the SKU is available. - :type location_info: - list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuLocationInfo] - :param restrictions: Gets the restrictions because of which SKU cannot be - used. This is + :param location_info: Gets a list of locations and availability zones in those locations where + the SKU is available. + :type location_info: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuLocationInfo] + :param restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: - list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictions] + :type restrictions: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictions] """ _attribute_map = { @@ -1636,7 +1818,10 @@ class ResourceSku(Model): 'restrictions': {'key': 'restrictions', 'type': '[ResourceSkuRestrictions]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSku, self).__init__(**kwargs) self.resource_type = kwargs.get('resource_type', None) self.name = kwargs.get('name', None) @@ -1647,7 +1832,7 @@ def __init__(self, **kwargs): self.restrictions = kwargs.get('restrictions', None) -class ResourceSkuCapabilities(Model): +class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. :param name: Gets an invariant to describe the feature. @@ -1661,23 +1846,48 @@ class ResourceSkuCapabilities(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.value = kwargs.get('value', None) -class ResourceSkuLocationInfo(Model): +class ResourceSkuCollection(msrest.serialization.Model): + """Object that includes an array of Azure Spring Cloud SKU and a possible link for next set. + + :param value: Collection of resource SKU. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSku] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceSku]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceSkuCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ResourceSkuLocationInfo(msrest.serialization.Model): """Locations and availability zones where the SKU is available. - :param location: Gets location of the SKU + :param location: Gets location of the SKU. :type location: str :param zones: Gets list of availability zones where the SKU is supported. :type zones: list[str] - :param zone_details: Gets details of capabilities available to a SKU in - specific zones. - :type zone_details: - list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuZoneDetails] + :param zone_details: Gets details of capabilities available to a SKU in specific zones. + :type zone_details: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuZoneDetails] """ _attribute_map = { @@ -1686,17 +1896,20 @@ class ResourceSkuLocationInfo(Model): 'zone_details': {'key': 'zoneDetails', 'type': '[ResourceSkuZoneDetails]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.zones = kwargs.get('zones', None) self.zone_details = kwargs.get('zone_details', None) -class ResourceSkuRestrictionInfo(Model): +class ResourceSkuRestrictionInfo(msrest.serialization.Model): """Information about the restriction where the SKU cannot be used. - :param locations: Gets locations where the SKU is restricted + :param locations: Gets locations where the SKU is restricted. :type locations: list[str] :param zones: Gets list of availability zones where the SKU is restricted. :type zones: list[str] @@ -1707,29 +1920,30 @@ class ResourceSkuRestrictionInfo(Model): 'zones': {'key': 'zones', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = kwargs.get('locations', None) self.zones = kwargs.get('zones', None) -class ResourceSkuRestrictions(Model): +class ResourceSkuRestrictions(msrest.serialization.Model): """Restrictions where the SKU cannot be used. - :param type: Gets the type of restrictions. Possible values include: - 'Location', 'Zone' - :type type: str or - ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsType - :param values: Gets the value of restrictions. If the restriction type is - set to + :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". + :type type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsType + :param values: Gets the value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. :type values: list[str] - :param restriction_info: Gets the information about the restriction where - the SKU cannot be used. - :type restriction_info: - ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionInfo - :param reason_code: Gets the reason for restriction. Possible values - include: 'QuotaId', 'NotAvailableForSubscription' + :param restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :type restriction_info: ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionInfo + :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". :type reason_code: str or ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsReasonCode """ @@ -1741,7 +1955,10 @@ class ResourceSkuRestrictions(Model): 'reason_code': {'key': 'reasonCode', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.values = kwargs.get('values', None) @@ -1749,17 +1966,15 @@ def __init__(self, **kwargs): self.reason_code = kwargs.get('reason_code', None) -class ResourceSkuZoneDetails(Model): +class ResourceSkuZoneDetails(msrest.serialization.Model): """Details of capabilities available to a SKU in specific zones. :param name: Gets the set of zones that the SKU is available in with the specified capabilities. :type name: list[str] - :param capabilities: Gets a list of capabilities that are available for - the SKU in the + :param capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. - :type capabilities: - list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCapabilities] + :type capabilities: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCapabilities] """ _attribute_map = { @@ -1767,18 +1982,21 @@ class ResourceSkuZoneDetails(Model): 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.capabilities = kwargs.get('capabilities', None) -class ResourceUploadDefinition(Model): +class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :param relative_path: Source relative path + :param relative_path: Source relative path. :type relative_path: str - :param upload_url: Upload URL + :param upload_url: Upload URL. :type upload_url: str """ @@ -1787,7 +2005,10 @@ class ResourceUploadDefinition(Model): 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = kwargs.get('relative_path', None) self.upload_url = kwargs.get('upload_url', None) @@ -1796,8 +2017,7 @@ def __init__(self, **kwargs): class TrackedResource(Resource): """The resource model definition for a ARM tracked top level resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -1807,7 +2027,7 @@ class TrackedResource(Resource): :vartype type: str :param location: The GEO location of the resource. :type location: str - :param tags: Tags of the service which is a list of key value pairs that + :param tags: A set of tags. Tags of the service which is a list of key value pairs that describe the resource. :type tags: dict[str, str] """ @@ -1826,7 +2046,10 @@ class TrackedResource(Resource): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TrackedResource, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.tags = kwargs.get('tags', None) @@ -1835,8 +2058,7 @@ def __init__(self, **kwargs): class ServiceResource(TrackedResource): """Service resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -1846,13 +2068,12 @@ class ServiceResource(TrackedResource): :vartype type: str :param location: The GEO location of the resource. :type location: str - :param tags: Tags of the service which is a list of key value pairs that + :param tags: A set of tags. Tags of the service which is a list of key value pairs that describe the resource. :type tags: dict[str, str] - :param properties: Properties of the Service resource - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.ClusterResourceProperties - :param sku: Sku of the Service resource + :param properties: Properties of the Service resource. + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.ClusterResourceProperties + :param sku: Sku of the Service resource. :type sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku """ @@ -1872,20 +2093,45 @@ class ServiceResource(TrackedResource): 'sku': {'key': 'sku', 'type': 'Sku'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServiceResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.sku = kwargs.get('sku', None) -class ServiceSpecification(Model): +class ServiceResourceList(msrest.serialization.Model): + """Object that includes an array of Service resources and a possible link for next set. + + :param value: Collection of Service resources. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ServiceResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ServiceResourceList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :param log_specifications: Specifications of the Log for Azure Monitoring - :type log_specifications: - list[~azure.mgmt.appplatform.v2020_07_01.models.LogSpecification] - :param metric_specifications: Specifications of the Metrics for Azure - Monitoring + :param log_specifications: Specifications of the Log for Azure Monitoring. + :type log_specifications: list[~azure.mgmt.appplatform.v2020_07_01.models.LogSpecification] + :param metric_specifications: Specifications of the Metrics for Azure Monitoring. :type metric_specifications: list[~azure.mgmt.appplatform.v2020_07_01.models.MetricSpecification] """ @@ -1895,20 +2141,23 @@ class ServiceSpecification(Model): 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = kwargs.get('log_specifications', None) self.metric_specifications = kwargs.get('metric_specifications', None) -class Sku(Model): +class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :param name: Name of the Sku + :param name: Name of the Sku. :type name: str - :param tier: Tier of the Sku + :param tier: Tier of the Sku. :type tier: str - :param capacity: Current capacity of the target resource + :param capacity: Current capacity of the target resource. :type capacity: int """ @@ -1918,14 +2167,17 @@ class Sku(Model): 'capacity': {'key': 'capacity', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Sku, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.tier = kwargs.get('tier', None) self.capacity = kwargs.get('capacity', None) -class SkuCapacity(Model): +class SkuCapacity(msrest.serialization.Model): """The SKU capacity. All required parameters must be populated in order to send to Azure. @@ -1936,10 +2188,9 @@ class SkuCapacity(Model): :type maximum: int :param default: Gets or sets the default. :type default: int - :param scale_type: Gets or sets the type of the scale. Possible values - include: 'None', 'Manual', 'Automatic' - :type scale_type: str or - ~azure.mgmt.appplatform.v2020_07_01.models.SkuScaleType + :param scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :type scale_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.SkuScaleType """ _validation = { @@ -1953,25 +2204,26 @@ class SkuCapacity(Model): 'scale_type': {'key': 'scaleType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SkuCapacity, self).__init__(**kwargs) - self.minimum = kwargs.get('minimum', None) + self.minimum = kwargs['minimum'] self.maximum = kwargs.get('maximum', None) self.default = kwargs.get('default', None) self.scale_type = kwargs.get('scale_type', None) -class SupportedRuntimeVersion(Model): +class SupportedRuntimeVersion(msrest.serialization.Model): """Supported deployment runtime version descriptor. - :param value: The raw value which could be passed to deployment CRUD - operations. Possible values include: 'Java_8', 'Java_11', 'NetCore_31' - :type value: str or - ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimeValue - :param platform: The platform of this runtime version (possible values: - "Java" or ".NET"). Possible values include: 'Java', '.NET Core' - :type platform: str or - ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimePlatform + :param value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :type value: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimeValue + :param platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". + :type platform: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimePlatform :param version: The detailed version (major.minor) of the platform. :type version: str """ @@ -1982,19 +2234,22 @@ class SupportedRuntimeVersion(Model): 'version': {'key': 'version', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.platform = kwargs.get('platform', None) self.version = kwargs.get('version', None) -class TemporaryDisk(Model): +class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :param size_in_gb: Size of the temporary disk in GB + :param size_in_gb: Size of the temporary disk in GB. :type size_in_gb: int - :param mount_path: Mount path of the temporary disk + :param mount_path: Mount path of the temporary disk. :type mount_path: str """ @@ -2007,24 +2262,27 @@ class TemporaryDisk(Model): 'mount_path': {'key': 'mountPath', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = kwargs.get('size_in_gb', None) - self.mount_path = kwargs.get('mount_path', None) + self.mount_path = kwargs.get('mount_path', "/tmp") -class TestKeys(Model): +class TestKeys(msrest.serialization.Model): """Test keys payload. - :param primary_key: Primary key + :param primary_key: Primary key. :type primary_key: str - :param secondary_key: Secondary key + :param secondary_key: Secondary key. :type secondary_key: str - :param primary_test_endpoint: Primary test endpoint + :param primary_test_endpoint: Primary test endpoint. :type primary_test_endpoint: str - :param secondary_test_endpoint: Secondary test endpoint + :param secondary_test_endpoint: Secondary test endpoint. :type secondary_test_endpoint: str - :param enabled: Indicates whether the test endpoint feature enabled or not + :param enabled: Indicates whether the test endpoint feature enabled or not. :type enabled: bool """ @@ -2036,7 +2294,10 @@ class TestKeys(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TestKeys, self).__init__(**kwargs) self.primary_key = kwargs.get('primary_key', None) self.secondary_key = kwargs.get('secondary_key', None) @@ -2045,19 +2306,18 @@ def __init__(self, **kwargs): self.enabled = kwargs.get('enabled', None) -class UserSourceInfo(Model): +class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :param type: Type of the source uploaded. Possible values include: 'Jar', - 'NetCoreZip', 'Source' - :type type: str or - ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceType - :param relative_path: Relative path of the storage which stores the source + :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source". + :type type: str or ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceType + :param relative_path: Relative path of the storage which stores the source. :type relative_path: str - :param version: Version of the source + :param version: Version of the source. :type version: str - :param artifact_selector: Selector for the artifact to be used for the - deployment for multi-module projects. This should be + :param artifact_selector: Selector for the artifact to be used for the deployment for + multi-module projects. This should be the relative path to the target module/project. :type artifact_selector: str """ @@ -2069,7 +2329,10 @@ class UserSourceInfo(Model): 'artifact_selector': {'key': 'artifactSelector', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(UserSourceInfo, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.relative_path = kwargs.get('relative_path', None) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/models/_models_py3.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/models/_models_py3.py index a57125e51df..1d9493a9481 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/models/_models_py3.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/models/_models_py3.py @@ -1,23 +1,22 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +from typing import Any, Dict, List, Optional, Union +import msrest.serialization -class Resource(Model): +from ._app_platform_management_client_enums import * + + +class Resource(msrest.serialization.Model): """The core properties of ARM resources. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -39,7 +38,10 @@ class Resource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -47,11 +49,9 @@ def __init__(self, **kwargs) -> None: class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have - everything other than required location and tags. + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -73,15 +73,17 @@ class ProxyResource(Resource): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ProxyResource, self).__init__(**kwargs) class AppResource(ProxyResource): """App resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -89,14 +91,11 @@ class AppResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the App resource - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.AppResourceProperties - :param identity: The Managed Identity type of the app resource - :type identity: - ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityProperties - :param location: The GEO location of the application, always the same with - its parent resource + :param properties: Properties of the App resource. + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.AppResourceProperties + :param identity: The Managed Identity type of the app resource. + :type identity: ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityProperties + :param location: The GEO location of the application, always the same with its parent resource. :type location: str """ @@ -115,41 +114,72 @@ class AppResource(ProxyResource): 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, *, properties=None, identity=None, location: str=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["AppResourceProperties"] = None, + identity: Optional["ManagedIdentityProperties"] = None, + location: Optional[str] = None, + **kwargs + ): super(AppResource, self).__init__(**kwargs) self.properties = properties self.identity = identity self.location = location -class AppResourceProperties(Model): +class AppResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :param value: Collection of App resources. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["AppResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(AppResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AppResourceProperties(msrest.serialization.Model): """App resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param public: Indicates whether the App exposes public endpoint + :param public: Indicates whether the App exposes public endpoint. :type public: bool - :ivar url: URL of the App + :ivar url: URL of the App. :vartype url: str - :ivar provisioning_state: Provisioning state of the App. Possible values - include: 'Succeeded', 'Failed', 'Creating', 'Updating' + :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", + "Failed", "Creating", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_07_01.models.AppResourceProvisioningState - :param active_deployment_name: Name of the active deployment of the App + :param active_deployment_name: Name of the active deployment of the App. :type active_deployment_name: str :param fqdn: Fully qualified dns Name. :type fqdn: str :param https_only: Indicate if only https is allowed. :type https_only: bool - :ivar created_time: Date time when the resource is created - :vartype created_time: datetime - :param temporary_disk: Temporary disk settings - :type temporary_disk: - ~azure.mgmt.appplatform.v2020_07_01.models.TemporaryDisk - :param persistent_disk: Persistent disk settings - :type persistent_disk: - ~azure.mgmt.appplatform.v2020_07_01.models.PersistentDisk + :ivar created_time: Date time when the resource is created. + :vartype created_time: ~datetime.datetime + :param temporary_disk: Temporary disk settings. + :type temporary_disk: ~azure.mgmt.appplatform.v2020_07_01.models.TemporaryDisk + :param persistent_disk: Persistent disk settings. + :type persistent_disk: ~azure.mgmt.appplatform.v2020_07_01.models.PersistentDisk """ _validation = { @@ -170,7 +200,17 @@ class AppResourceProperties(Model): 'persistent_disk': {'key': 'persistentDisk', 'type': 'PersistentDisk'}, } - def __init__(self, *, public: bool=None, active_deployment_name: str=None, fqdn: str=None, https_only: bool=None, temporary_disk=None, persistent_disk=None, **kwargs) -> None: + def __init__( + self, + *, + public: Optional[bool] = None, + active_deployment_name: Optional[str] = None, + fqdn: Optional[str] = None, + https_only: Optional[bool] = False, + temporary_disk: Optional["TemporaryDisk"] = None, + persistent_disk: Optional["PersistentDisk"] = None, + **kwargs + ): super(AppResourceProperties, self).__init__(**kwargs) self.public = public self.url = None @@ -183,15 +223,40 @@ def __init__(self, *, public: bool=None, active_deployment_name: str=None, fqdn: self.persistent_disk = persistent_disk -class AvailableRuntimeVersions(Model): +class AvailableOperations(msrest.serialization.Model): + """Available operations of the service. + + :param value: Collection of available operation details. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.OperationDetail] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationDetail]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["OperationDetail"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(AvailableOperations, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AvailableRuntimeVersions(msrest.serialization.Model): """AvailableRuntimeVersions. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar value: A list of all supported runtime versions. - :vartype value: - list[~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimeVersion] + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimeVersion] """ _validation = { @@ -202,7 +267,10 @@ class AvailableRuntimeVersions(Model): 'value': {'key': 'value', 'type': '[SupportedRuntimeVersion]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -210,8 +278,7 @@ def __init__(self, **kwargs) -> None: class BindingResource(ProxyResource): """Binding resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -219,9 +286,8 @@ class BindingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Binding resource - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceProperties + :param properties: Properties of the Binding resource. + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceProperties """ _validation = { @@ -237,34 +303,64 @@ class BindingResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'BindingResourceProperties'}, } - def __init__(self, *, properties=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["BindingResourceProperties"] = None, + **kwargs + ): super(BindingResource, self).__init__(**kwargs) self.properties = properties -class BindingResourceProperties(Model): +class BindingResourceCollection(msrest.serialization.Model): + """Object that includes an array of Binding resources and a possible link for next set. + + :param value: Collection of Binding resources. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BindingResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["BindingResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(BindingResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BindingResourceProperties(msrest.serialization.Model): """Binding resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar resource_name: The name of the bound resource + :ivar resource_name: The name of the bound resource. :vartype resource_name: str - :ivar resource_type: The standard Azure resource type of the bound - resource + :ivar resource_type: The standard Azure resource type of the bound resource. :vartype resource_type: str - :param resource_id: The Azure resource id of the bound resource + :param resource_id: The Azure resource id of the bound resource. :type resource_id: str - :param key: The key of the bound resource + :param key: The key of the bound resource. :type key: str - :param binding_parameters: Binding parameters of the Binding resource - :type binding_parameters: dict[str, object] - :ivar generated_properties: The generated Spring Boot property file for - this binding. The secret will be deducted. + :param binding_parameters: Binding parameters of the Binding resource. + :type binding_parameters: dict[str, any] + :ivar generated_properties: The generated Spring Boot property file for this binding. The + secret will be deducted. :vartype generated_properties: str - :ivar created_at: Creation time of the Binding resource + :ivar created_at: Creation time of the Binding resource. :vartype created_at: str - :ivar updated_at: Update time of the Binding resource + :ivar updated_at: Update time of the Binding resource. :vartype updated_at: str """ @@ -287,7 +383,14 @@ class BindingResourceProperties(Model): 'updated_at': {'key': 'updatedAt', 'type': 'str'}, } - def __init__(self, *, resource_id: str=None, key: str=None, binding_parameters=None, **kwargs) -> None: + def __init__( + self, + *, + resource_id: Optional[str] = None, + key: Optional[str] = None, + binding_parameters: Optional[Dict[str, Any]] = None, + **kwargs + ): super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -299,11 +402,10 @@ def __init__(self, *, resource_id: str=None, key: str=None, binding_parameters=N self.updated_at = None -class CertificateProperties(Model): +class CertificateProperties(msrest.serialization.Model): """Certificate resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -354,7 +456,14 @@ class CertificateProperties(Model): 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, } - def __init__(self, *, vault_uri: str, key_vault_cert_name: str, cert_version: str=None, **kwargs) -> None: + def __init__( + self, + *, + vault_uri: str, + key_vault_cert_name: str, + cert_version: Optional[str] = None, + **kwargs + ): super(CertificateProperties, self).__init__(**kwargs) self.thumbprint = None self.vault_uri = vault_uri @@ -371,8 +480,7 @@ def __init__(self, *, vault_uri: str, key_vault_cert_name: str, cert_version: st class CertificateResource(ProxyResource): """Certificate resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -381,8 +489,7 @@ class CertificateResource(ProxyResource): :ivar type: The type of the resource. :vartype type: str :param properties: Properties of the certificate resource payload. - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.CertificateProperties + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateProperties """ _validation = { @@ -398,54 +505,56 @@ class CertificateResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, } - def __init__(self, *, properties=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["CertificateProperties"] = None, + **kwargs + ): super(CertificateResource, self).__init__(**kwargs) self.properties = properties -class CloudError(Model): - """An error response from the service. +class CertificateResourceCollection(msrest.serialization.Model): + """Collection compose of certificate resources list and a possible link for next page. - :param error: An error response from the service. - :type error: ~azure.mgmt.appplatform.v2020_07_01.models.CloudErrorBody + :param value: The certificate resources list. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] + :param next_link: The link to next page of certificate list. + :type next_link: str """ _attribute_map = { - 'error': {'key': 'error', 'type': 'CloudErrorBody'}, - } - - def __init__(self, *, error=None, **kwargs) -> None: - super(CloudError, self).__init__(**kwargs) - self.error = error - - -class CloudErrorException(HttpOperationError): - """Server responsed with exception of type: 'CloudError'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + 'value': {'key': 'value', 'type': '[CertificateResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["CertificateResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(CertificateResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link -class CloudErrorBody(Model): +class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are - intended to be consumed programmatically. + :param code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. :type code: str - :param message: A message describing the error, intended to be suitable - for display in a user interface. + :param message: A message describing the error, intended to be suitable for display in a user + interface. :type message: str - :param target: The target of the particular error. For example, the name - of the property in error. + :param target: The target of the particular error. For example, the name of the property in + error. :type target: str :param details: A list of additional details about the error. - :type details: - list[~azure.mgmt.appplatform.v2020_07_01.models.CloudErrorBody] + :type details: list[~azure.mgmt.appplatform.v2020_07_01.models.CloudErrorBody] """ _attribute_map = { @@ -455,7 +564,15 @@ class CloudErrorBody(Model): 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, } - def __init__(self, *, code: str=None, message: str=None, target: str=None, details=None, **kwargs) -> None: + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["CloudErrorBody"]] = None, + **kwargs + ): super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -463,24 +580,21 @@ def __init__(self, *, code: str=None, message: str=None, target: str=None, detai self.details = details -class ClusterResourceProperties(Model): +class ClusterResourceProperties(msrest.serialization.Model): """Service properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Provisioning state of the Service. Possible - values include: 'Creating', 'Updating', 'Deleting', 'Deleted', - 'Succeeded', 'Failed', 'Moving', 'Moved', 'MoveFailed' + :ivar provisioning_state: Provisioning state of the Service. Possible values include: + "Creating", "Updating", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", "Moved", + "MoveFailed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_07_01.models.ProvisioningState - :param network_profile: Network profile of the Service - :type network_profile: - ~azure.mgmt.appplatform.v2020_07_01.models.NetworkProfile - :ivar version: Version of the Service + :param network_profile: Network profile of the Service. + :type network_profile: ~azure.mgmt.appplatform.v2020_07_01.models.NetworkProfile + :ivar version: Version of the Service. :vartype version: int - :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a - created resource + :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. :vartype service_id: str """ @@ -497,7 +611,12 @@ class ClusterResourceProperties(Model): 'service_id': {'key': 'serviceId', 'type': 'str'}, } - def __init__(self, *, network_profile=None, **kwargs) -> None: + def __init__( + self, + *, + network_profile: Optional["NetworkProfile"] = None, + **kwargs + ): super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.network_profile = network_profile @@ -505,19 +624,18 @@ def __init__(self, *, network_profile=None, **kwargs) -> None: self.service_id = None -class ConfigServerGitProperty(Model): +class ConfigServerGitProperty(msrest.serialization.Model): """Property of git. All required parameters must be populated in order to send to Azure. :param repositories: Repositories of git. - :type repositories: - list[~azure.mgmt.appplatform.v2020_07_01.models.GitPatternRepository] - :param uri: Required. URI of the repository + :type repositories: list[~azure.mgmt.appplatform.v2020_07_01.models.GitPatternRepository] + :param uri: Required. URI of the repository. :type uri: str - :param label: Label of the repository + :param label: Label of the repository. :type label: str - :param search_paths: Searching path of the repository + :param search_paths: Searching path of the repository. :type search_paths: list[str] :param username: Username of git repository basic auth. :type username: str @@ -550,7 +668,21 @@ class ConfigServerGitProperty(Model): 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, } - def __init__(self, *, uri: str, repositories=None, label: str=None, search_paths=None, username: str=None, password: str=None, host_key: str=None, host_key_algorithm: str=None, private_key: str=None, strict_host_key_checking: bool=None, **kwargs) -> None: + def __init__( + self, + *, + uri: str, + repositories: Optional[List["GitPatternRepository"]] = None, + label: Optional[str] = None, + search_paths: Optional[List[str]] = None, + username: Optional[str] = None, + password: Optional[str] = None, + host_key: Optional[str] = None, + host_key_algorithm: Optional[str] = None, + private_key: Optional[str] = None, + strict_host_key_checking: Optional[bool] = None, + **kwargs + ): super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = repositories self.uri = uri @@ -564,21 +696,19 @@ def __init__(self, *, uri: str, repositories=None, label: str=None, search_paths self.strict_host_key_checking = strict_host_key_checking -class ConfigServerProperties(Model): +class ConfigServerProperties(msrest.serialization.Model): """Config server git properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: State of the config server. Possible values - include: 'NotAvailable', 'Deleted', 'Failed', 'Succeeded', 'Updating' + :ivar provisioning_state: State of the config server. Possible values include: "NotAvailable", + "Deleted", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerState :param error: Error when apply config server settings. :type error: ~azure.mgmt.appplatform.v2020_07_01.models.Error :param config_server: Settings of config server. - :type config_server: - ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings + :type config_server: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings """ _validation = { @@ -591,7 +721,13 @@ class ConfigServerProperties(Model): 'config_server': {'key': 'configServer', 'type': 'ConfigServerSettings'}, } - def __init__(self, *, error=None, config_server=None, **kwargs) -> None: + def __init__( + self, + *, + error: Optional["Error"] = None, + config_server: Optional["ConfigServerSettings"] = None, + **kwargs + ): super(ConfigServerProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -601,8 +737,7 @@ def __init__(self, *, error=None, config_server=None, **kwargs) -> None: class ConfigServerResource(ProxyResource): """Config Server resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -610,9 +745,8 @@ class ConfigServerResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Config Server resource - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerProperties + :param properties: Properties of the Config Server resource. + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerProperties """ _validation = { @@ -628,36 +762,45 @@ class ConfigServerResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'ConfigServerProperties'}, } - def __init__(self, *, properties=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["ConfigServerProperties"] = None, + **kwargs + ): super(ConfigServerResource, self).__init__(**kwargs) self.properties = properties -class ConfigServerSettings(Model): +class ConfigServerSettings(msrest.serialization.Model): """The settings of config server. :param git_property: Property of git environment. - :type git_property: - ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerGitProperty + :type git_property: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerGitProperty """ _attribute_map = { 'git_property': {'key': 'gitProperty', 'type': 'ConfigServerGitProperty'}, } - def __init__(self, *, git_property=None, **kwargs) -> None: + def __init__( + self, + *, + git_property: Optional["ConfigServerGitProperty"] = None, + **kwargs + ): super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = git_property -class ConfigServerSettingsErrorRecord(Model): +class ConfigServerSettingsErrorRecord(msrest.serialization.Model): """Error record of the config server settings. - :param name: The name of the config server settings error record + :param name: The name of the config server settings error record. :type name: str - :param uri: The uri of the config server settings error record + :param uri: The uri of the config server settings error record. :type uri: str - :param messages: The detail error messages of the record + :param messages: The detail error messages of the record. :type messages: list[str] """ @@ -667,21 +810,27 @@ class ConfigServerSettingsErrorRecord(Model): 'messages': {'key': 'messages', 'type': '[str]'}, } - def __init__(self, *, name: str=None, uri: str=None, messages=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + uri: Optional[str] = None, + messages: Optional[List[str]] = None, + **kwargs + ): super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) self.name = name self.uri = uri self.messages = messages -class ConfigServerSettingsValidateResult(Model): +class ConfigServerSettingsValidateResult(msrest.serialization.Model): """Validation result for config server settings. - :param is_valid: Indicate if the config server settings are valid + :param is_valid: Indicate if the config server settings are valid. :type is_valid: bool - :param details: The detail validation results - :type details: - list[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsErrorRecord] + :param details: The detail validation results. + :type details: list[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsErrorRecord] """ _attribute_map = { @@ -689,17 +838,22 @@ class ConfigServerSettingsValidateResult(Model): 'details': {'key': 'details', 'type': '[ConfigServerSettingsErrorRecord]'}, } - def __init__(self, *, is_valid: bool=None, details=None, **kwargs) -> None: + def __init__( + self, + *, + is_valid: Optional[bool] = None, + details: Optional[List["ConfigServerSettingsErrorRecord"]] = None, + **kwargs + ): super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.details = details -class CustomDomainProperties(Model): +class CustomDomainProperties(msrest.serialization.Model): """Custom domain of app resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param thumbprint: The thumbprint of bound certificate. :type thumbprint: str @@ -719,7 +873,13 @@ class CustomDomainProperties(Model): 'cert_name': {'key': 'certName', 'type': 'str'}, } - def __init__(self, *, thumbprint: str=None, cert_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + thumbprint: Optional[str] = None, + cert_name: Optional[str] = None, + **kwargs + ): super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = thumbprint self.app_name = None @@ -729,8 +889,7 @@ def __init__(self, *, thumbprint: str=None, cert_name: str=None, **kwargs) -> No class CustomDomainResource(ProxyResource): """Custom domain resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -739,8 +898,7 @@ class CustomDomainResource(ProxyResource): :ivar type: The type of the resource. :vartype type: str :param properties: Properties of the custom domain resource. - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainProperties + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainProperties """ _validation = { @@ -756,17 +914,48 @@ class CustomDomainResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'CustomDomainProperties'}, } - def __init__(self, *, properties=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["CustomDomainProperties"] = None, + **kwargs + ): super(CustomDomainResource, self).__init__(**kwargs) self.properties = properties -class CustomDomainValidatePayload(Model): +class CustomDomainResourceCollection(msrest.serialization.Model): + """Collection compose of a custom domain resources list and a possible link for next page. + + :param value: The custom domain resources list. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] + :param next_link: The link to next page of custom domain list. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CustomDomainResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["CustomDomainResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(CustomDomainResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CustomDomainValidatePayload(msrest.serialization.Model): """Custom domain validate payload. All required parameters must be populated in order to send to Azure. - :param name: Required. Name to be validated + :param name: Required. Name to be validated. :type name: str """ @@ -778,12 +967,17 @@ class CustomDomainValidatePayload(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, name: str, **kwargs) -> None: + def __init__( + self, + *, + name: str, + **kwargs + ): super(CustomDomainValidatePayload, self).__init__(**kwargs) self.name = name -class CustomDomainValidateResult(Model): +class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. :param is_valid: Indicates if domain name is valid. @@ -797,27 +991,32 @@ class CustomDomainValidateResult(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, is_valid: bool=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + is_valid: Optional[bool] = None, + message: Optional[str] = None, + **kwargs + ): super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.message = message -class DeploymentInstance(Model): +class DeploymentInstance(msrest.serialization.Model): """Deployment instance payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Name of the deployment instance + :ivar name: Name of the deployment instance. :vartype name: str - :ivar status: Status of the deployment instance + :ivar status: Status of the deployment instance. :vartype status: str - :ivar reason: Failed reason of the deployment instance + :ivar reason: Failed reason of the deployment instance. :vartype reason: str - :ivar discovery_status: Discovery status of the deployment instance + :ivar discovery_status: Discovery status of the deployment instance. :vartype discovery_status: str - :ivar start_time: Start time of the deployment instance + :ivar start_time: Start time of the deployment instance. :vartype start_time: str """ @@ -837,7 +1036,10 @@ class DeploymentInstance(Model): 'start_time': {'key': 'startTime', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -849,8 +1051,7 @@ def __init__(self, **kwargs) -> None: class DeploymentResource(ProxyResource): """Deployment resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -858,10 +1059,9 @@ class DeploymentResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Deployment resource - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource + :param properties: Properties of the Deployment resource. + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceProperties + :param sku: Sku of the Deployment resource. :type sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku """ @@ -879,41 +1079,69 @@ class DeploymentResource(ProxyResource): 'sku': {'key': 'sku', 'type': 'Sku'}, } - def __init__(self, *, properties=None, sku=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["DeploymentResourceProperties"] = None, + sku: Optional["Sku"] = None, + **kwargs + ): super(DeploymentResource, self).__init__(**kwargs) self.properties = properties self.sku = sku -class DeploymentResourceProperties(Model): +class DeploymentResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :param value: Collection of Deployment resources. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["DeploymentResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(DeploymentResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DeploymentResourceProperties(msrest.serialization.Model): """Deployment resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param source: Uploaded source information of the deployment. :type source: ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceInfo - :ivar app_name: App name of the deployment + :ivar app_name: App name of the deployment. :vartype app_name: str - :param deployment_settings: Deployment settings of the Deployment - :type deployment_settings: - ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Possible - values include: 'Creating', 'Updating', 'Succeeded', 'Failed' + :param deployment_settings: Deployment settings of the Deployment. + :type deployment_settings: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentSettings + :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: + "Creating", "Updating", "Succeeded", "Failed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Possible values include: - 'Unknown', 'Stopped', 'Running', 'Failed', 'Allocating', 'Upgrading', - 'Compiling' - :vartype status: str or - ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceStatus - :ivar active: Indicates whether the Deployment is active + :ivar status: Status of the Deployment. Possible values include: "Unknown", "Stopped", + "Running", "Failed", "Allocating", "Upgrading", "Compiling". + :vartype status: str or ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceStatus + :ivar active: Indicates whether the Deployment is active. :vartype active: bool - :ivar created_time: Date time when the resource is created - :vartype created_time: datetime - :ivar instances: Collection of instances belong to the Deployment - :vartype instances: - list[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentInstance] + :ivar created_time: Date time when the resource is created. + :vartype created_time: ~datetime.datetime + :ivar instances: Collection of instances belong to the Deployment. + :vartype instances: list[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentInstance] """ _validation = { @@ -936,7 +1164,13 @@ class DeploymentResourceProperties(Model): 'instances': {'key': 'instances', 'type': '[DeploymentInstance]'}, } - def __init__(self, *, source=None, deployment_settings=None, **kwargs) -> None: + def __init__( + self, + *, + source: Optional["UserSourceInfo"] = None, + deployment_settings: Optional["DeploymentSettings"] = None, + **kwargs + ): super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = source self.app_name = None @@ -948,26 +1182,23 @@ def __init__(self, *, source=None, deployment_settings=None, **kwargs) -> None: self.instances = None -class DeploymentSettings(Model): +class DeploymentSettings(msrest.serialization.Model): """Deployment settings payload. - :param cpu: Required CPU, basic tier should be 1, standard tier should be - in range (1, 4). Default value: 1 . + :param cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). :type cpu: int - :param memory_in_gb: Required Memory size in GB, basic tier should be in - range (1, 2), standard tier should be in range (1, 8). Default value: 1 . + :param memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), standard + tier should be in range (1, 8). :type memory_in_gb: int - :param jvm_options: JVM parameter + :param jvm_options: JVM parameter. :type jvm_options: str - :param net_core_main_entry_path: The path to the .NET executable relative - to zip root + :param net_core_main_entry_path: The path to the .NET executable relative to zip root. :type net_core_main_entry_path: str - :param environment_variables: Collection of environment variables + :param environment_variables: Collection of environment variables. :type environment_variables: dict[str, str] - :param runtime_version: Runtime version. Possible values include: - 'Java_8', 'Java_11', 'NetCore_31' - :type runtime_version: str or - ~azure.mgmt.appplatform.v2020_07_01.models.RuntimeVersion + :param runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :type runtime_version: str or ~azure.mgmt.appplatform.v2020_07_01.models.RuntimeVersion """ _attribute_map = { @@ -979,7 +1210,17 @@ class DeploymentSettings(Model): 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, } - def __init__(self, *, cpu: int=1, memory_in_gb: int=1, jvm_options: str=None, net_core_main_entry_path: str=None, environment_variables=None, runtime_version=None, **kwargs) -> None: + def __init__( + self, + *, + cpu: Optional[int] = 1, + memory_in_gb: Optional[int] = 1, + jvm_options: Optional[str] = None, + net_core_main_entry_path: Optional[str] = None, + environment_variables: Optional[Dict[str, str]] = None, + runtime_version: Optional[Union[str, "RuntimeVersion"]] = "Java_8", + **kwargs + ): super(DeploymentSettings, self).__init__(**kwargs) self.cpu = cpu self.memory_in_gb = memory_in_gb @@ -989,7 +1230,7 @@ def __init__(self, *, cpu: int=1, memory_in_gb: int=1, jvm_options: str=None, ne self.runtime_version = runtime_version -class Error(Model): +class Error(msrest.serialization.Model): """The error code compose of code and message. :param code: The code of error. @@ -1003,26 +1244,32 @@ class Error(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): super(Error, self).__init__(**kwargs) self.code = code self.message = message -class GitPatternRepository(Model): +class GitPatternRepository(msrest.serialization.Model): """Git repository property payload. All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the repository + :param name: Required. Name of the repository. :type name: str - :param pattern: Collection of pattern of the repository + :param pattern: Collection of pattern of the repository. :type pattern: list[str] - :param uri: Required. URI of the repository + :param uri: Required. URI of the repository. :type uri: str - :param label: Label of the repository + :param label: Label of the repository. :type label: str - :param search_paths: Searching path of the repository + :param search_paths: Searching path of the repository. :type search_paths: list[str] :param username: Username of git repository basic auth. :type username: str @@ -1057,7 +1304,22 @@ class GitPatternRepository(Model): 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, } - def __init__(self, *, name: str, uri: str, pattern=None, label: str=None, search_paths=None, username: str=None, password: str=None, host_key: str=None, host_key_algorithm: str=None, private_key: str=None, strict_host_key_checking: bool=None, **kwargs) -> None: + def __init__( + self, + *, + name: str, + uri: str, + pattern: Optional[List[str]] = None, + label: Optional[str] = None, + search_paths: Optional[List[str]] = None, + username: Optional[str] = None, + password: Optional[str] = None, + host_key: Optional[str] = None, + host_key_algorithm: Optional[str] = None, + private_key: Optional[str] = None, + strict_host_key_checking: Optional[bool] = None, + **kwargs + ): super(GitPatternRepository, self).__init__(**kwargs) self.name = name self.pattern = pattern @@ -1072,12 +1334,12 @@ def __init__(self, *, name: str, uri: str, pattern=None, label: str=None, search self.strict_host_key_checking = strict_host_key_checking -class LogFileUrlResponse(Model): +class LogFileUrlResponse(msrest.serialization.Model): """Log file URL payload. All required parameters must be populated in order to send to Azure. - :param url: Required. URL of the log file + :param url: Required. URL of the log file. :type url: str """ @@ -1089,19 +1351,24 @@ class LogFileUrlResponse(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, *, url: str, **kwargs) -> None: + def __init__( + self, + *, + url: str, + **kwargs + ): super(LogFileUrlResponse, self).__init__(**kwargs) self.url = url -class LogSpecification(Model): +class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :param name: Name of the log + :param name: Name of the log. :type name: str - :param display_name: Localized friendly display name of the log + :param display_name: Localized friendly display name of the log. :type display_name: str - :param blob_duration: Blob duration of the log + :param blob_duration: Blob duration of the log. :type blob_duration: str """ @@ -1111,23 +1378,29 @@ class LogSpecification(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, *, name: str=None, display_name: str=None, blob_duration: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name self.blob_duration = blob_duration -class ManagedIdentityProperties(Model): +class ManagedIdentityProperties(msrest.serialization.Model): """Managed identity properties retrieved from ARM request headers. - :param type: Type of the managed identity. Possible values include: - 'None', 'SystemAssigned', 'UserAssigned', 'SystemAssigned,UserAssigned' - :type type: str or - ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityType - :param principal_id: Principal Id + :param type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :type type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityType + :param principal_id: Principal Id. :type principal_id: str - :param tenant_id: Tenant Id + :param tenant_id: Tenant Id. :type tenant_id: str """ @@ -1137,60 +1410,78 @@ class ManagedIdentityProperties(Model): 'tenant_id': {'key': 'tenantId', 'type': 'str'}, } - def __init__(self, *, type=None, principal_id: str=None, tenant_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + type: Optional[Union[str, "ManagedIdentityType"]] = None, + principal_id: Optional[str] = None, + tenant_id: Optional[str] = None, + **kwargs + ): super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = type self.principal_id = principal_id self.tenant_id = tenant_id -class MetricDimension(Model): +class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension + :param name: Name of the dimension. :type name: str - :param display_name: Localized friendly display name of the dimension + :param display_name: Localized friendly display name of the dimension. :type display_name: str + :param to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :type to_be_exported_for_shoebox: bool """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'display_name': {'key': 'displayName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } - def __init__(self, *, name: str=None, display_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + **kwargs + ): super(MetricDimension, self).__init__(**kwargs) self.name = name self.display_name = display_name + self.to_be_exported_for_shoebox = to_be_exported_for_shoebox -class MetricSpecification(Model): +class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :param name: Name of the metric + :param name: Name of the metric. :type name: str - :param display_name: Localized friendly display name of the metric + :param display_name: Localized friendly display name of the metric. :type display_name: str - :param display_description: Localized friendly description of the metric + :param display_description: Localized friendly description of the metric. :type display_description: str - :param unit: Unit that makes sense for the metric + :param unit: Unit that makes sense for the metric. :type unit: str - :param category: Name of the metric category that the metric belongs to. A - metric can only belong to a single category. + :param category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. :type category: str - :param aggregation_type: Only provide one value for this field. Valid - values: Average, Minimum, Maximum, Total, Count. + :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + Maximum, Total, Count. :type aggregation_type: str - :param supported_aggregation_types: Supported aggregation types + :param supported_aggregation_types: Supported aggregation types. :type supported_aggregation_types: list[str] - :param supported_time_grain_types: Supported time grain types + :param supported_time_grain_types: Supported time grain types. :type supported_time_grain_types: list[str] - :param fill_gap_with_zero: Optional. If set to true, then zero will be - returned for time duration where no metric is emitted/published. + :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. :type fill_gap_with_zero: bool - :param dimensions: Dimensions of the metric - :type dimensions: - list[~azure.mgmt.appplatform.v2020_07_01.models.MetricDimension] + :param dimensions: Dimensions of the metric. + :type dimensions: list[~azure.mgmt.appplatform.v2020_07_01.models.MetricDimension] """ _attribute_map = { @@ -1206,7 +1497,21 @@ class MetricSpecification(Model): 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, } - def __init__(self, *, name: str=None, display_name: str=None, display_description: str=None, unit: str=None, category: str=None, aggregation_type: str=None, supported_aggregation_types=None, supported_time_grain_types=None, fill_gap_with_zero: bool=None, dimensions=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + category: Optional[str] = None, + aggregation_type: Optional[str] = None, + supported_aggregation_types: Optional[List[str]] = None, + supported_time_grain_types: Optional[List[str]] = None, + fill_gap_with_zero: Optional[bool] = None, + dimensions: Optional[List["MetricDimension"]] = None, + **kwargs + ): super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1220,22 +1525,20 @@ def __init__(self, *, name: str=None, display_name: str=None, display_descriptio self.dimensions = dimensions -class MonitoringSettingProperties(Model): +class MonitoringSettingProperties(msrest.serialization.Model): """Monitoring Setting properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: State of the Monitoring Setting. Possible values - include: 'NotAvailable', 'Failed', 'Succeeded', 'Updating' + :ivar provisioning_state: State of the Monitoring Setting. Possible values include: + "NotAvailable", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingState :param error: Error when apply Monitoring Setting changes. :type error: ~azure.mgmt.appplatform.v2020_07_01.models.Error - :param trace_enabled: Indicates whether enable the trace functionality + :param trace_enabled: Indicates whether enable the trace functionality. :type trace_enabled: bool - :param app_insights_instrumentation_key: Target application insight - instrumentation key + :param app_insights_instrumentation_key: Target application insight instrumentation key. :type app_insights_instrumentation_key: str """ @@ -1250,7 +1553,14 @@ class MonitoringSettingProperties(Model): 'app_insights_instrumentation_key': {'key': 'appInsightsInstrumentationKey', 'type': 'str'}, } - def __init__(self, *, error=None, trace_enabled: bool=None, app_insights_instrumentation_key: str=None, **kwargs) -> None: + def __init__( + self, + *, + error: Optional["Error"] = None, + trace_enabled: Optional[bool] = None, + app_insights_instrumentation_key: Optional[str] = None, + **kwargs + ): super(MonitoringSettingProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -1261,8 +1571,7 @@ def __init__(self, *, error=None, trace_enabled: bool=None, app_insights_instrum class MonitoringSettingResource(ProxyResource): """Monitoring Setting resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -1270,9 +1579,8 @@ class MonitoringSettingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Monitoring Setting resource - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingProperties + :param properties: Properties of the Monitoring Setting resource. + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingProperties """ _validation = { @@ -1288,19 +1596,24 @@ class MonitoringSettingResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'MonitoringSettingProperties'}, } - def __init__(self, *, properties=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["MonitoringSettingProperties"] = None, + **kwargs + ): super(MonitoringSettingResource, self).__init__(**kwargs) self.properties = properties -class NameAvailability(Model): +class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :param name_available: Indicates whether the name is available + :param name_available: Indicates whether the name is available. :type name_available: bool - :param reason: Reason why the name is not available + :param reason: Reason why the name is not available. :type reason: str - :param message: Message why the name is not available + :param message: Message why the name is not available. :type message: str """ @@ -1310,21 +1623,28 @@ class NameAvailability(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, name_available: bool=None, reason: str=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): super(NameAvailability, self).__init__(**kwargs) self.name_available = name_available self.reason = reason self.message = message -class NameAvailabilityParameters(Model): +class NameAvailabilityParameters(msrest.serialization.Model): """Name availability parameters payload. All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the resource to check name availability + :param type: Required. Type of the resource to check name availability. :type type: str - :param name: Required. Name to be checked + :param name: Required. Name to be checked. :type name: str """ @@ -1338,44 +1658,45 @@ class NameAvailabilityParameters(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, type: str, name: str, **kwargs) -> None: + def __init__( + self, + *, + type: str, + name: str, + **kwargs + ): super(NameAvailabilityParameters, self).__init__(**kwargs) self.type = type self.name = name -class NetworkProfile(Model): +class NetworkProfile(msrest.serialization.Model): """Service network profile payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param service_runtime_subnet_id: Fully qualified resource Id of the - subnet to host Azure Spring Cloud Service Runtime + :param service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. :type service_runtime_subnet_id: str - :param app_subnet_id: Fully qualified resource Id of the subnet to host - Azure Spring Cloud Apps + :param app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. :type app_subnet_id: str - :param service_cidr: Azure Spring Cloud service reserved CIDR + :param service_cidr: Azure Spring Cloud service reserved CIDR. :type service_cidr: str - :param service_runtime_network_resource_group: Name of the resource group - containing network resources of Azure Spring Cloud Service Runtime + :param service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. :type service_runtime_network_resource_group: str - :param app_network_resource_group: Name of the resource group containing - network resources of Azure Spring Cloud Apps + :param app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. :type app_network_resource_group: str - :ivar outbound_ips: Desired outbound IP resources for Azure Spring Cloud - instance. - :vartype outbound_ips: - ~azure.mgmt.appplatform.v2020_07_01.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure - Spring Cloud instance. - :vartype required_traffics: - list[~azure.mgmt.appplatform.v2020_07_01.models.RequiredTraffic] + :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Cloud instance. + :vartype outbound_i_ps: ~azure.mgmt.appplatform.v2020_07_01.models.NetworkProfileOutboundIPs + :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Cloud instance. + :vartype required_traffics: list[~azure.mgmt.appplatform.v2020_07_01.models.RequiredTraffic] """ _validation = { - 'outbound_ips': {'readonly': True}, + 'outbound_i_ps': {'readonly': True}, 'required_traffics': {'readonly': True}, } @@ -1385,58 +1706,68 @@ class NetworkProfile(Model): 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, 'service_runtime_network_resource_group': {'key': 'serviceRuntimeNetworkResourceGroup', 'type': 'str'}, 'app_network_resource_group': {'key': 'appNetworkResourceGroup', 'type': 'str'}, - 'outbound_ips': {'key': 'outboundIPs', 'type': 'NetworkProfileOutboundIPs'}, + 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'NetworkProfileOutboundIPs'}, 'required_traffics': {'key': 'requiredTraffics', 'type': '[RequiredTraffic]'}, } - def __init__(self, *, service_runtime_subnet_id: str=None, app_subnet_id: str=None, service_cidr: str=None, service_runtime_network_resource_group: str=None, app_network_resource_group: str=None, **kwargs) -> None: + def __init__( + self, + *, + service_runtime_subnet_id: Optional[str] = None, + app_subnet_id: Optional[str] = None, + service_cidr: Optional[str] = None, + service_runtime_network_resource_group: Optional[str] = None, + app_network_resource_group: Optional[str] = None, + **kwargs + ): super(NetworkProfile, self).__init__(**kwargs) self.service_runtime_subnet_id = service_runtime_subnet_id self.app_subnet_id = app_subnet_id self.service_cidr = service_cidr self.service_runtime_network_resource_group = service_runtime_network_resource_group self.app_network_resource_group = app_network_resource_group - self.outbound_ips = None + self.outbound_i_ps = None self.required_traffics = None -class NetworkProfileOutboundIPs(Model): +class NetworkProfileOutboundIPs(msrest.serialization.Model): """Desired outbound IP resources for Azure Spring Cloud instance. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar public_ips: A list of public IP addresses. - :vartype public_ips: list[str] + :ivar public_i_ps: A list of public IP addresses. + :vartype public_i_ps: list[str] """ _validation = { - 'public_ips': {'readonly': True}, + 'public_i_ps': {'readonly': True}, } _attribute_map = { - 'public_ips': {'key': 'publicIPs', 'type': '[str]'}, + 'public_i_ps': {'key': 'publicIPs', 'type': '[str]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(NetworkProfileOutboundIPs, self).__init__(**kwargs) - self.public_ips = None + self.public_i_ps = None -class OperationDetail(Model): +class OperationDetail(msrest.serialization.Model): """Operation detail payload. - :param name: Name of the operation + :param name: Name of the operation. :type name: str - :param is_data_action: Indicates whether the operation is a data action + :param is_data_action: Indicates whether the operation is a data action. :type is_data_action: bool - :param display: Display of the operation + :param display: Display of the operation. :type display: ~azure.mgmt.appplatform.v2020_07_01.models.OperationDisplay - :param origin: Origin of the operation + :param origin: Origin of the operation. :type origin: str - :param properties: Properties of the operation - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.OperationProperties + :param properties: Properties of the operation. + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.OperationProperties """ _attribute_map = { @@ -1447,7 +1778,16 @@ class OperationDetail(Model): 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } - def __init__(self, *, name: str=None, is_data_action: bool=None, display=None, origin: str=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + properties: Optional["OperationProperties"] = None, + **kwargs + ): super(OperationDetail, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action @@ -1456,16 +1796,16 @@ def __init__(self, *, name: str=None, is_data_action: bool=None, display=None, o self.properties = properties -class OperationDisplay(Model): +class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :param provider: Resource provider of the operation + :param provider: Resource provider of the operation. :type provider: str - :param resource: Resource of the operation + :param resource: Resource of the operation. :type resource: str - :param operation: Localized friendly name for the operation + :param operation: Localized friendly name for the operation. :type operation: str - :param description: Localized friendly description for the operation + :param description: Localized friendly description for the operation. :type description: str """ @@ -1476,7 +1816,15 @@ class OperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1484,34 +1832,37 @@ def __init__(self, *, provider: str=None, resource: str=None, operation: str=Non self.description = description -class OperationProperties(Model): +class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :param service_specification: Service specifications of the operation - :type service_specification: - ~azure.mgmt.appplatform.v2020_07_01.models.ServiceSpecification + :param service_specification: Service specifications of the operation. + :type service_specification: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceSpecification """ _attribute_map = { 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, *, service_specification=None, **kwargs) -> None: + def __init__( + self, + *, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification -class PersistentDisk(Model): +class PersistentDisk(msrest.serialization.Model): """Persistent disk payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param size_in_gb: Size of the persistent disk in GB + :param size_in_gb: Size of the persistent disk in GB. :type size_in_gb: int - :ivar used_in_gb: Size of the used persistent disk in GB + :ivar used_in_gb: Size of the used persistent disk in GB. :vartype used_in_gb: int - :param mount_path: Mount path of the persistent disk + :param mount_path: Mount path of the persistent disk. :type mount_path: str """ @@ -1526,22 +1877,27 @@ class PersistentDisk(Model): 'mount_path': {'key': 'mountPath', 'type': 'str'}, } - def __init__(self, *, size_in_gb: int=None, mount_path: str=None, **kwargs) -> None: + def __init__( + self, + *, + size_in_gb: Optional[int] = None, + mount_path: Optional[str] = None, + **kwargs + ): super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.used_in_gb = None self.mount_path = mount_path -class RegenerateTestKeyRequestPayload(Model): +class RegenerateTestKeyRequestPayload(msrest.serialization.Model): """Regenerate test key request payload. All required parameters must be populated in order to send to Azure. - :param key_type: Required. Type of the test key. Possible values include: - 'Primary', 'Secondary' - :type key_type: str or - ~azure.mgmt.appplatform.v2020_07_01.models.TestKeyType + :param key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :type key_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.TestKeyType """ _validation = { @@ -1552,29 +1908,32 @@ class RegenerateTestKeyRequestPayload(Model): 'key_type': {'key': 'keyType', 'type': 'str'}, } - def __init__(self, *, key_type, **kwargs) -> None: + def __init__( + self, + *, + key_type: Union[str, "TestKeyType"], + **kwargs + ): super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) self.key_type = key_type -class RequiredTraffic(Model): +class RequiredTraffic(msrest.serialization.Model): """Required inbound or outbound traffic for Azure Spring Cloud instance. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar protocol: The protocol of required traffic + :ivar protocol: The protocol of required traffic. :vartype protocol: str - :ivar port: The port of required traffic + :ivar port: The port of required traffic. :vartype port: int - :ivar ips: The ip list of required traffic + :ivar ips: The ip list of required traffic. :vartype ips: list[str] - :ivar fqdns: The FQDN list of required traffic + :ivar fqdns: The FQDN list of required traffic. :vartype fqdns: list[str] - :ivar direction: The direction of required traffic. Possible values - include: 'Inbound', 'Outbound' - :vartype direction: str or - ~azure.mgmt.appplatform.v2020_07_01.models.TrafficDirection + :ivar direction: The direction of required traffic. Possible values include: "Inbound", + "Outbound". + :vartype direction: str or ~azure.mgmt.appplatform.v2020_07_01.models.TrafficDirection """ _validation = { @@ -1593,7 +1952,10 @@ class RequiredTraffic(Model): 'direction': {'key': 'direction', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -1602,7 +1964,7 @@ def __init__(self, **kwargs) -> None: self.direction = None -class ResourceSku(Model): +class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. :param resource_type: Gets the type of resource the SKU applies to. @@ -1615,15 +1977,12 @@ class ResourceSku(Model): :type capacity: ~azure.mgmt.appplatform.v2020_07_01.models.SkuCapacity :param locations: Gets the set of locations that the SKU is available. :type locations: list[str] - :param location_info: Gets a list of locations and availability zones in - those locations where the SKU is available. - :type location_info: - list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuLocationInfo] - :param restrictions: Gets the restrictions because of which SKU cannot be - used. This is + :param location_info: Gets a list of locations and availability zones in those locations where + the SKU is available. + :type location_info: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuLocationInfo] + :param restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: - list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictions] + :type restrictions: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictions] """ _attribute_map = { @@ -1636,7 +1995,18 @@ class ResourceSku(Model): 'restrictions': {'key': 'restrictions', 'type': '[ResourceSkuRestrictions]'}, } - def __init__(self, *, resource_type: str=None, name: str=None, tier: str=None, capacity=None, locations=None, location_info=None, restrictions=None, **kwargs) -> None: + def __init__( + self, + *, + resource_type: Optional[str] = None, + name: Optional[str] = None, + tier: Optional[str] = None, + capacity: Optional["SkuCapacity"] = None, + locations: Optional[List[str]] = None, + location_info: Optional[List["ResourceSkuLocationInfo"]] = None, + restrictions: Optional[List["ResourceSkuRestrictions"]] = None, + **kwargs + ): super(ResourceSku, self).__init__(**kwargs) self.resource_type = resource_type self.name = name @@ -1647,7 +2017,7 @@ def __init__(self, *, resource_type: str=None, name: str=None, tier: str=None, c self.restrictions = restrictions -class ResourceSkuCapabilities(Model): +class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. :param name: Gets an invariant to describe the feature. @@ -1661,23 +2031,54 @@ class ResourceSkuCapabilities(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, *, name: str=None, value: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = name self.value = value -class ResourceSkuLocationInfo(Model): +class ResourceSkuCollection(msrest.serialization.Model): + """Object that includes an array of Azure Spring Cloud SKU and a possible link for next set. + + :param value: Collection of resource SKU. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSku] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceSku]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ResourceSku"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ResourceSkuCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ResourceSkuLocationInfo(msrest.serialization.Model): """Locations and availability zones where the SKU is available. - :param location: Gets location of the SKU + :param location: Gets location of the SKU. :type location: str :param zones: Gets list of availability zones where the SKU is supported. :type zones: list[str] - :param zone_details: Gets details of capabilities available to a SKU in - specific zones. - :type zone_details: - list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuZoneDetails] + :param zone_details: Gets details of capabilities available to a SKU in specific zones. + :type zone_details: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuZoneDetails] """ _attribute_map = { @@ -1686,17 +2087,24 @@ class ResourceSkuLocationInfo(Model): 'zone_details': {'key': 'zoneDetails', 'type': '[ResourceSkuZoneDetails]'}, } - def __init__(self, *, location: str=None, zones=None, zone_details=None, **kwargs) -> None: + def __init__( + self, + *, + location: Optional[str] = None, + zones: Optional[List[str]] = None, + zone_details: Optional[List["ResourceSkuZoneDetails"]] = None, + **kwargs + ): super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = location self.zones = zones self.zone_details = zone_details -class ResourceSkuRestrictionInfo(Model): +class ResourceSkuRestrictionInfo(msrest.serialization.Model): """Information about the restriction where the SKU cannot be used. - :param locations: Gets locations where the SKU is restricted + :param locations: Gets locations where the SKU is restricted. :type locations: list[str] :param zones: Gets list of availability zones where the SKU is restricted. :type zones: list[str] @@ -1707,29 +2115,33 @@ class ResourceSkuRestrictionInfo(Model): 'zones': {'key': 'zones', 'type': '[str]'}, } - def __init__(self, *, locations=None, zones=None, **kwargs) -> None: + def __init__( + self, + *, + locations: Optional[List[str]] = None, + zones: Optional[List[str]] = None, + **kwargs + ): super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = locations self.zones = zones -class ResourceSkuRestrictions(Model): +class ResourceSkuRestrictions(msrest.serialization.Model): """Restrictions where the SKU cannot be used. - :param type: Gets the type of restrictions. Possible values include: - 'Location', 'Zone' - :type type: str or - ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsType - :param values: Gets the value of restrictions. If the restriction type is - set to + :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". + :type type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsType + :param values: Gets the value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. :type values: list[str] - :param restriction_info: Gets the information about the restriction where - the SKU cannot be used. - :type restriction_info: - ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionInfo - :param reason_code: Gets the reason for restriction. Possible values - include: 'QuotaId', 'NotAvailableForSubscription' + :param restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :type restriction_info: ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionInfo + :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". :type reason_code: str or ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsReasonCode """ @@ -1741,7 +2153,15 @@ class ResourceSkuRestrictions(Model): 'reason_code': {'key': 'reasonCode', 'type': 'str'}, } - def __init__(self, *, type=None, values=None, restriction_info=None, reason_code=None, **kwargs) -> None: + def __init__( + self, + *, + type: Optional[Union[str, "ResourceSkuRestrictionsType"]] = None, + values: Optional[List[str]] = None, + restriction_info: Optional["ResourceSkuRestrictionInfo"] = None, + reason_code: Optional[Union[str, "ResourceSkuRestrictionsReasonCode"]] = None, + **kwargs + ): super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = type self.values = values @@ -1749,17 +2169,15 @@ def __init__(self, *, type=None, values=None, restriction_info=None, reason_code self.reason_code = reason_code -class ResourceSkuZoneDetails(Model): +class ResourceSkuZoneDetails(msrest.serialization.Model): """Details of capabilities available to a SKU in specific zones. :param name: Gets the set of zones that the SKU is available in with the specified capabilities. :type name: list[str] - :param capabilities: Gets a list of capabilities that are available for - the SKU in the + :param capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. - :type capabilities: - list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCapabilities] + :type capabilities: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCapabilities] """ _attribute_map = { @@ -1767,18 +2185,24 @@ class ResourceSkuZoneDetails(Model): 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, } - def __init__(self, *, name=None, capabilities=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[List[str]] = None, + capabilities: Optional[List["ResourceSkuCapabilities"]] = None, + **kwargs + ): super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = name self.capabilities = capabilities -class ResourceUploadDefinition(Model): +class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :param relative_path: Source relative path + :param relative_path: Source relative path. :type relative_path: str - :param upload_url: Upload URL + :param upload_url: Upload URL. :type upload_url: str """ @@ -1787,7 +2211,13 @@ class ResourceUploadDefinition(Model): 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, } - def __init__(self, *, relative_path: str=None, upload_url: str=None, **kwargs) -> None: + def __init__( + self, + *, + relative_path: Optional[str] = None, + upload_url: Optional[str] = None, + **kwargs + ): super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = relative_path self.upload_url = upload_url @@ -1796,8 +2226,7 @@ def __init__(self, *, relative_path: str=None, upload_url: str=None, **kwargs) - class TrackedResource(Resource): """The resource model definition for a ARM tracked top level resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -1807,7 +2236,7 @@ class TrackedResource(Resource): :vartype type: str :param location: The GEO location of the resource. :type location: str - :param tags: Tags of the service which is a list of key value pairs that + :param tags: A set of tags. Tags of the service which is a list of key value pairs that describe the resource. :type tags: dict[str, str] """ @@ -1826,7 +2255,13 @@ class TrackedResource(Resource): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, location: str=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(TrackedResource, self).__init__(**kwargs) self.location = location self.tags = tags @@ -1835,8 +2270,7 @@ def __init__(self, *, location: str=None, tags=None, **kwargs) -> None: class ServiceResource(TrackedResource): """Service resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -1846,13 +2280,12 @@ class ServiceResource(TrackedResource): :vartype type: str :param location: The GEO location of the resource. :type location: str - :param tags: Tags of the service which is a list of key value pairs that + :param tags: A set of tags. Tags of the service which is a list of key value pairs that describe the resource. :type tags: dict[str, str] - :param properties: Properties of the Service resource - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.ClusterResourceProperties - :param sku: Sku of the Service resource + :param properties: Properties of the Service resource. + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.ClusterResourceProperties + :param sku: Sku of the Service resource. :type sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku """ @@ -1872,20 +2305,53 @@ class ServiceResource(TrackedResource): 'sku': {'key': 'sku', 'type': 'Sku'}, } - def __init__(self, *, location: str=None, tags=None, properties=None, sku=None, **kwargs) -> None: + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional["ClusterResourceProperties"] = None, + sku: Optional["Sku"] = None, + **kwargs + ): super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.properties = properties self.sku = sku -class ServiceSpecification(Model): +class ServiceResourceList(msrest.serialization.Model): + """Object that includes an array of Service resources and a possible link for next set. + + :param value: Collection of Service resources. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ServiceResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ServiceResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ServiceResourceList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :param log_specifications: Specifications of the Log for Azure Monitoring - :type log_specifications: - list[~azure.mgmt.appplatform.v2020_07_01.models.LogSpecification] - :param metric_specifications: Specifications of the Metrics for Azure - Monitoring + :param log_specifications: Specifications of the Log for Azure Monitoring. + :type log_specifications: list[~azure.mgmt.appplatform.v2020_07_01.models.LogSpecification] + :param metric_specifications: Specifications of the Metrics for Azure Monitoring. :type metric_specifications: list[~azure.mgmt.appplatform.v2020_07_01.models.MetricSpecification] """ @@ -1895,20 +2361,26 @@ class ServiceSpecification(Model): 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, } - def __init__(self, *, log_specifications=None, metric_specifications=None, **kwargs) -> None: + def __init__( + self, + *, + log_specifications: Optional[List["LogSpecification"]] = None, + metric_specifications: Optional[List["MetricSpecification"]] = None, + **kwargs + ): super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications -class Sku(Model): +class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :param name: Name of the Sku + :param name: Name of the Sku. :type name: str - :param tier: Tier of the Sku + :param tier: Tier of the Sku. :type tier: str - :param capacity: Current capacity of the target resource + :param capacity: Current capacity of the target resource. :type capacity: int """ @@ -1918,14 +2390,21 @@ class Sku(Model): 'capacity': {'key': 'capacity', 'type': 'int'}, } - def __init__(self, *, name: str=None, tier: str=None, capacity: int=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + tier: Optional[str] = None, + capacity: Optional[int] = None, + **kwargs + ): super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier self.capacity = capacity -class SkuCapacity(Model): +class SkuCapacity(msrest.serialization.Model): """The SKU capacity. All required parameters must be populated in order to send to Azure. @@ -1936,10 +2415,9 @@ class SkuCapacity(Model): :type maximum: int :param default: Gets or sets the default. :type default: int - :param scale_type: Gets or sets the type of the scale. Possible values - include: 'None', 'Manual', 'Automatic' - :type scale_type: str or - ~azure.mgmt.appplatform.v2020_07_01.models.SkuScaleType + :param scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :type scale_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.SkuScaleType """ _validation = { @@ -1953,7 +2431,15 @@ class SkuCapacity(Model): 'scale_type': {'key': 'scaleType', 'type': 'str'}, } - def __init__(self, *, minimum: int, maximum: int=None, default: int=None, scale_type=None, **kwargs) -> None: + def __init__( + self, + *, + minimum: int, + maximum: Optional[int] = None, + default: Optional[int] = None, + scale_type: Optional[Union[str, "SkuScaleType"]] = None, + **kwargs + ): super(SkuCapacity, self).__init__(**kwargs) self.minimum = minimum self.maximum = maximum @@ -1961,17 +2447,15 @@ def __init__(self, *, minimum: int, maximum: int=None, default: int=None, scale_ self.scale_type = scale_type -class SupportedRuntimeVersion(Model): +class SupportedRuntimeVersion(msrest.serialization.Model): """Supported deployment runtime version descriptor. - :param value: The raw value which could be passed to deployment CRUD - operations. Possible values include: 'Java_8', 'Java_11', 'NetCore_31' - :type value: str or - ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimeValue - :param platform: The platform of this runtime version (possible values: - "Java" or ".NET"). Possible values include: 'Java', '.NET Core' - :type platform: str or - ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimePlatform + :param value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :type value: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimeValue + :param platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". + :type platform: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimePlatform :param version: The detailed version (major.minor) of the platform. :type version: str """ @@ -1982,19 +2466,26 @@ class SupportedRuntimeVersion(Model): 'version': {'key': 'version', 'type': 'str'}, } - def __init__(self, *, value=None, platform=None, version: str=None, **kwargs) -> None: + def __init__( + self, + *, + value: Optional[Union[str, "SupportedRuntimeValue"]] = None, + platform: Optional[Union[str, "SupportedRuntimePlatform"]] = None, + version: Optional[str] = None, + **kwargs + ): super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = value self.platform = platform self.version = version -class TemporaryDisk(Model): +class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :param size_in_gb: Size of the temporary disk in GB + :param size_in_gb: Size of the temporary disk in GB. :type size_in_gb: int - :param mount_path: Mount path of the temporary disk + :param mount_path: Mount path of the temporary disk. :type mount_path: str """ @@ -2007,24 +2498,30 @@ class TemporaryDisk(Model): 'mount_path': {'key': 'mountPath', 'type': 'str'}, } - def __init__(self, *, size_in_gb: int=None, mount_path: str=None, **kwargs) -> None: + def __init__( + self, + *, + size_in_gb: Optional[int] = None, + mount_path: Optional[str] = "/tmp", + **kwargs + ): super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.mount_path = mount_path -class TestKeys(Model): +class TestKeys(msrest.serialization.Model): """Test keys payload. - :param primary_key: Primary key + :param primary_key: Primary key. :type primary_key: str - :param secondary_key: Secondary key + :param secondary_key: Secondary key. :type secondary_key: str - :param primary_test_endpoint: Primary test endpoint + :param primary_test_endpoint: Primary test endpoint. :type primary_test_endpoint: str - :param secondary_test_endpoint: Secondary test endpoint + :param secondary_test_endpoint: Secondary test endpoint. :type secondary_test_endpoint: str - :param enabled: Indicates whether the test endpoint feature enabled or not + :param enabled: Indicates whether the test endpoint feature enabled or not. :type enabled: bool """ @@ -2036,7 +2533,16 @@ class TestKeys(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, *, primary_key: str=None, secondary_key: str=None, primary_test_endpoint: str=None, secondary_test_endpoint: str=None, enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + primary_key: Optional[str] = None, + secondary_key: Optional[str] = None, + primary_test_endpoint: Optional[str] = None, + secondary_test_endpoint: Optional[str] = None, + enabled: Optional[bool] = None, + **kwargs + ): super(TestKeys, self).__init__(**kwargs) self.primary_key = primary_key self.secondary_key = secondary_key @@ -2045,19 +2551,18 @@ def __init__(self, *, primary_key: str=None, secondary_key: str=None, primary_te self.enabled = enabled -class UserSourceInfo(Model): +class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :param type: Type of the source uploaded. Possible values include: 'Jar', - 'NetCoreZip', 'Source' - :type type: str or - ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceType - :param relative_path: Relative path of the storage which stores the source + :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source". + :type type: str or ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceType + :param relative_path: Relative path of the storage which stores the source. :type relative_path: str - :param version: Version of the source + :param version: Version of the source. :type version: str - :param artifact_selector: Selector for the artifact to be used for the - deployment for multi-module projects. This should be + :param artifact_selector: Selector for the artifact to be used for the deployment for + multi-module projects. This should be the relative path to the target module/project. :type artifact_selector: str """ @@ -2069,7 +2574,15 @@ class UserSourceInfo(Model): 'artifact_selector': {'key': 'artifactSelector', 'type': 'str'}, } - def __init__(self, *, type=None, relative_path: str=None, version: str=None, artifact_selector: str=None, **kwargs) -> None: + def __init__( + self, + *, + type: Optional[Union[str, "UserSourceType"]] = None, + relative_path: Optional[str] = None, + version: Optional[str] = None, + artifact_selector: Optional[str] = None, + **kwargs + ): super(UserSourceInfo, self).__init__(**kwargs) self.type = type self.relative_path = relative_path diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/models/_paged_models.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/models/_paged_models.py deleted file mode 100644 index e7bdca927d0..00000000000 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/models/_paged_models.py +++ /dev/null @@ -1,118 +0,0 @@ -# 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. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class ServiceResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`ServiceResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ServiceResource]'} - } - - def __init__(self, *args, **kwargs): - - super(ServiceResourcePaged, self).__init__(*args, **kwargs) -class AppResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`AppResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[AppResource]'} - } - - def __init__(self, *args, **kwargs): - - super(AppResourcePaged, self).__init__(*args, **kwargs) -class BindingResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`BindingResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[BindingResource]'} - } - - def __init__(self, *args, **kwargs): - - super(BindingResourcePaged, self).__init__(*args, **kwargs) -class CertificateResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`CertificateResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CertificateResource]'} - } - - def __init__(self, *args, **kwargs): - - super(CertificateResourcePaged, self).__init__(*args, **kwargs) -class CustomDomainResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`CustomDomainResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CustomDomainResource]'} - } - - def __init__(self, *args, **kwargs): - - super(CustomDomainResourcePaged, self).__init__(*args, **kwargs) -class DeploymentResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`DeploymentResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeploymentResource]'} - } - - def __init__(self, *args, **kwargs): - - super(DeploymentResourcePaged, self).__init__(*args, **kwargs) -class OperationDetailPaged(Paged): - """ - A paging container for iterating over a list of :class:`OperationDetail ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[OperationDetail]'} - } - - def __init__(self, *args, **kwargs): - - super(OperationDetailPaged, self).__init__(*args, **kwargs) -class ResourceSkuPaged(Paged): - """ - A paging container for iterating over a list of :class:`ResourceSku ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ResourceSku]'} - } - - def __init__(self, *args, **kwargs): - - super(ResourceSkuPaged, self).__init__(*args, **kwargs) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/__init__.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/__init__.py index 0a24a9df9f9..aa6fe5cd0cf 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/__init__.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/__init__.py @@ -1,12 +1,9 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from ._services_operations import ServicesOperations diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_apps_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_apps_operations.py index 16c38b6374b..5be695c7364 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_apps_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_apps_operations.py @@ -1,634 +1,726 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class AppsOperations(object): """AppsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_07_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2020-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-07-01" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, app_name, sync_status=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + sync_status=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" """Get an App and its properties. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status + :param sync_status: Indicates whether sync status. :type sync_status: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if sync_status is not None: query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AppResource', response) + deserialized = self._deserialize('AppResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, service_name, app_name, app_resource, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(app_resource, 'AppResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AppResource', response) + deserialized = self._deserialize('AppResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('AppResource', response) + deserialized = self._deserialize('AppResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('AppResource', response) + deserialized = self._deserialize('AppResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, service_name, app_name, app_resource, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.AppResource"] """Create a new App or update an exiting App. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param app_resource: Parameters for the create or update operation - :type app_resource: - ~azure.mgmt.appplatform.v2020_07_01.models.AppResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns AppResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_07_01.models.AppResource]] - :raises: :class:`CloudError` + :param app_resource: Parameters for the create or update operation. + :type app_resource: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - app_resource=app_resource, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('AppResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def _delete_initial( - self, resource_group_name, service_name, app_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, service_name, app_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete an App. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def _update_initial( - self, resource_group_name, service_name, app_name, app_resource, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(app_resource, 'AppResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AppResource', response) + deserialized = self._deserialize('AppResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('AppResource', response) + deserialized = self._deserialize('AppResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, service_name, app_name, app_resource, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.AppResource"] """Operation to update an exiting App. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param app_resource: Parameters for the update operation - :type app_resource: - ~azure.mgmt.appplatform.v2020_07_01.models.AppResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns AppResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_07_01.models.AppResource]] - :raises: :class:`CloudError` + :param app_resource: Parameters for the update operation. + :type app_resource: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - app_resource=app_resource, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('AppResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def list( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AppResourceCollection"] """Handles requests to list all resources in a Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppResource - :rtype: - ~azure.mgmt.appplatform.v2020_07_01.models.AppResourcePaged[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AppResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore def get_resource_upload_url( - self, resource_group_name, service_name, app_name, custom_headers=None, raw=False, **operation_config): - """Get an resource upload URL for an App, which may be artifacts or source - archive. - - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceUploadDefinition" + """Get an resource upload URL for an App, which may be artifacts or source archive. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ResourceUploadDefinition or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2020_07_01.models.ResourceUploadDefinition or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceUploadDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.ResourceUploadDefinition + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + # Construct URL - url = self.get_resource_upload_url.metadata['url'] + url = self.get_resource_upload_url.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ResourceUploadDefinition', response) + deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore def validate_domain( - self, resource_group_name, service_name, app_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + validate_payload, # type: "_models.CustomDomainValidatePayload" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainValidateResult" """Check the resource name is valid as well as not in use. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param name: Name to be validated - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CustomDomainValidateResult or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainValidateResult - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param validate_payload: Custom domain payload to be validated. + :type validate_payload: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainValidatePayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainValidateResult + :raises: ~azure.core.exceptions.HttpResponseError """ - validate_payload = models.CustomDomainValidatePayload(name=name) + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.validate_domain.metadata['url'] + url = self.validate_domain.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CustomDomainValidateResult', response) + deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_bindings_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_bindings_operations.py index c421428f63b..4d01d1bab12 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_bindings_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_bindings_operations.py @@ -1,53 +1,65 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class BindingsOperations(object): """BindingsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_07_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2020-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-07-01" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, app_name, binding_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" """Get a Binding and its properties. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -55,126 +67,133 @@ def get( :type app_name: str :param binding_name: The name of the Binding resource. :type binding_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BindingResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BindingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str') + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BindingResource', response) + deserialized = self._deserialize('BindingResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, service_name, app_name, binding_name, properties=None, custom_headers=None, raw=False, **operation_config): - binding_resource = models.BindingResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str') + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(binding_resource, 'BindingResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('BindingResource', response) + deserialized = self._deserialize('BindingResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('BindingResource', response) + deserialized = self._deserialize('BindingResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('BindingResource', response) + deserialized = self._deserialize('BindingResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, service_name, app_name, binding_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.BindingResource"] """Create a new Binding or update an exiting Binding. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -182,98 +201,130 @@ def create_or_update( :type app_name: str :param binding_name: The name of the Binding resource. :type binding_name: str - :param properties: Properties of the Binding resource - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns BindingResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource]] - :raises: :class:`CloudError` + :param binding_resource: Parameters for the create or update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('BindingResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def _delete_initial( - self, resource_group_name, service_name, app_name, binding_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str') + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, service_name, app_name, binding_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Binding. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -281,104 +332,138 @@ def delete( :type app_name: str :param binding_name: The name of the Binding resource. :type binding_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def _update_initial( - self, resource_group_name, service_name, app_name, binding_name, properties=None, custom_headers=None, raw=False, **operation_config): - binding_resource = models.BindingResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str') + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(binding_resource, 'BindingResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('BindingResource', response) + deserialized = self._deserialize('BindingResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('BindingResource', response) + deserialized = self._deserialize('BindingResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, service_name, app_name, binding_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.BindingResource"] """Operation to update an exiting Binding. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -386,124 +471,144 @@ def update( :type app_name: str :param binding_name: The name of the Binding resource. :type binding_name: str - :param properties: Properties of the Binding resource - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns BindingResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource]] - :raises: :class:`CloudError` + :param binding_resource: Parameters for the update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('BindingResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def list( - self, resource_group_name, service_name, app_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.BindingResourceCollection"] """Handles requests to list all resources in an App. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of BindingResource - :rtype: - ~azure.mgmt.appplatform.v2020_07_01.models.BindingResourcePaged[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.BindingResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_certificates_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_certificates_operations.py index d1ae6a62566..f60d181ac48 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_certificates_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_certificates_operations.py @@ -1,380 +1,447 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class CertificatesOperations(object): """CertificatesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_07_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2020-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-07-01" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, certificate_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateResource" """Get the certificate resource. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param certificate_name: The name of the certificate resource. :type certificate_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CertificateResource or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateResource, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateResource', response) + deserialized = self._deserialize('CertificateResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, service_name, certificate_name, properties=None, custom_headers=None, raw=False, **operation_config): - certificate_resource = models.CertificateResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + certificate_resource, # type: "_models.CertificateResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(certificate_resource, 'CertificateResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_resource, 'CertificateResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('CertificateResource', response) + deserialized = self._deserialize('CertificateResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('CertificateResource', response) + deserialized = self._deserialize('CertificateResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('CertificateResource', response) + deserialized = self._deserialize('CertificateResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, service_name, certificate_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + certificate_resource, # type: "_models.CertificateResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CertificateResource"] """Create or update certificate resource. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param certificate_name: The name of the certificate resource. :type certificate_name: str - :param properties: Properties of the certificate resource payload. - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.CertificateProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns CertificateResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource]] - :raises: :class:`CloudError` + :param certificate_resource: Parameters for the create or update operation. + :type certificate_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CertificateResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('CertificateResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + certificate_resource=certificate_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore def _delete_initial( - self, resource_group_name, service_name, certificate_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, service_name, certificate_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete the certificate resource. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param certificate_name: The name of the certificate resource. :type certificate_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore def list( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CertificateResourceCollection"] """List all the certificates of one user. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CertificateResource - :rtype: - ~azure.mgmt.appplatform.v2020_07_01.models.CertificateResourcePaged[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CertificateResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_config_servers_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_config_servers_operations.py index c5c72fd3eaf..c4dfb55f98b 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_config_servers_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_config_servers_operations.py @@ -1,428 +1,500 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class ConfigServersOperations(object): """ConfigServersOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_07_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2020-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-07-01" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" """Get the config server and its properties. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ConfigServerResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigServerResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ConfigServerResource', response) + deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _update_put_initial( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, **operation_config): - config_server_resource = models.ConfigServerResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update_put.metadata['url'] + url = self._update_put_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ConfigServerResource', response) + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('ConfigServerResource', response) + deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update_put( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + def begin_update_put( + self, + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerResource"] """Update the config server. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param properties: Properties of the Config Server resource - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns ConfigServerResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource]] - :raises: :class:`CloudError` + :param config_server_resource: Parameters for the update operation. + :type config_server_resource: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('ConfigServerResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _update_patch_initial( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, **operation_config): - config_server_resource = models.ConfigServerResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update_patch.metadata['url'] + url = self._update_patch_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ConfigServerResource', response) + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('ConfigServerResource', response) + deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update_patch( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + def begin_update_patch( + self, + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerResource"] """Update the config server. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param properties: Properties of the Config Server resource - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns ConfigServerResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource]] - :raises: :class:`CloudError` + :param config_server_resource: Parameters for the update operation. + :type config_server_resource: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('ConfigServerResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _validate_initial( - self, resource_group_name, service_name, git_property=None, custom_headers=None, raw=False, **operation_config): - config_server_settings = models.ConfigServerSettings(git_property=git_property) + self, + resource_group_name, # type: str + service_name, # type: str + config_server_settings, # type: "_models.ConfigServerSettings" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerSettingsValidateResult" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.validate.metadata['url'] + url = self._validate_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ConfigServerSettingsValidateResult', response) + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('ConfigServerSettingsValidateResult', response) + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def validate( - self, resource_group_name, service_name, git_property=None, custom_headers=None, raw=False, polling=True, **operation_config): + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + + def begin_validate( + self, + resource_group_name, # type: str + service_name, # type: str + config_server_settings, # type: "_models.ConfigServerSettings" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerSettingsValidateResult"] """Check if the config server settings are valid. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param git_property: Property of git environment. - :type git_property: - ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerGitProperty - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns - ConfigServerSettingsValidateResult or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsValidateResult] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsValidateResult]] - :raises: :class:`CloudError` + :param config_server_settings: Config server settings to be validated. + :type config_server_settings: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - git_property=git_property, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('ConfigServerSettingsValidateResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_settings=config_server_settings, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_custom_domains_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_custom_domains_operations.py index 232b3730ad7..4b7051f56c7 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_custom_domains_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_custom_domains_operations.py @@ -1,53 +1,65 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class CustomDomainsOperations(object): """CustomDomainsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_07_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2020-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-07-01" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, app_name, domain_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" """Get the custom domain of one lifecycle application. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -55,127 +67,133 @@ def get( :type app_name: str :param domain_name: The name of the custom domain resource. :type domain_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CustomDomainResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str') + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CustomDomainResource', response) + deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, service_name, app_name, domain_name, properties=None, custom_headers=None, raw=False, **operation_config): - domain_resource = models.CustomDomainResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str') + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('CustomDomainResource', response) + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('CustomDomainResource', response) + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('CustomDomainResource', response) + deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, service_name, app_name, domain_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CustomDomainResource"] """Create or update custom domain of one lifecycle application. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -183,98 +201,130 @@ def create_or_update( :type app_name: str :param domain_name: The name of the custom domain resource. :type domain_name: str - :param properties: Properties of the custom domain resource. - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns CustomDomainResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource]] - :raises: :class:`CloudError` + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('CustomDomainResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def _delete_initial( - self, resource_group_name, service_name, app_name, domain_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str') + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, service_name, app_name, domain_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete the custom domain of one lifecycle application. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -282,104 +332,138 @@ def delete( :type app_name: str :param domain_name: The name of the custom domain resource. :type domain_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def _update_initial( - self, resource_group_name, service_name, app_name, domain_name, properties=None, custom_headers=None, raw=False, **operation_config): - domain_resource = models.CustomDomainResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str') + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('CustomDomainResource', response) + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('CustomDomainResource', response) + deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, service_name, app_name, domain_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CustomDomainResource"] """Update custom domain of one lifecycle application. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -387,124 +471,144 @@ def update( :type app_name: str :param domain_name: The name of the custom domain resource. :type domain_name: str - :param properties: Properties of the custom domain resource. - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns CustomDomainResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource]] - :raises: :class:`CloudError` + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('CustomDomainResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def list( - self, resource_group_name, service_name, app_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CustomDomainResourceCollection"] """List the custom domains of one lifecycle application. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CustomDomainResource - :rtype: - ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResourcePaged[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CustomDomainResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_deployments_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_deployments_operations.py index 9dd25f8c12d..7c9649aea65 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_deployments_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_deployments_operations.py @@ -1,53 +1,65 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class DeploymentsOperations(object): """DeploymentsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_07_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2020-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-07-01" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" """Get a Deployment and its properties. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -55,126 +67,133 @@ def get( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DeploymentResource or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentResource, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, service_name, app_name, deployment_name, properties=None, sku=None, custom_headers=None, raw=False, **operation_config): - deployment_resource = models.DeploymentResource(properties=properties, sku=sku) + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, service_name, app_name, deployment_name, properties=None, sku=None, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentResource"] """Create a new Deployment or update an exiting Deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -182,101 +201,130 @@ def create_or_update( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param properties: Properties of the Deployment resource - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource - :type sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns DeploymentResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource]] - :raises: :class:`CloudError` + :param deployment_resource: Parameters for the create or update operation. + :type deployment_resource: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - properties=properties, - sku=sku, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('DeploymentResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def _delete_initial( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -284,104 +332,138 @@ def delete( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def _update_initial( - self, resource_group_name, service_name, app_name, deployment_name, properties=None, sku=None, custom_headers=None, raw=False, **operation_config): - deployment_resource = models.DeploymentResource(properties=properties, sku=sku) + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, service_name, app_name, deployment_name, properties=None, sku=None, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentResource"] """Operation to update an exiting Deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -389,260 +471,296 @@ def update( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param properties: Properties of the Deployment resource - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource - :type sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns DeploymentResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource]] - :raises: :class:`CloudError` + :param deployment_resource: Parameters for the update operation. + :type deployment_resource: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - properties=properties, - sku=sku, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('DeploymentResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def list( - self, resource_group_name, service_name, app_name, version=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + version=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentResourceCollection"] """Handles requests to list all resources in an App. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed + :param version: Version of the deployments to be listed. :type version: list[str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DeploymentResource - :rtype: - ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourcePaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if version is not None: - query_parameters['version'] = self._serialize.query("version", version, '[str]', div=',') + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DeploymentResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore def list_for_cluster( - self, resource_group_name, service_name, version=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + version=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentResourceCollection"] """List deployments for a certain service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed + :param version: Version of the deployments to be listed. :type version: list[str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DeploymentResource - :rtype: - ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourcePaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_for_cluster.metadata['url'] + url = self.list_for_cluster.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if version is not None: - query_parameters['version'] = self._serialize.query("version", version, '[str]', div=',') + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DeploymentResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} + return pipeline_response + return ItemPaged( + get_next, extract_data + ) + list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore def _start_initial( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + # Construct URL - url = self.start.metadata['url'] + url = self._start_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def start( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + + def begin_start( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Start the deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -650,88 +768,124 @@ def start( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore def _stop_initial( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + # Construct URL - url = self.stop.metadata['url'] + url = self._stop_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def stop( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + + def begin_stop( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Stop the deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -739,88 +893,124 @@ def stop( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore def _restart_initial( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + # Construct URL - url = self.restart.metadata['url'] + url = self._restart_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def restart( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + + def begin_restart( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Restart the deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -828,48 +1018,75 @@ def restart( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore def get_log_file_url( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.LogFileUrlResponse"] """Get deployment log file URL. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -877,57 +1094,52 @@ def get_log_file_url( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: LogFileUrlResponse or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.LogFileUrlResponse - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogFileUrlResponse, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.LogFileUrlResponse or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LogFileUrlResponse"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + # Construct URL - url = self.get_log_file_url.metadata['url'] + url = self.get_log_file_url.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('LogFileUrlResponse', response) + deserialized = self._deserialize('LogFileUrlResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} + get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_monitoring_settings_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_monitoring_settings_operations.py index 8758bc8463b..417872e32c6 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_monitoring_settings_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_monitoring_settings_operations.py @@ -1,322 +1,369 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class MonitoringSettingsOperations(object): """MonitoringSettingsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_07_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2020-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-07-01" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" """Get the Monitoring Setting and its properties. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MonitoringSettingResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoringSettingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MonitoringSettingResource', response) + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore def _update_put_initial( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, **operation_config): - monitoring_setting_resource = models.MonitoringSettingResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update_put.metadata['url'] + url = self._update_put_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('MonitoringSettingResource', response) + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('MonitoringSettingResource', response) + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update_put( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + def begin_update_put( + self, + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.MonitoringSettingResource"] """Update the Monitoring Setting. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param properties: Properties of the Monitoring Setting resource - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns - MonitoringSettingResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource]] - :raises: :class:`CloudError` + :param monitoring_setting_resource: Parameters for the update operation. + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('MonitoringSettingResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore def _update_patch_initial( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, **operation_config): - monitoring_setting_resource = models.MonitoringSettingResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update_patch.metadata['url'] + url = self._update_patch_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('MonitoringSettingResource', response) + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('MonitoringSettingResource', response) + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update_patch( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + def begin_update_patch( + self, + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.MonitoringSettingResource"] """Update the Monitoring Setting. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param properties: Properties of the Monitoring Setting resource - :type properties: - ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns - MonitoringSettingResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource]] - :raises: :class:`CloudError` + :param monitoring_setting_resource: Parameters for the update operation. + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('MonitoringSettingResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_operations.py index 90798831cfa..8805b707216 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_operations.py @@ -1,103 +1,109 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class Operations(object): """Operations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_07_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2020-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-07-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): - """Lists all of the available REST API operations of the - Microsoft.AppPlatform provider. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of OperationDetail - :rtype: - ~azure.mgmt.appplatform.v2020_07_01.models.OperationDetailPaged[~azure.mgmt.appplatform.v2020_07_01.models.OperationDetail] - :raises: :class:`CloudError` + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AvailableOperations"] + """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailableOperations or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AvailableOperations] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] - + url = self.list.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AvailableOperations', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.OperationDetailPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_runtime_versions_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_runtime_versions_operations.py index d7dfdef53fc..0833e317039 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_runtime_versions_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_runtime_versions_operations.py @@ -1,93 +1,92 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class RuntimeVersionsOperations(object): """RuntimeVersionsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_07_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2020-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-07-01" - - self.config = config + self._config = config def list_runtime_versions( - self, custom_headers=None, raw=False, **operation_config): - """Lists all of the available runtime versions supported by - Microsoft.AppPlatform provider. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AvailableRuntimeVersions or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2020_07_01.models.AvailableRuntimeVersions or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + self, + **kwargs # type: Any + ): + # type: (...) -> "_models.AvailableRuntimeVersions" + """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailableRuntimeVersions, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.AvailableRuntimeVersions + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableRuntimeVersions"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + # Construct URL - url = self.list_runtime_versions.metadata['url'] + url = self.list_runtime_versions.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AvailableRuntimeVersions', response) + deserialized = self._deserialize('AvailableRuntimeVersions', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_services_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_services_operations.py index e9c2b47709a..6e2ae13f774 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_services_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_services_operations.py @@ -1,857 +1,931 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class ServicesOperations(object): """ServicesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_07_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2020-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-07-01" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" """Get a Service and its properties. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ServiceResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ServiceResource', response) + deserialized = self._deserialize('ServiceResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, service_name, resource, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(resource, 'ServiceResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ServiceResource', response) + deserialized = self._deserialize('ServiceResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('ServiceResource', response) + deserialized = self._deserialize('ServiceResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('ServiceResource', response) + deserialized = self._deserialize('ServiceResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, service_name, resource, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ServiceResource"] """Create a new Service or update an exiting Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param resource: Parameters for the create or update operation - :type resource: - ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns ServiceResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource]] - :raises: :class:`CloudError` + :param resource: Parameters for the create or update operation. + :type resource: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('ServiceResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _delete_initial( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - def delete( - self, resource_group_name, service_name, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_delete( + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _update_initial( - self, resource_group_name, service_name, resource, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(resource, 'ServiceResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ServiceResource', response) + deserialized = self._deserialize('ServiceResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('ServiceResource', response) + deserialized = self._deserialize('ServiceResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, service_name, resource, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ServiceResource"] """Operation to update an exiting Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param resource: Parameters for the update operation - :type resource: - ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns ServiceResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource]] - :raises: :class:`CloudError` + :param resource: Parameters for the update operation. + :type resource: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('ServiceResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def list_test_keys( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """List test keys for a Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TestKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.TestKeys or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + # Construct URL - url = self.list_test_keys.metadata['url'] + url = self.list_test_keys.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('TestKeys', response) + deserialized = self._deserialize('TestKeys', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore def regenerate_test_key( - self, resource_group_name, service_name, key_type, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + regenerate_test_key_request, # type: "_models.RegenerateTestKeyRequestPayload" + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """Regenerate a test key for a Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param key_type: Type of the test key. Possible values include: - 'Primary', 'Secondary' - :type key_type: str or - ~azure.mgmt.appplatform.v2020_07_01.models.TestKeyType - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TestKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.TestKeys or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param regenerate_test_key_request: Parameters for the operation. + :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2020_07_01.models.RegenerateTestKeyRequestPayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError """ - regenerate_test_key_request = models.RegenerateTestKeyRequestPayload(key_type=key_type) + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.regenerate_test_key.metadata['url'] + url = self.regenerate_test_key.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('TestKeys', response) + deserialized = self._deserialize('TestKeys', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore def disable_test_endpoint( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Disable test endpoint functionality for a Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + # Construct URL - url = self.disable_test_endpoint.metadata['url'] + url = self.disable_test_endpoint.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} + disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore def enable_test_endpoint( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """Enable test endpoint functionality for a Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TestKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.TestKeys or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + # Construct URL - url = self.enable_test_endpoint.metadata['url'] + url = self.enable_test_endpoint.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('TestKeys', response) + deserialized = self._deserialize('TestKeys', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore def check_name_availability( - self, location, type, name, custom_headers=None, raw=False, **operation_config): + self, + location, # type: str + availability_parameters, # type: "_models.NameAvailabilityParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.NameAvailability" """Checks that the resource name is valid and is not already in use. - :param location: the region + :param location: the region. :type location: str - :param type: Type of the resource to check name availability - :type type: str - :param name: Name to be checked - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: NameAvailability or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailability or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param availability_parameters: Parameters supplied to the operation. + :type availability_parameters: ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailability + :raises: ~azure.core.exceptions.HttpResponseError """ - availability_parameters = models.NameAvailabilityParameters(type=type, name=name) + cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailability"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.check_name_availability.metadata['url'] + url = self.check_name_availability.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('NameAvailability', response) + deserialized = self._deserialize('NameAvailability', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore def list_by_subscription( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServiceResourceList"] """Handles requests to list all resources in a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ServiceResource - :rtype: - ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourcePaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_subscription.metadata['url'] + url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ServiceResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ServiceResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore def list( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServiceResourceList"] """Handles requests to list all resources in a resource group. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ServiceResource - :rtype: - ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourcePaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ServiceResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ServiceResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_skus_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_skus_operations.py index 5c967e6a1a2..4e05d050f70 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_skus_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/operations/_skus_operations.py @@ -1,106 +1,113 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class SkusOperations(object): """SkusOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_07_01.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2020-07-01". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-07-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ResourceSkuCollection"] """Lists all of the available skus of the Microsoft.AppPlatform provider. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceSku - :rtype: - ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuPaged[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSku] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceSkuPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/py.typed b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_07_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/__init__.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/__init__.py index ee44eafce0f..d2ddf950056 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/__init__.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/__init__.py @@ -1,19 +1,19 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._configuration import AppPlatformManagementClientConfiguration from ._app_platform_management_client import AppPlatformManagementClient -__all__ = ['AppPlatformManagementClient', 'AppPlatformManagementClientConfiguration'] - -from .version import VERSION +from ._version import VERSION __version__ = VERSION +__all__ = ['AppPlatformManagementClient'] +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/_app_platform_management_client.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/_app_platform_management_client.py index e401566fb47..3e902325d70 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/_app_platform_management_client.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/_app_platform_management_client.py @@ -1,16 +1,22 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import SDKClient -from msrest import Serializer, Deserializer +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import AppPlatformManagementClientConfiguration from .operations import ServicesOperations @@ -27,75 +33,107 @@ from . import models -class AppPlatformManagementClient(SDKClient): - """REST API for Azure Spring Cloud +class AppPlatformManagementClient(object): + """REST API for Azure Spring Cloud. - :ivar config: Configuration for client. - :vartype config: AppPlatformManagementClientConfiguration - - :ivar services: Services operations + :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2020_11_01_preview.operations.ServicesOperations - :ivar config_servers: ConfigServers operations + :ivar config_servers: ConfigServersOperations operations :vartype config_servers: azure.mgmt.appplatform.v2020_11_01_preview.operations.ConfigServersOperations - :ivar monitoring_settings: MonitoringSettings operations + :ivar monitoring_settings: MonitoringSettingsOperations operations :vartype monitoring_settings: azure.mgmt.appplatform.v2020_11_01_preview.operations.MonitoringSettingsOperations - :ivar apps: Apps operations + :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2020_11_01_preview.operations.AppsOperations - :ivar bindings: Bindings operations + :ivar bindings: BindingsOperations operations :vartype bindings: azure.mgmt.appplatform.v2020_11_01_preview.operations.BindingsOperations - :ivar certificates: Certificates operations + :ivar certificates: CertificatesOperations operations :vartype certificates: azure.mgmt.appplatform.v2020_11_01_preview.operations.CertificatesOperations - :ivar custom_domains: CustomDomains operations + :ivar custom_domains: CustomDomainsOperations operations :vartype custom_domains: azure.mgmt.appplatform.v2020_11_01_preview.operations.CustomDomainsOperations - :ivar deployments: Deployments operations + :ivar deployments: DeploymentsOperations operations :vartype deployments: azure.mgmt.appplatform.v2020_11_01_preview.operations.DeploymentsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2020_11_01_preview.operations.Operations - :ivar runtime_versions: RuntimeVersions operations + :ivar runtime_versions: RuntimeVersionsOperations operations :vartype runtime_versions: azure.mgmt.appplatform.v2020_11_01_preview.operations.RuntimeVersionsOperations - :ivar skus: Skus operations + :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2020_11_01_preview.operations.SkusOperations - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Gets subscription ID which uniquely identify the - Microsoft Azure subscription. The subscription ID forms part of the URI - for every service call. + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = AppPlatformManagementClientConfiguration(credentials, subscription_id, base_url) - super(AppPlatformManagementClient, self).__init__(self.config.credentials, self.config) + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2020-11-01-preview' self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.services = ServicesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.config_servers = ConfigServersOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.monitoring_settings = MonitoringSettingsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.apps = AppsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.bindings = BindingsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.certificates = CertificatesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.custom_domains = CustomDomainsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.deployments = DeploymentsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.operations = Operations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.runtime_versions = RuntimeVersionsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.skus = SkusOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> AppPlatformManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/_configuration.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/_configuration.py index 5a7f3752f05..9678a78ee77 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/_configuration.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/_configuration.py @@ -1,50 +1,71 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrestazure import AzureConfiguration -from .version import VERSION +from typing import TYPE_CHECKING +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class AppPlatformManagementClientConfiguration(Configuration): + """Configuration for AppPlatformManagementClient. -class AppPlatformManagementClientConfiguration(AzureConfiguration): - """Configuration for AppPlatformManagementClient Note that all parameters used to create this instance are saved as instance attributes. - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Gets subscription ID which uniquely identify the - Microsoft Azure subscription. The subscription ID forms part of the URI - for every service call. + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - if not base_url: - base_url = 'https://management.azure.com' - - super(AppPlatformManagementClientConfiguration, self).__init__(base_url) - - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) - self.add_user_agent('azure-mgmt-appplatform/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials + self.credential = credential self.subscription_id = subscription_id + self.api_version = "2020-11-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/_metadata.json b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/_metadata.json new file mode 100644 index 00000000000..22c085a41a3 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/_metadata.json @@ -0,0 +1,113 @@ +{ + "chosen_version": "2020-11-01-preview", + "total_api_version_list": ["2020-11-01-preview"], + "client": { + "name": "AppPlatformManagementClient", + "filename": "_app_platform_management_client", + "description": "REST API for Azure Spring Cloud.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "services": "ServicesOperations", + "config_servers": "ConfigServersOperations", + "monitoring_settings": "MonitoringSettingsOperations", + "apps": "AppsOperations", + "bindings": "BindingsOperations", + "certificates": "CertificatesOperations", + "custom_domains": "CustomDomainsOperations", + "deployments": "DeploymentsOperations", + "operations": "Operations", + "runtime_versions": "RuntimeVersionsOperations", + "skus": "SkusOperations" + } +} \ No newline at end of file diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/version.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/_version.py similarity index 82% rename from src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/version.py rename to src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/_version.py index a0ac0f4d505..92453d8691d 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/version.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/_version.py @@ -1,13 +1,9 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2021-06-01-preview" - +VERSION = "6.1.0" diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/__init__.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/__init__.py new file mode 100644 index 00000000000..39f10548873 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/__init__.py @@ -0,0 +1,10 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._app_platform_management_client import AppPlatformManagementClient +__all__ = ['AppPlatformManagementClient'] diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/_app_platform_management_client.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/_app_platform_management_client.py new file mode 100644 index 00000000000..5ca00dfff68 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/_app_platform_management_client.py @@ -0,0 +1,132 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import ServicesOperations +from .operations import ConfigServersOperations +from .operations import MonitoringSettingsOperations +from .operations import AppsOperations +from .operations import BindingsOperations +from .operations import CertificatesOperations +from .operations import CustomDomainsOperations +from .operations import DeploymentsOperations +from .operations import Operations +from .operations import RuntimeVersionsOperations +from .operations import SkusOperations +from .. import models + + +class AppPlatformManagementClient(object): + """REST API for Azure Spring Cloud. + + :ivar services: ServicesOperations operations + :vartype services: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.ServicesOperations + :ivar config_servers: ConfigServersOperations operations + :vartype config_servers: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.ConfigServersOperations + :ivar monitoring_settings: MonitoringSettingsOperations operations + :vartype monitoring_settings: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.MonitoringSettingsOperations + :ivar apps: AppsOperations operations + :vartype apps: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.AppsOperations + :ivar bindings: BindingsOperations operations + :vartype bindings: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.BindingsOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.CertificatesOperations + :ivar custom_domains: CustomDomainsOperations operations + :vartype custom_domains: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.CustomDomainsOperations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.DeploymentsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.Operations + :ivar runtime_versions: RuntimeVersionsOperations operations + :vartype runtime_versions: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.RuntimeVersionsOperations + :ivar skus: SkusOperations operations + :vartype skus: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.SkusOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.services = ServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "AppPlatformManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/_configuration.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/_configuration.py new file mode 100644 index 00000000000..89cd6bbbc8e --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/_configuration.py @@ -0,0 +1,67 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class AppPlatformManagementClientConfiguration(Configuration): + """Configuration for AppPlatformManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-11-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/__init__.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/__init__.py new file mode 100644 index 00000000000..aa6fe5cd0cf --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/__init__.py @@ -0,0 +1,33 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._services_operations import ServicesOperations +from ._config_servers_operations import ConfigServersOperations +from ._monitoring_settings_operations import MonitoringSettingsOperations +from ._apps_operations import AppsOperations +from ._bindings_operations import BindingsOperations +from ._certificates_operations import CertificatesOperations +from ._custom_domains_operations import CustomDomainsOperations +from ._deployments_operations import DeploymentsOperations +from ._operations import Operations +from ._runtime_versions_operations import RuntimeVersionsOperations +from ._skus_operations import SkusOperations + +__all__ = [ + 'ServicesOperations', + 'ConfigServersOperations', + 'MonitoringSettingsOperations', + 'AppsOperations', + 'BindingsOperations', + 'CertificatesOperations', + 'CustomDomainsOperations', + 'DeploymentsOperations', + 'Operations', + 'RuntimeVersionsOperations', + 'SkusOperations', +] diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_apps_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_apps_operations.py new file mode 100644 index 00000000000..19ae5271884 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_apps_operations.py @@ -0,0 +1,712 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AppsOperations: + """AppsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_11_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + sync_status: Optional[str] = None, + **kwargs: Any + ) -> "_models.AppResource": + """Get an App and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param sync_status: Indicates whether sync status. + :type sync_status: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if sync_status is not None: + query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.AppResource"]: + """Create a new App or update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param app_resource: Parameters for the create or update operation. + :type app_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.AppResource"]: + """Operation to update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param app_resource: Parameters for the update operation. + :type app_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.AppResourceCollection"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AppResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + + async def get_resource_upload_url( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> "_models.ResourceUploadDefinition": + """Get an resource upload URL for an App, which may be artifacts or source archive. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceUploadDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceUploadDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_resource_upload_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore + + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: "_models.CustomDomainValidatePayload", + **kwargs: Any + ) -> "_models.CustomDomainValidateResult": + """Check the resource name is valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param validate_payload: Custom domain payload to be validated. + :type validate_payload: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidatePayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidateResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.validate_domain.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_bindings_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_bindings_operations.py new file mode 100644 index 00000000000..77f8b3f7fe8 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_bindings_operations.py @@ -0,0 +1,602 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BindingsOperations: + """BindingsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_11_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> "_models.BindingResource": + """Get a Binding and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BindingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.BindingResource"]: + """Create a new Binding or update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :param binding_resource: Parameters for the create or update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete a Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.BindingResource"]: + """Operation to update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :param binding_resource: Parameters for the update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BindingResourceCollection"]: + """Handles requests to list all resources in an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_certificates_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_certificates_operations.py new file mode 100644 index 00000000000..71b2ff176be --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_certificates_operations.py @@ -0,0 +1,437 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CertificatesOperations: + """CertificatesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_11_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> "_models.CertificateResource": + """Get the certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> "_models.CertificateResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_resource, 'CertificateResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.CertificateResource"]: + """Create or update certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :param certificate_resource: Parameters for the create or update operation. + :type certificate_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + certificate_resource=certificate_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.CertificateResourceCollection"]: + """List all the certificates of one user. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_config_servers_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_config_servers_operations.py new file mode 100644 index 00000000000..175fc48484d --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_config_servers_operations.py @@ -0,0 +1,489 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConfigServersOperations: + """ConfigServersOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_11_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ConfigServerResource": + """Get the config server and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigServerResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + async def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigServerResource"]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param config_server_resource: Parameters for the update operation. + :type config_server_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + async def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigServerResource"]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param config_server_resource: Parameters for the update operation. + :type config_server_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + async def _validate_initial( + self, + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> "_models.ConfigServerSettingsValidateResult": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigServerSettingsValidateResult"]: + """Check if the config server settings are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param config_server_settings: Config server settings to be validated. + :type config_server_settings: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_settings=config_server_settings, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_custom_domains_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_custom_domains_operations.py new file mode 100644 index 00000000000..40546c17e4f --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_custom_domains_operations.py @@ -0,0 +1,602 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CustomDomainsOperations: + """CustomDomainsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_11_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.CustomDomainResource": + """Get the custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.CustomDomainResource"]: + """Create or update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.CustomDomainResource"]: + """Update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.CustomDomainResourceCollection"]: + """List the custom domains of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_deployments_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_deployments_operations.py new file mode 100644 index 00000000000..1428ce78df9 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_deployments_operations.py @@ -0,0 +1,1125 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DeploymentsOperations: + """DeploymentsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_11_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> "_models.DeploymentResource": + """Get a Deployment and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.DeploymentResource"]: + """Create a new Deployment or update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param deployment_resource: Parameters for the create or update operation. + :type deployment_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete a Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.DeploymentResource"]: + """Operation to update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param deployment_resource: Parameters for the update operation. + :type deployment_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DeploymentResourceCollection"]: + """Handles requests to list all resources in an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param version: Version of the deployments to be listed. + :type version: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore + + def list_for_cluster( + self, + resource_group_name: str, + service_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DeploymentResourceCollection"]: + """List deployments for a certain service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param version: Version of the deployments to be listed. + :type version: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_for_cluster.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore + + async def _start_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + + async def begin_start( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Start the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + + async def _stop_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + + async def begin_stop( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Stop the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._stop_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + + async def _restart_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + + async def begin_restart( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restart the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + + async def get_log_file_url( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> Optional["_models.LogFileUrlResponse"]: + """Get deployment log file URL. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogFileUrlResponse, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.LogFileUrlResponse or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LogFileUrlResponse"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_log_file_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LogFileUrlResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_monitoring_settings_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_monitoring_settings_operations.py new file mode 100644 index 00000000000..6ee477698c7 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_monitoring_settings_operations.py @@ -0,0 +1,360 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MonitoringSettingsOperations: + """MonitoringSettingsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_11_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.MonitoringSettingResource": + """Get the Monitoring Setting and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoringSettingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + async def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.MonitoringSettingResource"]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + async def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.MonitoringSettingResource"]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_operations.py new file mode 100644 index 00000000000..4353874d448 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_operations.py @@ -0,0 +1,104 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_11_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.AvailableOperations"]: + """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailableOperations or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AvailableOperations] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AvailableOperations', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_runtime_versions_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_runtime_versions_operations.py new file mode 100644 index 00000000000..a4d56940113 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_runtime_versions_operations.py @@ -0,0 +1,87 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RuntimeVersionsOperations: + """RuntimeVersionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_11_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list_runtime_versions( + self, + **kwargs: Any + ) -> "_models.AvailableRuntimeVersions": + """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailableRuntimeVersions, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AvailableRuntimeVersions + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableRuntimeVersions"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_runtime_versions.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AvailableRuntimeVersions', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_services_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_services_operations.py new file mode 100644 index 00000000000..b525473b065 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_services_operations.py @@ -0,0 +1,913 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ServicesOperations: + """ServicesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_11_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ServiceResource": + """Get a Service and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ServiceResource"]: + """Create a new Service or update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param resource: Parameters for the create or update operation. + :type resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ServiceResource"]: + """Operation to update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param resource: Parameters for the update operation. + :type resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def list_test_keys( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": + """List test keys for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_test_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + + async def regenerate_test_key( + self, + resource_group_name: str, + service_name: str, + regenerate_test_key_request: "_models.RegenerateTestKeyRequestPayload", + **kwargs: Any + ) -> "_models.TestKeys": + """Regenerate a test key for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param regenerate_test_key_request: Parameters for the operation. + :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2020_11_01_preview.models.RegenerateTestKeyRequestPayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_test_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore + + async def disable_test_endpoint( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: + """Disable test endpoint functionality for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.disable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + + async def enable_test_endpoint( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": + """Enable test endpoint functionality for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.enable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore + + async def check_name_availability( + self, + location: str, + availability_parameters: "_models.NameAvailabilityParameters", + **kwargs: Any + ) -> "_models.NameAvailability": + """Checks that the resource name is valid and is not already in use. + + :param location: the region. + :type location: str + :param availability_parameters: Parameters supplied to the operation. + :type availability_parameters: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailability + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailability"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NameAvailability', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ServiceResourceList"]: + """Handles requests to list all resources in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ServiceResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + + def list( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ServiceResourceList"]: + """Handles requests to list all resources in a resource group. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ServiceResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_skus_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_skus_operations.py new file mode 100644 index 00000000000..7fe9f418d62 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_skus_operations.py @@ -0,0 +1,108 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SkusOperations: + """SkusOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_11_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ResourceSkuCollection"]: + """Lists all of the available skus of the Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/models/__init__.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/models/__init__.py index 43fd5c13f36..6ff92bf6005 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/models/__init__.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/models/__init__.py @@ -1,23 +1,25 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- try: - from ._models_py3 import ApplicationInsightsAgentVersions from ._models_py3 import AppResource + from ._models_py3 import AppResourceCollection from ._models_py3 import AppResourceProperties + from ._models_py3 import ApplicationInsightsAgentVersions + from ._models_py3 import AvailableOperations from ._models_py3 import AvailableRuntimeVersions from ._models_py3 import BindingResource + from ._models_py3 import BindingResourceCollection from ._models_py3 import BindingResourceProperties from ._models_py3 import CertificateProperties from ._models_py3 import CertificateResource + from ._models_py3 import CertificateResourceCollection + from ._models_py3 import CloudErrorBody from ._models_py3 import ClusterResourceProperties from ._models_py3 import ConfigServerGitProperty from ._models_py3 import ConfigServerProperties @@ -27,10 +29,12 @@ from ._models_py3 import ConfigServerSettingsValidateResult from ._models_py3 import CustomDomainProperties from ._models_py3 import CustomDomainResource + from ._models_py3 import CustomDomainResourceCollection from ._models_py3 import CustomDomainValidatePayload from ._models_py3 import CustomDomainValidateResult from ._models_py3 import DeploymentInstance from ._models_py3 import DeploymentResource + from ._models_py3 import DeploymentResourceCollection from ._models_py3 import DeploymentResourceProperties from ._models_py3 import DeploymentSettings from ._models_py3 import Error @@ -56,12 +60,14 @@ from ._models_py3 import Resource from ._models_py3 import ResourceSku from ._models_py3 import ResourceSkuCapabilities + from ._models_py3 import ResourceSkuCollection from ._models_py3 import ResourceSkuLocationInfo from ._models_py3 import ResourceSkuRestrictionInfo from ._models_py3 import ResourceSkuRestrictions from ._models_py3 import ResourceSkuZoneDetails from ._models_py3 import ResourceUploadDefinition from ._models_py3 import ServiceResource + from ._models_py3 import ServiceResourceList from ._models_py3 import ServiceSpecification from ._models_py3 import Sku from ._models_py3 import SkuCapacity @@ -71,102 +77,109 @@ from ._models_py3 import TrackedResource from ._models_py3 import UserSourceInfo except (SyntaxError, ImportError): - from ._models import ApplicationInsightsAgentVersions - from ._models import AppResource - from ._models import AppResourceProperties - from ._models import AvailableRuntimeVersions - from ._models import BindingResource - from ._models import BindingResourceProperties - from ._models import CertificateProperties - from ._models import CertificateResource - from ._models import ClusterResourceProperties - from ._models import ConfigServerGitProperty - from ._models import ConfigServerProperties - from ._models import ConfigServerResource - from ._models import ConfigServerSettings - from ._models import ConfigServerSettingsErrorRecord - from ._models import ConfigServerSettingsValidateResult - from ._models import CustomDomainProperties - from ._models import CustomDomainResource - from ._models import CustomDomainValidatePayload - from ._models import CustomDomainValidateResult - from ._models import DeploymentInstance - from ._models import DeploymentResource - from ._models import DeploymentResourceProperties - from ._models import DeploymentSettings - from ._models import Error - from ._models import GitPatternRepository - from ._models import LogFileUrlResponse - from ._models import LogSpecification - from ._models import ManagedIdentityProperties - from ._models import MetricDimension - from ._models import MetricSpecification - from ._models import MonitoringSettingProperties - from ._models import MonitoringSettingResource - from ._models import NameAvailability - from ._models import NameAvailabilityParameters - from ._models import NetworkProfile - from ._models import NetworkProfileOutboundIPs - from ._models import OperationDetail - from ._models import OperationDisplay - from ._models import OperationProperties - from ._models import PersistentDisk - from ._models import ProxyResource - from ._models import RegenerateTestKeyRequestPayload - from ._models import RequiredTraffic - from ._models import Resource - from ._models import ResourceSku - from ._models import ResourceSkuCapabilities - from ._models import ResourceSkuLocationInfo - from ._models import ResourceSkuRestrictionInfo - from ._models import ResourceSkuRestrictions - from ._models import ResourceSkuZoneDetails - from ._models import ResourceUploadDefinition - from ._models import ServiceResource - from ._models import ServiceSpecification - from ._models import Sku - from ._models import SkuCapacity - from ._models import SupportedRuntimeVersion - from ._models import TemporaryDisk - from ._models import TestKeys - from ._models import TrackedResource - from ._models import UserSourceInfo -from ._paged_models import AppResourcePaged -from ._paged_models import BindingResourcePaged -from ._paged_models import CertificateResourcePaged -from ._paged_models import CustomDomainResourcePaged -from ._paged_models import DeploymentResourcePaged -from ._paged_models import OperationDetailPaged -from ._paged_models import ResourceSkuPaged -from ._paged_models import ServiceResourcePaged + from ._models import AppResource # type: ignore + from ._models import AppResourceCollection # type: ignore + from ._models import AppResourceProperties # type: ignore + from ._models import ApplicationInsightsAgentVersions # type: ignore + from ._models import AvailableOperations # type: ignore + from ._models import AvailableRuntimeVersions # type: ignore + from ._models import BindingResource # type: ignore + from ._models import BindingResourceCollection # type: ignore + from ._models import BindingResourceProperties # type: ignore + from ._models import CertificateProperties # type: ignore + from ._models import CertificateResource # type: ignore + from ._models import CertificateResourceCollection # type: ignore + from ._models import CloudErrorBody # type: ignore + from ._models import ClusterResourceProperties # type: ignore + from ._models import ConfigServerGitProperty # type: ignore + from ._models import ConfigServerProperties # type: ignore + from ._models import ConfigServerResource # type: ignore + from ._models import ConfigServerSettings # type: ignore + from ._models import ConfigServerSettingsErrorRecord # type: ignore + from ._models import ConfigServerSettingsValidateResult # type: ignore + from ._models import CustomDomainProperties # type: ignore + from ._models import CustomDomainResource # type: ignore + from ._models import CustomDomainResourceCollection # type: ignore + from ._models import CustomDomainValidatePayload # type: ignore + from ._models import CustomDomainValidateResult # type: ignore + from ._models import DeploymentInstance # type: ignore + from ._models import DeploymentResource # type: ignore + from ._models import DeploymentResourceCollection # type: ignore + from ._models import DeploymentResourceProperties # type: ignore + from ._models import DeploymentSettings # type: ignore + from ._models import Error # type: ignore + from ._models import GitPatternRepository # type: ignore + from ._models import LogFileUrlResponse # type: ignore + from ._models import LogSpecification # type: ignore + from ._models import ManagedIdentityProperties # type: ignore + from ._models import MetricDimension # type: ignore + from ._models import MetricSpecification # type: ignore + from ._models import MonitoringSettingProperties # type: ignore + from ._models import MonitoringSettingResource # type: ignore + from ._models import NameAvailability # type: ignore + from ._models import NameAvailabilityParameters # type: ignore + from ._models import NetworkProfile # type: ignore + from ._models import NetworkProfileOutboundIPs # type: ignore + from ._models import OperationDetail # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationProperties # type: ignore + from ._models import PersistentDisk # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import RegenerateTestKeyRequestPayload # type: ignore + from ._models import RequiredTraffic # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceSku # type: ignore + from ._models import ResourceSkuCapabilities # type: ignore + from ._models import ResourceSkuCollection # type: ignore + from ._models import ResourceSkuLocationInfo # type: ignore + from ._models import ResourceSkuRestrictionInfo # type: ignore + from ._models import ResourceSkuRestrictions # type: ignore + from ._models import ResourceSkuZoneDetails # type: ignore + from ._models import ResourceUploadDefinition # type: ignore + from ._models import ServiceResource # type: ignore + from ._models import ServiceResourceList # type: ignore + from ._models import ServiceSpecification # type: ignore + from ._models import Sku # type: ignore + from ._models import SkuCapacity # type: ignore + from ._models import SupportedRuntimeVersion # type: ignore + from ._models import TemporaryDisk # type: ignore + from ._models import TestKeys # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import UserSourceInfo # type: ignore + from ._app_platform_management_client_enums import ( - ProvisioningState, - TrafficDirection, - ManagedIdentityType, - ConfigServerState, - MonitoringSettingState, - TestKeyType, AppResourceProvisioningState, - UserSourceType, - RuntimeVersion, + ConfigServerState, DeploymentResourceProvisioningState, DeploymentResourceStatus, - SkuScaleType, - ResourceSkuRestrictionsType, + ManagedIdentityType, + MonitoringSettingState, + ProvisioningState, ResourceSkuRestrictionsReasonCode, - SupportedRuntimeValue, + ResourceSkuRestrictionsType, + RuntimeVersion, + SkuScaleType, SupportedRuntimePlatform, + SupportedRuntimeValue, + TestKeyType, + TrafficDirection, + UserSourceType, ) __all__ = [ - 'ApplicationInsightsAgentVersions', 'AppResource', + 'AppResourceCollection', 'AppResourceProperties', + 'ApplicationInsightsAgentVersions', + 'AvailableOperations', 'AvailableRuntimeVersions', 'BindingResource', + 'BindingResourceCollection', 'BindingResourceProperties', 'CertificateProperties', 'CertificateResource', + 'CertificateResourceCollection', + 'CloudErrorBody', 'ClusterResourceProperties', 'ConfigServerGitProperty', 'ConfigServerProperties', @@ -176,10 +189,12 @@ 'ConfigServerSettingsValidateResult', 'CustomDomainProperties', 'CustomDomainResource', + 'CustomDomainResourceCollection', 'CustomDomainValidatePayload', 'CustomDomainValidateResult', 'DeploymentInstance', 'DeploymentResource', + 'DeploymentResourceCollection', 'DeploymentResourceProperties', 'DeploymentSettings', 'Error', @@ -205,12 +220,14 @@ 'Resource', 'ResourceSku', 'ResourceSkuCapabilities', + 'ResourceSkuCollection', 'ResourceSkuLocationInfo', 'ResourceSkuRestrictionInfo', 'ResourceSkuRestrictions', 'ResourceSkuZoneDetails', 'ResourceUploadDefinition', 'ServiceResource', + 'ServiceResourceList', 'ServiceSpecification', 'Sku', 'SkuCapacity', @@ -219,28 +236,20 @@ 'TestKeys', 'TrackedResource', 'UserSourceInfo', - 'ServiceResourcePaged', - 'AppResourcePaged', - 'BindingResourcePaged', - 'CertificateResourcePaged', - 'CustomDomainResourcePaged', - 'DeploymentResourcePaged', - 'OperationDetailPaged', - 'ResourceSkuPaged', - 'ProvisioningState', - 'TrafficDirection', - 'ManagedIdentityType', - 'ConfigServerState', - 'MonitoringSettingState', - 'TestKeyType', 'AppResourceProvisioningState', - 'UserSourceType', - 'RuntimeVersion', + 'ConfigServerState', 'DeploymentResourceProvisioningState', 'DeploymentResourceStatus', - 'SkuScaleType', - 'ResourceSkuRestrictionsType', + 'ManagedIdentityType', + 'MonitoringSettingState', + 'ProvisioningState', 'ResourceSkuRestrictionsReasonCode', - 'SupportedRuntimeValue', + 'ResourceSkuRestrictionsType', + 'RuntimeVersion', + 'SkuScaleType', 'SupportedRuntimePlatform', + 'SupportedRuntimeValue', + 'TestKeyType', + 'TrafficDirection', + 'UserSourceType', ] diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/models/_app_platform_management_client_enums.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/models/_app_platform_management_client_enums.py index 5ae8632fbad..5ac8dede62c 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/models/_app_platform_management_client_enums.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/models/_app_platform_management_client_enums.py @@ -1,135 +1,167 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum - - -class ProvisioningState(str, Enum): - - creating = "Creating" - updating = "Updating" - deleting = "Deleting" - deleted = "Deleted" - succeeded = "Succeeded" - failed = "Failed" - moving = "Moving" - moved = "Moved" - move_failed = "MoveFailed" - - -class TrafficDirection(str, Enum): - - inbound = "Inbound" - outbound = "Outbound" - - -class ManagedIdentityType(str, Enum): - - none = "None" - system_assigned = "SystemAssigned" - user_assigned = "UserAssigned" - system_assigned_user_assigned = "SystemAssigned,UserAssigned" - - -class ConfigServerState(str, Enum): - - not_available = "NotAvailable" - deleted = "Deleted" - failed = "Failed" - succeeded = "Succeeded" - updating = "Updating" - - -class MonitoringSettingState(str, Enum): - - not_available = "NotAvailable" - failed = "Failed" - succeeded = "Succeeded" - updating = "Updating" - - -class TestKeyType(str, Enum): - - primary = "Primary" - secondary = "Secondary" - - -class AppResourceProvisioningState(str, Enum): - - succeeded = "Succeeded" - failed = "Failed" - creating = "Creating" - updating = "Updating" - - -class UserSourceType(str, Enum): - - jar = "Jar" - net_core_zip = "NetCoreZip" - source = "Source" - - -class RuntimeVersion(str, Enum): - - java_8 = "Java_8" - java_11 = "Java_11" - net_core_31 = "NetCore_31" - - -class DeploymentResourceProvisioningState(str, Enum): - - creating = "Creating" - updating = "Updating" - succeeded = "Succeeded" - failed = "Failed" - - -class DeploymentResourceStatus(str, Enum): - - unknown = "Unknown" - stopped = "Stopped" - running = "Running" - failed = "Failed" - allocating = "Allocating" - upgrading = "Upgrading" - compiling = "Compiling" - - -class SkuScaleType(str, Enum): - - none = "None" - manual = "Manual" - automatic = "Automatic" - - -class ResourceSkuRestrictionsType(str, Enum): - - location = "Location" - zone = "Zone" - - -class ResourceSkuRestrictionsReasonCode(str, Enum): - - quota_id = "QuotaId" - not_available_for_subscription = "NotAvailableForSubscription" - - -class SupportedRuntimeValue(str, Enum): - - java_8 = "Java_8" - java_11 = "Java_11" - net_core_31 = "NetCore_31" - - -class SupportedRuntimePlatform(str, Enum): - - java = "Java" - net_core = ".NET Core" +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the App + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CREATING = "Creating" + UPDATING = "Updating" + +class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State of the config server. + """ + + NOT_AVAILABLE = "NotAvailable" + DELETED = "Deleted" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + +class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Deployment + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + +class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of the Deployment + """ + + UNKNOWN = "Unknown" + STOPPED = "Stopped" + RUNNING = "Running" + FAILED = "Failed" + ALLOCATING = "Allocating" + UPGRADING = "Upgrading" + COMPILING = "Compiling" + +class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the managed identity + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + +class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State of the Monitoring Setting. + """ + + NOT_AVAILABLE = "NotAvailable" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Service + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + DELETED = "Deleted" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + MOVING = "Moving" + MOVED = "Moved" + MOVE_FAILED = "MoveFailed" + +class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription' + """ + + QUOTA_ID = "QuotaId" + NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" + +class ResourceSkuRestrictionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Gets the type of restrictions. Possible values include: 'Location', 'Zone' + """ + + LOCATION = "Location" + ZONE = "Zone" + +class RuntimeVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Runtime version + """ + + JAVA8 = "Java_8" + JAVA11 = "Java_11" + NET_CORE31 = "NetCore_31" + +class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Gets or sets the type of the scale. + """ + + NONE = "None" + MANUAL = "Manual" + AUTOMATIC = "Automatic" + +class SupportedRuntimePlatform(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The platform of this runtime version (possible values: "Java" or ".NET"). + """ + + JAVA = "Java" + _NET_CORE = ".NET Core" + +class SupportedRuntimeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The raw value which could be passed to deployment CRUD operations. + """ + + JAVA8 = "Java_8" + JAVA11 = "Java_11" + NET_CORE31 = "NetCore_31" + +class TestKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the test key + """ + + PRIMARY = "Primary" + SECONDARY = "Secondary" + +class TrafficDirection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The direction of required traffic + """ + + INBOUND = "Inbound" + OUTBOUND = "Outbound" + +class UserSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the source uploaded + """ + + JAR = "Jar" + NET_CORE_ZIP = "NetCoreZip" + SOURCE = "Source" diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/models/_models.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/models/_models.py index f8f5be052bd..6a3b321f02f 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/models/_models.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/models/_models.py @@ -1,25 +1,20 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +import msrest.serialization -class ApplicationInsightsAgentVersions(Model): +class ApplicationInsightsAgentVersions(msrest.serialization.Model): """Application Insights agent versions properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar java: Indicates the version of application insight java agent + :ivar java: Indicates the version of application insight java agent. :vartype java: str """ @@ -31,16 +26,18 @@ class ApplicationInsightsAgentVersions(Model): 'java': {'key': 'java', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ApplicationInsightsAgentVersions, self).__init__(**kwargs) self.java = None -class Resource(Model): +class Resource(msrest.serialization.Model): """The core properties of ARM resources. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -62,7 +59,10 @@ class Resource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -70,11 +70,9 @@ def __init__(self, **kwargs): class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have - everything other than required location and tags. + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -96,15 +94,17 @@ class ProxyResource(Resource): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ProxyResource, self).__init__(**kwargs) class AppResource(ProxyResource): """App resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -112,14 +112,11 @@ class AppResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the App resource - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceProperties - :param identity: The Managed Identity type of the app resource - :type identity: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityProperties - :param location: The GEO location of the application, always the same with - its parent resource + :param properties: Properties of the App resource. + :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceProperties + :param identity: The Managed Identity type of the app resource. + :type identity: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityProperties + :param location: The GEO location of the application, always the same with its parent resource. :type location: str """ @@ -138,41 +135,65 @@ class AppResource(ProxyResource): 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.identity = kwargs.get('identity', None) self.location = kwargs.get('location', None) -class AppResourceProperties(Model): +class AppResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :param value: Collection of App resources. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AppResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class AppResourceProperties(msrest.serialization.Model): """App resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param public: Indicates whether the App exposes public endpoint + :param public: Indicates whether the App exposes public endpoint. :type public: bool - :ivar url: URL of the App + :ivar url: URL of the App. :vartype url: str - :ivar provisioning_state: Provisioning state of the App. Possible values - include: 'Succeeded', 'Failed', 'Creating', 'Updating' + :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", + "Failed", "Creating", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceProvisioningState - :param active_deployment_name: Name of the active deployment of the App + :param active_deployment_name: Name of the active deployment of the App. :type active_deployment_name: str :param fqdn: Fully qualified dns Name. :type fqdn: str :param https_only: Indicate if only https is allowed. :type https_only: bool - :ivar created_time: Date time when the resource is created - :vartype created_time: datetime - :param temporary_disk: Temporary disk settings - :type temporary_disk: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.TemporaryDisk - :param persistent_disk: Persistent disk settings - :type persistent_disk: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.PersistentDisk + :ivar created_time: Date time when the resource is created. + :vartype created_time: ~datetime.datetime + :param temporary_disk: Temporary disk settings. + :type temporary_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TemporaryDisk + :param persistent_disk: Persistent disk settings. + :type persistent_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.PersistentDisk :param enable_end_to_end_tls: Indicate if end to end TLS is enabled. :type enable_end_to_end_tls: bool """ @@ -196,25 +217,51 @@ class AppResourceProperties(Model): 'enable_end_to_end_tls': {'key': 'enableEndToEndTLS', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppResourceProperties, self).__init__(**kwargs) self.public = kwargs.get('public', None) self.url = None self.provisioning_state = None self.active_deployment_name = kwargs.get('active_deployment_name', None) self.fqdn = kwargs.get('fqdn', None) - self.https_only = kwargs.get('https_only', None) + self.https_only = kwargs.get('https_only', False) self.created_time = None self.temporary_disk = kwargs.get('temporary_disk', None) self.persistent_disk = kwargs.get('persistent_disk', None) - self.enable_end_to_end_tls = kwargs.get('enable_end_to_end_tls', None) + self.enable_end_to_end_tls = kwargs.get('enable_end_to_end_tls', False) + +class AvailableOperations(msrest.serialization.Model): + """Available operations of the service. -class AvailableRuntimeVersions(Model): + :param value: Collection of available operation details. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDetail] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationDetail]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AvailableOperations, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class AvailableRuntimeVersions(msrest.serialization.Model): """AvailableRuntimeVersions. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar value: A list of all supported runtime versions. :vartype value: @@ -229,7 +276,10 @@ class AvailableRuntimeVersions(Model): 'value': {'key': 'value', 'type': '[SupportedRuntimeVersion]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -237,8 +287,7 @@ def __init__(self, **kwargs): class BindingResource(ProxyResource): """Binding resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -246,9 +295,8 @@ class BindingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Binding resource - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceProperties + :param properties: Properties of the Binding resource. + :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceProperties """ _validation = { @@ -264,34 +312,59 @@ class BindingResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'BindingResourceProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BindingResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class BindingResourceProperties(Model): +class BindingResourceCollection(msrest.serialization.Model): + """Object that includes an array of Binding resources and a possible link for next set. + + :param value: Collection of Binding resources. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BindingResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BindingResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class BindingResourceProperties(msrest.serialization.Model): """Binding resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar resource_name: The name of the bound resource + :ivar resource_name: The name of the bound resource. :vartype resource_name: str - :ivar resource_type: The standard Azure resource type of the bound - resource + :ivar resource_type: The standard Azure resource type of the bound resource. :vartype resource_type: str - :param resource_id: The Azure resource id of the bound resource + :param resource_id: The Azure resource id of the bound resource. :type resource_id: str - :param key: The key of the bound resource + :param key: The key of the bound resource. :type key: str - :param binding_parameters: Binding parameters of the Binding resource - :type binding_parameters: dict[str, object] - :ivar generated_properties: The generated Spring Boot property file for - this binding. The secret will be deducted. + :param binding_parameters: Binding parameters of the Binding resource. + :type binding_parameters: dict[str, any] + :ivar generated_properties: The generated Spring Boot property file for this binding. The + secret will be deducted. :vartype generated_properties: str - :ivar created_at: Creation time of the Binding resource + :ivar created_at: Creation time of the Binding resource. :vartype created_at: str - :ivar updated_at: Update time of the Binding resource + :ivar updated_at: Update time of the Binding resource. :vartype updated_at: str """ @@ -314,7 +387,10 @@ class BindingResourceProperties(Model): 'updated_at': {'key': 'updatedAt', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -326,11 +402,10 @@ def __init__(self, **kwargs): self.updated_at = None -class CertificateProperties(Model): +class CertificateProperties(msrest.serialization.Model): """Certificate resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -381,11 +456,14 @@ class CertificateProperties(Model): 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateProperties, self).__init__(**kwargs) self.thumbprint = None - self.vault_uri = kwargs.get('vault_uri', None) - self.key_vault_cert_name = kwargs.get('key_vault_cert_name', None) + self.vault_uri = kwargs['vault_uri'] + self.key_vault_cert_name = kwargs['key_vault_cert_name'] self.cert_version = kwargs.get('cert_version', None) self.issuer = None self.issued_date = None @@ -398,8 +476,7 @@ def __init__(self, **kwargs): class CertificateResource(ProxyResource): """Certificate resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -408,8 +485,7 @@ class CertificateResource(ProxyResource): :ivar type: The type of the resource. :vartype type: str :param properties: Properties of the certificate resource payload. - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateProperties + :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateProperties """ _validation = { @@ -425,55 +501,51 @@ class CertificateResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class CloudError(Model): - """An error response from the service. +class CertificateResourceCollection(msrest.serialization.Model): + """Collection compose of certificate resources list and a possible link for next page. - :param error: An error response from the service. - :type error: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CloudErrorBody + :param value: The certificate resources list. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] + :param next_link: The link to next page of certificate list. + :type next_link: str """ _attribute_map = { - 'error': {'key': 'error', 'type': 'CloudErrorBody'}, + 'value': {'key': 'value', 'type': '[CertificateResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): - super(CloudError, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class CloudErrorException(HttpOperationError): - """Server responsed with exception of type: 'CloudError'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + def __init__( + self, + **kwargs + ): + super(CertificateResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) -class CloudErrorBody(Model): +class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are - intended to be consumed programmatically. + :param code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. :type code: str - :param message: A message describing the error, intended to be suitable - for display in a user interface. + :param message: A message describing the error, intended to be suitable for display in a user + interface. :type message: str - :param target: The target of the particular error. For example, the name - of the property in error. + :param target: The target of the particular error. For example, the name of the property in + error. :type target: str :param details: A list of additional details about the error. - :type details: - list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CloudErrorBody] + :type details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -483,7 +555,10 @@ class CloudErrorBody(Model): 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CloudErrorBody, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -491,24 +566,21 @@ def __init__(self, **kwargs): self.details = kwargs.get('details', None) -class ClusterResourceProperties(Model): +class ClusterResourceProperties(msrest.serialization.Model): """Service properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Provisioning state of the Service. Possible - values include: 'Creating', 'Updating', 'Deleting', 'Deleted', - 'Succeeded', 'Failed', 'Moving', 'Moved', 'MoveFailed' + :ivar provisioning_state: Provisioning state of the Service. Possible values include: + "Creating", "Updating", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", "Moved", + "MoveFailed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ProvisioningState - :param network_profile: Network profile of the Service - :type network_profile: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.NetworkProfile - :ivar version: Version of the Service + :param network_profile: Network profile of the Service. + :type network_profile: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NetworkProfile + :ivar version: Version of the Service. :vartype version: int - :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a - created resource + :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. :vartype service_id: str """ @@ -525,7 +597,10 @@ class ClusterResourceProperties(Model): 'service_id': {'key': 'serviceId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.network_profile = kwargs.get('network_profile', None) @@ -533,7 +608,7 @@ def __init__(self, **kwargs): self.service_id = None -class ConfigServerGitProperty(Model): +class ConfigServerGitProperty(msrest.serialization.Model): """Property of git. All required parameters must be populated in order to send to Azure. @@ -541,11 +616,11 @@ class ConfigServerGitProperty(Model): :param repositories: Repositories of git. :type repositories: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.GitPatternRepository] - :param uri: Required. URI of the repository + :param uri: Required. URI of the repository. :type uri: str - :param label: Label of the repository + :param label: Label of the repository. :type label: str - :param search_paths: Searching path of the repository + :param search_paths: Searching path of the repository. :type search_paths: list[str] :param username: Username of git repository basic auth. :type username: str @@ -578,10 +653,13 @@ class ConfigServerGitProperty(Model): 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = kwargs.get('repositories', None) - self.uri = kwargs.get('uri', None) + self.uri = kwargs['uri'] self.label = kwargs.get('label', None) self.search_paths = kwargs.get('search_paths', None) self.username = kwargs.get('username', None) @@ -592,21 +670,19 @@ def __init__(self, **kwargs): self.strict_host_key_checking = kwargs.get('strict_host_key_checking', None) -class ConfigServerProperties(Model): +class ConfigServerProperties(msrest.serialization.Model): """Config server git properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: State of the config server. Possible values - include: 'NotAvailable', 'Deleted', 'Failed', 'Succeeded', 'Updating' + :ivar provisioning_state: State of the config server. Possible values include: "NotAvailable", + "Deleted", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerState :param error: Error when apply config server settings. :type error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error :param config_server: Settings of config server. - :type config_server: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings + :type config_server: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings """ _validation = { @@ -619,7 +695,10 @@ class ConfigServerProperties(Model): 'config_server': {'key': 'configServer', 'type': 'ConfigServerSettings'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConfigServerProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = kwargs.get('error', None) @@ -629,8 +708,7 @@ def __init__(self, **kwargs): class ConfigServerResource(ProxyResource): """Config Server resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -638,9 +716,8 @@ class ConfigServerResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Config Server resource - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerProperties + :param properties: Properties of the Config Server resource. + :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerProperties """ _validation = { @@ -656,36 +733,41 @@ class ConfigServerResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'ConfigServerProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConfigServerResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class ConfigServerSettings(Model): +class ConfigServerSettings(msrest.serialization.Model): """The settings of config server. :param git_property: Property of git environment. - :type git_property: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerGitProperty + :type git_property: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerGitProperty """ _attribute_map = { 'git_property': {'key': 'gitProperty', 'type': 'ConfigServerGitProperty'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = kwargs.get('git_property', None) -class ConfigServerSettingsErrorRecord(Model): +class ConfigServerSettingsErrorRecord(msrest.serialization.Model): """Error record of the config server settings. - :param name: The name of the config server settings error record + :param name: The name of the config server settings error record. :type name: str - :param uri: The uri of the config server settings error record + :param uri: The uri of the config server settings error record. :type uri: str - :param messages: The detail error messages of the record + :param messages: The detail error messages of the record. :type messages: list[str] """ @@ -695,19 +777,22 @@ class ConfigServerSettingsErrorRecord(Model): 'messages': {'key': 'messages', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.uri = kwargs.get('uri', None) self.messages = kwargs.get('messages', None) -class ConfigServerSettingsValidateResult(Model): +class ConfigServerSettingsValidateResult(msrest.serialization.Model): """Validation result for config server settings. - :param is_valid: Indicate if the config server settings are valid + :param is_valid: Indicate if the config server settings are valid. :type is_valid: bool - :param details: The detail validation results + :param details: The detail validation results. :type details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettingsErrorRecord] """ @@ -717,17 +802,19 @@ class ConfigServerSettingsValidateResult(Model): 'details': {'key': 'details', 'type': '[ConfigServerSettingsErrorRecord]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) self.is_valid = kwargs.get('is_valid', None) self.details = kwargs.get('details', None) -class CustomDomainProperties(Model): +class CustomDomainProperties(msrest.serialization.Model): """Custom domain of app resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param thumbprint: The thumbprint of bound certificate. :type thumbprint: str @@ -747,7 +834,10 @@ class CustomDomainProperties(Model): 'cert_name': {'key': 'certName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = kwargs.get('thumbprint', None) self.app_name = None @@ -757,8 +847,7 @@ def __init__(self, **kwargs): class CustomDomainResource(ProxyResource): """Custom domain resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -767,8 +856,7 @@ class CustomDomainResource(ProxyResource): :ivar type: The type of the resource. :vartype type: str :param properties: Properties of the custom domain resource. - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainProperties + :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainProperties """ _validation = { @@ -784,17 +872,43 @@ class CustomDomainResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'CustomDomainProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CustomDomainResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class CustomDomainValidatePayload(Model): +class CustomDomainResourceCollection(msrest.serialization.Model): + """Collection compose of a custom domain resources list and a possible link for next page. + + :param value: The custom domain resources list. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] + :param next_link: The link to next page of custom domain list. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CustomDomainResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomDomainResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class CustomDomainValidatePayload(msrest.serialization.Model): """Custom domain validate payload. All required parameters must be populated in order to send to Azure. - :param name: Required. Name to be validated + :param name: Required. Name to be validated. :type name: str """ @@ -806,12 +920,15 @@ class CustomDomainValidatePayload(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CustomDomainValidatePayload, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + self.name = kwargs['name'] -class CustomDomainValidateResult(Model): +class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. :param is_valid: Indicates if domain name is valid. @@ -825,27 +942,29 @@ class CustomDomainValidateResult(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = kwargs.get('is_valid', None) self.message = kwargs.get('message', None) -class DeploymentInstance(Model): +class DeploymentInstance(msrest.serialization.Model): """Deployment instance payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Name of the deployment instance + :ivar name: Name of the deployment instance. :vartype name: str - :ivar status: Status of the deployment instance + :ivar status: Status of the deployment instance. :vartype status: str - :ivar reason: Failed reason of the deployment instance + :ivar reason: Failed reason of the deployment instance. :vartype reason: str - :ivar discovery_status: Discovery status of the deployment instance + :ivar discovery_status: Discovery status of the deployment instance. :vartype discovery_status: str - :ivar start_time: Start time of the deployment instance + :ivar start_time: Start time of the deployment instance. :vartype start_time: str """ @@ -865,7 +984,10 @@ class DeploymentInstance(Model): 'start_time': {'key': 'startTime', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -877,8 +999,7 @@ def __init__(self, **kwargs): class DeploymentResource(ProxyResource): """Deployment resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -886,10 +1007,10 @@ class DeploymentResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Deployment resource + :param properties: Properties of the Deployment resource. :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource + :param sku: Sku of the Deployment resource. :type sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku """ @@ -907,42 +1028,65 @@ class DeploymentResource(ProxyResource): 'sku': {'key': 'sku', 'type': 'Sku'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeploymentResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.sku = kwargs.get('sku', None) -class DeploymentResourceProperties(Model): +class DeploymentResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :param value: Collection of Deployment resources. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class DeploymentResourceProperties(msrest.serialization.Model): """Deployment resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param source: Uploaded source information of the deployment. - :type source: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceInfo - :ivar app_name: App name of the deployment + :type source: ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceInfo + :ivar app_name: App name of the deployment. :vartype app_name: str - :param deployment_settings: Deployment settings of the Deployment + :param deployment_settings: Deployment settings of the Deployment. :type deployment_settings: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Possible - values include: 'Creating', 'Updating', 'Succeeded', 'Failed' + :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: + "Creating", "Updating", "Succeeded", "Failed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Possible values include: - 'Unknown', 'Stopped', 'Running', 'Failed', 'Allocating', 'Upgrading', - 'Compiling' + :ivar status: Status of the Deployment. Possible values include: "Unknown", "Stopped", + "Running", "Failed", "Allocating", "Upgrading", "Compiling". :vartype status: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceStatus - :ivar active: Indicates whether the Deployment is active + :ivar active: Indicates whether the Deployment is active. :vartype active: bool - :ivar created_time: Date time when the resource is created - :vartype created_time: datetime - :ivar instances: Collection of instances belong to the Deployment - :vartype instances: - list[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentInstance] + :ivar created_time: Date time when the resource is created. + :vartype created_time: ~datetime.datetime + :ivar instances: Collection of instances belong to the Deployment. + :vartype instances: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentInstance] """ _validation = { @@ -965,7 +1109,10 @@ class DeploymentResourceProperties(Model): 'instances': {'key': 'instances', 'type': '[DeploymentInstance]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = kwargs.get('source', None) self.app_name = None @@ -977,26 +1124,23 @@ def __init__(self, **kwargs): self.instances = None -class DeploymentSettings(Model): +class DeploymentSettings(msrest.serialization.Model): """Deployment settings payload. - :param cpu: Required CPU, basic tier should be 1, standard tier should be - in range (1, 4). Default value: 1 . + :param cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). :type cpu: int - :param memory_in_gb: Required Memory size in GB, basic tier should be in - range (1, 2), standard tier should be in range (1, 8). Default value: 1 . + :param memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), standard + tier should be in range (1, 8). :type memory_in_gb: int - :param jvm_options: JVM parameter + :param jvm_options: JVM parameter. :type jvm_options: str - :param net_core_main_entry_path: The path to the .NET executable relative - to zip root + :param net_core_main_entry_path: The path to the .NET executable relative to zip root. :type net_core_main_entry_path: str - :param environment_variables: Collection of environment variables + :param environment_variables: Collection of environment variables. :type environment_variables: dict[str, str] - :param runtime_version: Runtime version. Possible values include: - 'Java_8', 'Java_11', 'NetCore_31' - :type runtime_version: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.RuntimeVersion + :param runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :type runtime_version: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.RuntimeVersion """ _attribute_map = { @@ -1008,17 +1152,20 @@ class DeploymentSettings(Model): 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeploymentSettings, self).__init__(**kwargs) self.cpu = kwargs.get('cpu', 1) self.memory_in_gb = kwargs.get('memory_in_gb', 1) self.jvm_options = kwargs.get('jvm_options', None) self.net_core_main_entry_path = kwargs.get('net_core_main_entry_path', None) self.environment_variables = kwargs.get('environment_variables', None) - self.runtime_version = kwargs.get('runtime_version', None) + self.runtime_version = kwargs.get('runtime_version', "Java_8") -class Error(Model): +class Error(msrest.serialization.Model): """The error code compose of code and message. :param code: The code of error. @@ -1032,26 +1179,29 @@ class Error(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Error, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) -class GitPatternRepository(Model): +class GitPatternRepository(msrest.serialization.Model): """Git repository property payload. All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the repository + :param name: Required. Name of the repository. :type name: str - :param pattern: Collection of pattern of the repository + :param pattern: Collection of pattern of the repository. :type pattern: list[str] - :param uri: Required. URI of the repository + :param uri: Required. URI of the repository. :type uri: str - :param label: Label of the repository + :param label: Label of the repository. :type label: str - :param search_paths: Searching path of the repository + :param search_paths: Searching path of the repository. :type search_paths: list[str] :param username: Username of git repository basic auth. :type username: str @@ -1086,11 +1236,14 @@ class GitPatternRepository(Model): 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(GitPatternRepository, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + self.name = kwargs['name'] self.pattern = kwargs.get('pattern', None) - self.uri = kwargs.get('uri', None) + self.uri = kwargs['uri'] self.label = kwargs.get('label', None) self.search_paths = kwargs.get('search_paths', None) self.username = kwargs.get('username', None) @@ -1101,12 +1254,12 @@ def __init__(self, **kwargs): self.strict_host_key_checking = kwargs.get('strict_host_key_checking', None) -class LogFileUrlResponse(Model): +class LogFileUrlResponse(msrest.serialization.Model): """Log file URL payload. All required parameters must be populated in order to send to Azure. - :param url: Required. URL of the log file + :param url: Required. URL of the log file. :type url: str """ @@ -1118,19 +1271,22 @@ class LogFileUrlResponse(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LogFileUrlResponse, self).__init__(**kwargs) - self.url = kwargs.get('url', None) + self.url = kwargs['url'] -class LogSpecification(Model): +class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :param name: Name of the log + :param name: Name of the log. :type name: str - :param display_name: Localized friendly display name of the log + :param display_name: Localized friendly display name of the log. :type display_name: str - :param blob_duration: Blob duration of the log + :param blob_duration: Blob duration of the log. :type blob_duration: str """ @@ -1140,23 +1296,25 @@ class LogSpecification(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LogSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) self.blob_duration = kwargs.get('blob_duration', None) -class ManagedIdentityProperties(Model): +class ManagedIdentityProperties(msrest.serialization.Model): """Managed identity properties retrieved from ARM request headers. - :param type: Type of the managed identity. Possible values include: - 'None', 'SystemAssigned', 'UserAssigned', 'SystemAssigned,UserAssigned' - :type type: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityType - :param principal_id: Principal Id + :param type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :type type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityType + :param principal_id: Principal Id. :type principal_id: str - :param tenant_id: Tenant Id + :param tenant_id: Tenant Id. :type tenant_id: str """ @@ -1166,60 +1324,70 @@ class ManagedIdentityProperties(Model): 'tenant_id': {'key': 'tenantId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.principal_id = kwargs.get('principal_id', None) self.tenant_id = kwargs.get('tenant_id', None) -class MetricDimension(Model): +class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension + :param name: Name of the dimension. :type name: str - :param display_name: Localized friendly display name of the dimension + :param display_name: Localized friendly display name of the dimension. :type display_name: str + :param to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :type to_be_exported_for_shoebox: bool """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'display_name': {'key': 'displayName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MetricDimension, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) + self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) -class MetricSpecification(Model): +class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :param name: Name of the metric + :param name: Name of the metric. :type name: str - :param display_name: Localized friendly display name of the metric + :param display_name: Localized friendly display name of the metric. :type display_name: str - :param display_description: Localized friendly description of the metric + :param display_description: Localized friendly description of the metric. :type display_description: str - :param unit: Unit that makes sense for the metric + :param unit: Unit that makes sense for the metric. :type unit: str - :param category: Name of the metric category that the metric belongs to. A - metric can only belong to a single category. + :param category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. :type category: str - :param aggregation_type: Only provide one value for this field. Valid - values: Average, Minimum, Maximum, Total, Count. + :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + Maximum, Total, Count. :type aggregation_type: str - :param supported_aggregation_types: Supported aggregation types + :param supported_aggregation_types: Supported aggregation types. :type supported_aggregation_types: list[str] - :param supported_time_grain_types: Supported time grain types + :param supported_time_grain_types: Supported time grain types. :type supported_time_grain_types: list[str] - :param fill_gap_with_zero: Optional. If set to true, then zero will be - returned for time duration where no metric is emitted/published. + :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. :type fill_gap_with_zero: bool - :param dimensions: Dimensions of the metric - :type dimensions: - list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricDimension] + :param dimensions: Dimensions of the metric. + :type dimensions: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricDimension] """ _attribute_map = { @@ -1235,7 +1403,10 @@ class MetricSpecification(Model): 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MetricSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1249,32 +1420,28 @@ def __init__(self, **kwargs): self.dimensions = kwargs.get('dimensions', None) -class MonitoringSettingProperties(Model): +class MonitoringSettingProperties(msrest.serialization.Model): """Monitoring Setting properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: State of the Monitoring Setting. Possible values - include: 'NotAvailable', 'Failed', 'Succeeded', 'Updating' + :ivar provisioning_state: State of the Monitoring Setting. Possible values include: + "NotAvailable", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingState :param error: Error when apply Monitoring Setting changes. :type error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error - :param trace_enabled: Indicates whether enable the trace functionality, - which will be deprecated since api version 2020-11-01-preview. Please - leverage appInsightsInstrumentationKey to indicate if monitoringSettings - enabled or not + :param trace_enabled: Indicates whether enable the trace functionality, which will be + deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey + to indicate if monitoringSettings enabled or not. :type trace_enabled: bool - :param app_insights_instrumentation_key: Target application insight - instrumentation key, null or whitespace include empty will disable - monitoringSettings + :param app_insights_instrumentation_key: Target application insight instrumentation key, null + or whitespace include empty will disable monitoringSettings. :type app_insights_instrumentation_key: str - :param app_insights_sampling_rate: Indicates the sampling rate of - application insight agent, should be in range [0.0, 100.0] + :param app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + should be in range [0.0, 100.0]. :type app_insights_sampling_rate: float - :param app_insights_agent_versions: Indicates the versions of application - insight agent + :param app_insights_agent_versions: Indicates the versions of application insight agent. :type app_insights_agent_versions: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ApplicationInsightsAgentVersions """ @@ -1293,7 +1460,10 @@ class MonitoringSettingProperties(Model): 'app_insights_agent_versions': {'key': 'appInsightsAgentVersions', 'type': 'ApplicationInsightsAgentVersions'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MonitoringSettingProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = kwargs.get('error', None) @@ -1306,8 +1476,7 @@ def __init__(self, **kwargs): class MonitoringSettingResource(ProxyResource): """Monitoring Setting resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -1315,7 +1484,7 @@ class MonitoringSettingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Monitoring Setting resource + :param properties: Properties of the Monitoring Setting resource. :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingProperties """ @@ -1333,19 +1502,22 @@ class MonitoringSettingResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'MonitoringSettingProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MonitoringSettingResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class NameAvailability(Model): +class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :param name_available: Indicates whether the name is available + :param name_available: Indicates whether the name is available. :type name_available: bool - :param reason: Reason why the name is not available + :param reason: Reason why the name is not available. :type reason: str - :param message: Message why the name is not available + :param message: Message why the name is not available. :type message: str """ @@ -1355,21 +1527,24 @@ class NameAvailability(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NameAvailability, self).__init__(**kwargs) self.name_available = kwargs.get('name_available', None) self.reason = kwargs.get('reason', None) self.message = kwargs.get('message', None) -class NameAvailabilityParameters(Model): +class NameAvailabilityParameters(msrest.serialization.Model): """Name availability parameters payload. All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the resource to check name availability + :param type: Required. Type of the resource to check name availability. :type type: str - :param name: Required. Name to be checked + :param name: Required. Name to be checked. :type name: str """ @@ -1383,44 +1558,44 @@ class NameAvailabilityParameters(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NameAvailabilityParameters, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.name = kwargs.get('name', None) + self.type = kwargs['type'] + self.name = kwargs['name'] -class NetworkProfile(Model): +class NetworkProfile(msrest.serialization.Model): """Service network profile payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param service_runtime_subnet_id: Fully qualified resource Id of the - subnet to host Azure Spring Cloud Service Runtime + :param service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. :type service_runtime_subnet_id: str - :param app_subnet_id: Fully qualified resource Id of the subnet to host - Azure Spring Cloud Apps + :param app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. :type app_subnet_id: str - :param service_cidr: Azure Spring Cloud service reserved CIDR + :param service_cidr: Azure Spring Cloud service reserved CIDR. :type service_cidr: str - :param service_runtime_network_resource_group: Name of the resource group - containing network resources of Azure Spring Cloud Service Runtime + :param service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. :type service_runtime_network_resource_group: str - :param app_network_resource_group: Name of the resource group containing - network resources of Azure Spring Cloud Apps + :param app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. :type app_network_resource_group: str - :ivar outbound_ips: Desired outbound IP resources for Azure Spring Cloud - instance. - :vartype outbound_ips: + :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Cloud instance. + :vartype outbound_i_ps: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure - Spring Cloud instance. + :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Cloud instance. :vartype required_traffics: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.RequiredTraffic] """ _validation = { - 'outbound_ips': {'readonly': True}, + 'outbound_i_ps': {'readonly': True}, 'required_traffics': {'readonly': True}, } @@ -1430,59 +1605,62 @@ class NetworkProfile(Model): 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, 'service_runtime_network_resource_group': {'key': 'serviceRuntimeNetworkResourceGroup', 'type': 'str'}, 'app_network_resource_group': {'key': 'appNetworkResourceGroup', 'type': 'str'}, - 'outbound_ips': {'key': 'outboundIPs', 'type': 'NetworkProfileOutboundIPs'}, + 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'NetworkProfileOutboundIPs'}, 'required_traffics': {'key': 'requiredTraffics', 'type': '[RequiredTraffic]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NetworkProfile, self).__init__(**kwargs) self.service_runtime_subnet_id = kwargs.get('service_runtime_subnet_id', None) self.app_subnet_id = kwargs.get('app_subnet_id', None) self.service_cidr = kwargs.get('service_cidr', None) self.service_runtime_network_resource_group = kwargs.get('service_runtime_network_resource_group', None) self.app_network_resource_group = kwargs.get('app_network_resource_group', None) - self.outbound_ips = None + self.outbound_i_ps = None self.required_traffics = None -class NetworkProfileOutboundIPs(Model): +class NetworkProfileOutboundIPs(msrest.serialization.Model): """Desired outbound IP resources for Azure Spring Cloud instance. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar public_ips: A list of public IP addresses. - :vartype public_ips: list[str] + :ivar public_i_ps: A list of public IP addresses. + :vartype public_i_ps: list[str] """ _validation = { - 'public_ips': {'readonly': True}, + 'public_i_ps': {'readonly': True}, } _attribute_map = { - 'public_ips': {'key': 'publicIPs', 'type': '[str]'}, + 'public_i_ps': {'key': 'publicIPs', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NetworkProfileOutboundIPs, self).__init__(**kwargs) - self.public_ips = None + self.public_i_ps = None -class OperationDetail(Model): +class OperationDetail(msrest.serialization.Model): """Operation detail payload. - :param name: Name of the operation + :param name: Name of the operation. :type name: str - :param is_data_action: Indicates whether the operation is a data action + :param is_data_action: Indicates whether the operation is a data action. :type is_data_action: bool - :param display: Display of the operation - :type display: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDisplay - :param origin: Origin of the operation + :param display: Display of the operation. + :type display: ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDisplay + :param origin: Origin of the operation. :type origin: str - :param properties: Properties of the operation - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationProperties + :param properties: Properties of the operation. + :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationProperties """ _attribute_map = { @@ -1493,7 +1671,10 @@ class OperationDetail(Model): 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OperationDetail, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.is_data_action = kwargs.get('is_data_action', None) @@ -1502,16 +1683,16 @@ def __init__(self, **kwargs): self.properties = kwargs.get('properties', None) -class OperationDisplay(Model): +class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :param provider: Resource provider of the operation + :param provider: Resource provider of the operation. :type provider: str - :param resource: Resource of the operation + :param resource: Resource of the operation. :type resource: str - :param operation: Localized friendly name for the operation + :param operation: Localized friendly name for the operation. :type operation: str - :param description: Localized friendly description for the operation + :param description: Localized friendly description for the operation. :type description: str """ @@ -1522,7 +1703,10 @@ class OperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OperationDisplay, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -1530,10 +1714,10 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) -class OperationProperties(Model): +class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :param service_specification: Service specifications of the operation + :param service_specification: Service specifications of the operation. :type service_specification: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceSpecification """ @@ -1542,22 +1726,24 @@ class OperationProperties(Model): 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OperationProperties, self).__init__(**kwargs) self.service_specification = kwargs.get('service_specification', None) -class PersistentDisk(Model): +class PersistentDisk(msrest.serialization.Model): """Persistent disk payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param size_in_gb: Size of the persistent disk in GB + :param size_in_gb: Size of the persistent disk in GB. :type size_in_gb: int - :ivar used_in_gb: Size of the used persistent disk in GB + :ivar used_in_gb: Size of the used persistent disk in GB. :vartype used_in_gb: int - :param mount_path: Mount path of the persistent disk + :param mount_path: Mount path of the persistent disk. :type mount_path: str """ @@ -1572,22 +1758,24 @@ class PersistentDisk(Model): 'mount_path': {'key': 'mountPath', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = kwargs.get('size_in_gb', None) self.used_in_gb = None self.mount_path = kwargs.get('mount_path', None) -class RegenerateTestKeyRequestPayload(Model): +class RegenerateTestKeyRequestPayload(msrest.serialization.Model): """Regenerate test key request payload. All required parameters must be populated in order to send to Azure. - :param key_type: Required. Type of the test key. Possible values include: - 'Primary', 'Secondary' - :type key_type: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeyType + :param key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :type key_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeyType """ _validation = { @@ -1598,29 +1786,30 @@ class RegenerateTestKeyRequestPayload(Model): 'key_type': {'key': 'keyType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) - self.key_type = kwargs.get('key_type', None) + self.key_type = kwargs['key_type'] -class RequiredTraffic(Model): +class RequiredTraffic(msrest.serialization.Model): """Required inbound or outbound traffic for Azure Spring Cloud instance. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar protocol: The protocol of required traffic + :ivar protocol: The protocol of required traffic. :vartype protocol: str - :ivar port: The port of required traffic + :ivar port: The port of required traffic. :vartype port: int - :ivar ips: The ip list of required traffic + :ivar ips: The ip list of required traffic. :vartype ips: list[str] - :ivar fqdns: The FQDN list of required traffic + :ivar fqdns: The FQDN list of required traffic. :vartype fqdns: list[str] - :ivar direction: The direction of required traffic. Possible values - include: 'Inbound', 'Outbound' - :vartype direction: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.TrafficDirection + :ivar direction: The direction of required traffic. Possible values include: "Inbound", + "Outbound". + :vartype direction: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.TrafficDirection """ _validation = { @@ -1639,7 +1828,10 @@ class RequiredTraffic(Model): 'direction': {'key': 'direction', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -1648,7 +1840,7 @@ def __init__(self, **kwargs): self.direction = None -class ResourceSku(Model): +class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. :param resource_type: Gets the type of resource the SKU applies to. @@ -1658,16 +1850,14 @@ class ResourceSku(Model): :param tier: Gets the tier of SKU. :type tier: str :param capacity: Gets the capacity of SKU. - :type capacity: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuCapacity + :type capacity: ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuCapacity :param locations: Gets the set of locations that the SKU is available. :type locations: list[str] - :param location_info: Gets a list of locations and availability zones in - those locations where the SKU is available. + :param location_info: Gets a list of locations and availability zones in those locations where + the SKU is available. :type location_info: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuLocationInfo] - :param restrictions: Gets the restrictions because of which SKU cannot be - used. This is + :param restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. :type restrictions: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictions] @@ -1683,7 +1873,10 @@ class ResourceSku(Model): 'restrictions': {'key': 'restrictions', 'type': '[ResourceSkuRestrictions]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSku, self).__init__(**kwargs) self.resource_type = kwargs.get('resource_type', None) self.name = kwargs.get('name', None) @@ -1694,7 +1887,7 @@ def __init__(self, **kwargs): self.restrictions = kwargs.get('restrictions', None) -class ResourceSkuCapabilities(Model): +class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. :param name: Gets an invariant to describe the feature. @@ -1708,21 +1901,47 @@ class ResourceSkuCapabilities(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.value = kwargs.get('value', None) -class ResourceSkuLocationInfo(Model): +class ResourceSkuCollection(msrest.serialization.Model): + """Object that includes an array of Azure Spring Cloud SKU and a possible link for next set. + + :param value: Collection of resource SKU. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSku] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceSku]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceSkuCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ResourceSkuLocationInfo(msrest.serialization.Model): """Locations and availability zones where the SKU is available. - :param location: Gets location of the SKU + :param location: Gets location of the SKU. :type location: str :param zones: Gets list of availability zones where the SKU is supported. :type zones: list[str] - :param zone_details: Gets details of capabilities available to a SKU in - specific zones. + :param zone_details: Gets details of capabilities available to a SKU in specific zones. :type zone_details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuZoneDetails] """ @@ -1733,17 +1952,20 @@ class ResourceSkuLocationInfo(Model): 'zone_details': {'key': 'zoneDetails', 'type': '[ResourceSkuZoneDetails]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.zones = kwargs.get('zones', None) self.zone_details = kwargs.get('zone_details', None) -class ResourceSkuRestrictionInfo(Model): +class ResourceSkuRestrictionInfo(msrest.serialization.Model): """Information about the restriction where the SKU cannot be used. - :param locations: Gets locations where the SKU is restricted + :param locations: Gets locations where the SKU is restricted. :type locations: list[str] :param zones: Gets list of availability zones where the SKU is restricted. :type zones: list[str] @@ -1754,29 +1976,32 @@ class ResourceSkuRestrictionInfo(Model): 'zones': {'key': 'zones', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = kwargs.get('locations', None) self.zones = kwargs.get('zones', None) -class ResourceSkuRestrictions(Model): +class ResourceSkuRestrictions(msrest.serialization.Model): """Restrictions where the SKU cannot be used. - :param type: Gets the type of restrictions. Possible values include: - 'Location', 'Zone' + :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". :type type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionsType - :param values: Gets the value of restrictions. If the restriction type is - set to + :param values: Gets the value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. :type values: list[str] - :param restriction_info: Gets the information about the restriction where - the SKU cannot be used. + :param restriction_info: Gets the information about the restriction where the SKU cannot be + used. :type restriction_info: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionInfo - :param reason_code: Gets the reason for restriction. Possible values - include: 'QuotaId', 'NotAvailableForSubscription' + :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". :type reason_code: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionsReasonCode """ @@ -1788,7 +2013,10 @@ class ResourceSkuRestrictions(Model): 'reason_code': {'key': 'reasonCode', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.values = kwargs.get('values', None) @@ -1796,14 +2024,13 @@ def __init__(self, **kwargs): self.reason_code = kwargs.get('reason_code', None) -class ResourceSkuZoneDetails(Model): +class ResourceSkuZoneDetails(msrest.serialization.Model): """Details of capabilities available to a SKU in specific zones. :param name: Gets the set of zones that the SKU is available in with the specified capabilities. :type name: list[str] - :param capabilities: Gets a list of capabilities that are available for - the SKU in the + :param capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. :type capabilities: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuCapabilities] @@ -1814,18 +2041,21 @@ class ResourceSkuZoneDetails(Model): 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.capabilities = kwargs.get('capabilities', None) -class ResourceUploadDefinition(Model): +class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :param relative_path: Source relative path + :param relative_path: Source relative path. :type relative_path: str - :param upload_url: Upload URL + :param upload_url: Upload URL. :type upload_url: str """ @@ -1834,7 +2064,10 @@ class ResourceUploadDefinition(Model): 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = kwargs.get('relative_path', None) self.upload_url = kwargs.get('upload_url', None) @@ -1843,8 +2076,7 @@ def __init__(self, **kwargs): class TrackedResource(Resource): """The resource model definition for a ARM tracked top level resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -1854,7 +2086,7 @@ class TrackedResource(Resource): :vartype type: str :param location: The GEO location of the resource. :type location: str - :param tags: Tags of the service which is a list of key value pairs that + :param tags: A set of tags. Tags of the service which is a list of key value pairs that describe the resource. :type tags: dict[str, str] """ @@ -1873,7 +2105,10 @@ class TrackedResource(Resource): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TrackedResource, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.tags = kwargs.get('tags', None) @@ -1882,8 +2117,7 @@ def __init__(self, **kwargs): class ServiceResource(TrackedResource): """Service resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -1893,13 +2127,12 @@ class ServiceResource(TrackedResource): :vartype type: str :param location: The GEO location of the resource. :type location: str - :param tags: Tags of the service which is a list of key value pairs that + :param tags: A set of tags. Tags of the service which is a list of key value pairs that describe the resource. :type tags: dict[str, str] - :param properties: Properties of the Service resource - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ClusterResourceProperties - :param sku: Sku of the Service resource + :param properties: Properties of the Service resource. + :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ClusterResourceProperties + :param sku: Sku of the Service resource. :type sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku """ @@ -1919,20 +2152,46 @@ class ServiceResource(TrackedResource): 'sku': {'key': 'sku', 'type': 'Sku'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServiceResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.sku = kwargs.get('sku', None) -class ServiceSpecification(Model): +class ServiceResourceList(msrest.serialization.Model): + """Object that includes an array of Service resources and a possible link for next set. + + :param value: Collection of Service resources. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ServiceResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ServiceResourceList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :param log_specifications: Specifications of the Log for Azure Monitoring + :param log_specifications: Specifications of the Log for Azure Monitoring. :type log_specifications: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.LogSpecification] - :param metric_specifications: Specifications of the Metrics for Azure - Monitoring + :param metric_specifications: Specifications of the Metrics for Azure Monitoring. :type metric_specifications: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricSpecification] """ @@ -1942,20 +2201,23 @@ class ServiceSpecification(Model): 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = kwargs.get('log_specifications', None) self.metric_specifications = kwargs.get('metric_specifications', None) -class Sku(Model): +class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :param name: Name of the Sku. Default value: "S0" . + :param name: Name of the Sku. :type name: str - :param tier: Tier of the Sku. Default value: "Standard" . + :param tier: Tier of the Sku. :type tier: str - :param capacity: Current capacity of the target resource + :param capacity: Current capacity of the target resource. :type capacity: int """ @@ -1965,14 +2227,17 @@ class Sku(Model): 'capacity': {'key': 'capacity', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Sku, self).__init__(**kwargs) self.name = kwargs.get('name', "S0") self.tier = kwargs.get('tier', "Standard") self.capacity = kwargs.get('capacity', None) -class SkuCapacity(Model): +class SkuCapacity(msrest.serialization.Model): """The SKU capacity. All required parameters must be populated in order to send to Azure. @@ -1983,10 +2248,9 @@ class SkuCapacity(Model): :type maximum: int :param default: Gets or sets the default. :type default: int - :param scale_type: Gets or sets the type of the scale. Possible values - include: 'None', 'Manual', 'Automatic' - :type scale_type: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuScaleType + :param scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :type scale_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuScaleType """ _validation = { @@ -2000,23 +2264,25 @@ class SkuCapacity(Model): 'scale_type': {'key': 'scaleType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SkuCapacity, self).__init__(**kwargs) - self.minimum = kwargs.get('minimum', None) + self.minimum = kwargs['minimum'] self.maximum = kwargs.get('maximum', None) self.default = kwargs.get('default', None) self.scale_type = kwargs.get('scale_type', None) -class SupportedRuntimeVersion(Model): +class SupportedRuntimeVersion(msrest.serialization.Model): """Supported deployment runtime version descriptor. - :param value: The raw value which could be passed to deployment CRUD - operations. Possible values include: 'Java_8', 'Java_11', 'NetCore_31' - :type value: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimeValue - :param platform: The platform of this runtime version (possible values: - "Java" or ".NET"). Possible values include: 'Java', '.NET Core' + :param value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :type value: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimeValue + :param platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". :type platform: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimePlatform :param version: The detailed version (major.minor) of the platform. @@ -2029,19 +2295,22 @@ class SupportedRuntimeVersion(Model): 'version': {'key': 'version', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.platform = kwargs.get('platform', None) self.version = kwargs.get('version', None) -class TemporaryDisk(Model): +class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :param size_in_gb: Size of the temporary disk in GB + :param size_in_gb: Size of the temporary disk in GB. :type size_in_gb: int - :param mount_path: Mount path of the temporary disk + :param mount_path: Mount path of the temporary disk. :type mount_path: str """ @@ -2054,24 +2323,27 @@ class TemporaryDisk(Model): 'mount_path': {'key': 'mountPath', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = kwargs.get('size_in_gb', None) - self.mount_path = kwargs.get('mount_path', None) + self.mount_path = kwargs.get('mount_path', "/tmp") -class TestKeys(Model): +class TestKeys(msrest.serialization.Model): """Test keys payload. - :param primary_key: Primary key + :param primary_key: Primary key. :type primary_key: str - :param secondary_key: Secondary key + :param secondary_key: Secondary key. :type secondary_key: str - :param primary_test_endpoint: Primary test endpoint + :param primary_test_endpoint: Primary test endpoint. :type primary_test_endpoint: str - :param secondary_test_endpoint: Secondary test endpoint + :param secondary_test_endpoint: Secondary test endpoint. :type secondary_test_endpoint: str - :param enabled: Indicates whether the test endpoint feature enabled or not + :param enabled: Indicates whether the test endpoint feature enabled or not. :type enabled: bool """ @@ -2083,7 +2355,10 @@ class TestKeys(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TestKeys, self).__init__(**kwargs) self.primary_key = kwargs.get('primary_key', None) self.secondary_key = kwargs.get('secondary_key', None) @@ -2092,19 +2367,18 @@ def __init__(self, **kwargs): self.enabled = kwargs.get('enabled', None) -class UserSourceInfo(Model): +class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :param type: Type of the source uploaded. Possible values include: 'Jar', - 'NetCoreZip', 'Source' - :type type: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceType - :param relative_path: Relative path of the storage which stores the source + :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source". + :type type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceType + :param relative_path: Relative path of the storage which stores the source. :type relative_path: str - :param version: Version of the source + :param version: Version of the source. :type version: str - :param artifact_selector: Selector for the artifact to be used for the - deployment for multi-module projects. This should be + :param artifact_selector: Selector for the artifact to be used for the deployment for + multi-module projects. This should be the relative path to the target module/project. :type artifact_selector: str """ @@ -2116,7 +2390,10 @@ class UserSourceInfo(Model): 'artifact_selector': {'key': 'artifactSelector', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(UserSourceInfo, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.relative_path = kwargs.get('relative_path', None) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/models/_models_py3.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/models/_models_py3.py index aff0c5844b1..ad133e58850 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/models/_models_py3.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/models/_models_py3.py @@ -1,25 +1,24 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +from typing import Any, Dict, List, Optional, Union +import msrest.serialization -class ApplicationInsightsAgentVersions(Model): +from ._app_platform_management_client_enums import * + + +class ApplicationInsightsAgentVersions(msrest.serialization.Model): """Application Insights agent versions properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar java: Indicates the version of application insight java agent + :ivar java: Indicates the version of application insight java agent. :vartype java: str """ @@ -31,16 +30,18 @@ class ApplicationInsightsAgentVersions(Model): 'java': {'key': 'java', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ApplicationInsightsAgentVersions, self).__init__(**kwargs) self.java = None -class Resource(Model): +class Resource(msrest.serialization.Model): """The core properties of ARM resources. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -62,7 +63,10 @@ class Resource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -70,11 +74,9 @@ def __init__(self, **kwargs) -> None: class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have - everything other than required location and tags. + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -96,15 +98,17 @@ class ProxyResource(Resource): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ProxyResource, self).__init__(**kwargs) class AppResource(ProxyResource): """App resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -112,14 +116,11 @@ class AppResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the App resource - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceProperties - :param identity: The Managed Identity type of the app resource - :type identity: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityProperties - :param location: The GEO location of the application, always the same with - its parent resource + :param properties: Properties of the App resource. + :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceProperties + :param identity: The Managed Identity type of the app resource. + :type identity: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityProperties + :param location: The GEO location of the application, always the same with its parent resource. :type location: str """ @@ -138,41 +139,72 @@ class AppResource(ProxyResource): 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, *, properties=None, identity=None, location: str=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["AppResourceProperties"] = None, + identity: Optional["ManagedIdentityProperties"] = None, + location: Optional[str] = None, + **kwargs + ): super(AppResource, self).__init__(**kwargs) self.properties = properties self.identity = identity self.location = location -class AppResourceProperties(Model): +class AppResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :param value: Collection of App resources. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["AppResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(AppResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AppResourceProperties(msrest.serialization.Model): """App resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param public: Indicates whether the App exposes public endpoint + :param public: Indicates whether the App exposes public endpoint. :type public: bool - :ivar url: URL of the App + :ivar url: URL of the App. :vartype url: str - :ivar provisioning_state: Provisioning state of the App. Possible values - include: 'Succeeded', 'Failed', 'Creating', 'Updating' + :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", + "Failed", "Creating", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceProvisioningState - :param active_deployment_name: Name of the active deployment of the App + :param active_deployment_name: Name of the active deployment of the App. :type active_deployment_name: str :param fqdn: Fully qualified dns Name. :type fqdn: str :param https_only: Indicate if only https is allowed. :type https_only: bool - :ivar created_time: Date time when the resource is created - :vartype created_time: datetime - :param temporary_disk: Temporary disk settings - :type temporary_disk: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.TemporaryDisk - :param persistent_disk: Persistent disk settings - :type persistent_disk: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.PersistentDisk + :ivar created_time: Date time when the resource is created. + :vartype created_time: ~datetime.datetime + :param temporary_disk: Temporary disk settings. + :type temporary_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TemporaryDisk + :param persistent_disk: Persistent disk settings. + :type persistent_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.PersistentDisk :param enable_end_to_end_tls: Indicate if end to end TLS is enabled. :type enable_end_to_end_tls: bool """ @@ -196,7 +228,18 @@ class AppResourceProperties(Model): 'enable_end_to_end_tls': {'key': 'enableEndToEndTLS', 'type': 'bool'}, } - def __init__(self, *, public: bool=None, active_deployment_name: str=None, fqdn: str=None, https_only: bool=None, temporary_disk=None, persistent_disk=None, enable_end_to_end_tls: bool=None, **kwargs) -> None: + def __init__( + self, + *, + public: Optional[bool] = None, + active_deployment_name: Optional[str] = None, + fqdn: Optional[str] = None, + https_only: Optional[bool] = False, + temporary_disk: Optional["TemporaryDisk"] = None, + persistent_disk: Optional["PersistentDisk"] = None, + enable_end_to_end_tls: Optional[bool] = False, + **kwargs + ): super(AppResourceProperties, self).__init__(**kwargs) self.public = public self.url = None @@ -210,11 +253,37 @@ def __init__(self, *, public: bool=None, active_deployment_name: str=None, fqdn: self.enable_end_to_end_tls = enable_end_to_end_tls -class AvailableRuntimeVersions(Model): +class AvailableOperations(msrest.serialization.Model): + """Available operations of the service. + + :param value: Collection of available operation details. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDetail] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationDetail]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["OperationDetail"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(AvailableOperations, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AvailableRuntimeVersions(msrest.serialization.Model): """AvailableRuntimeVersions. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar value: A list of all supported runtime versions. :vartype value: @@ -229,7 +298,10 @@ class AvailableRuntimeVersions(Model): 'value': {'key': 'value', 'type': '[SupportedRuntimeVersion]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -237,8 +309,7 @@ def __init__(self, **kwargs) -> None: class BindingResource(ProxyResource): """Binding resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -246,9 +317,8 @@ class BindingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Binding resource - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceProperties + :param properties: Properties of the Binding resource. + :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceProperties """ _validation = { @@ -264,34 +334,64 @@ class BindingResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'BindingResourceProperties'}, } - def __init__(self, *, properties=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["BindingResourceProperties"] = None, + **kwargs + ): super(BindingResource, self).__init__(**kwargs) self.properties = properties -class BindingResourceProperties(Model): +class BindingResourceCollection(msrest.serialization.Model): + """Object that includes an array of Binding resources and a possible link for next set. + + :param value: Collection of Binding resources. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BindingResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["BindingResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(BindingResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BindingResourceProperties(msrest.serialization.Model): """Binding resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar resource_name: The name of the bound resource + :ivar resource_name: The name of the bound resource. :vartype resource_name: str - :ivar resource_type: The standard Azure resource type of the bound - resource + :ivar resource_type: The standard Azure resource type of the bound resource. :vartype resource_type: str - :param resource_id: The Azure resource id of the bound resource + :param resource_id: The Azure resource id of the bound resource. :type resource_id: str - :param key: The key of the bound resource + :param key: The key of the bound resource. :type key: str - :param binding_parameters: Binding parameters of the Binding resource - :type binding_parameters: dict[str, object] - :ivar generated_properties: The generated Spring Boot property file for - this binding. The secret will be deducted. + :param binding_parameters: Binding parameters of the Binding resource. + :type binding_parameters: dict[str, any] + :ivar generated_properties: The generated Spring Boot property file for this binding. The + secret will be deducted. :vartype generated_properties: str - :ivar created_at: Creation time of the Binding resource + :ivar created_at: Creation time of the Binding resource. :vartype created_at: str - :ivar updated_at: Update time of the Binding resource + :ivar updated_at: Update time of the Binding resource. :vartype updated_at: str """ @@ -314,7 +414,14 @@ class BindingResourceProperties(Model): 'updated_at': {'key': 'updatedAt', 'type': 'str'}, } - def __init__(self, *, resource_id: str=None, key: str=None, binding_parameters=None, **kwargs) -> None: + def __init__( + self, + *, + resource_id: Optional[str] = None, + key: Optional[str] = None, + binding_parameters: Optional[Dict[str, Any]] = None, + **kwargs + ): super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -326,11 +433,10 @@ def __init__(self, *, resource_id: str=None, key: str=None, binding_parameters=N self.updated_at = None -class CertificateProperties(Model): +class CertificateProperties(msrest.serialization.Model): """Certificate resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -381,7 +487,14 @@ class CertificateProperties(Model): 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, } - def __init__(self, *, vault_uri: str, key_vault_cert_name: str, cert_version: str=None, **kwargs) -> None: + def __init__( + self, + *, + vault_uri: str, + key_vault_cert_name: str, + cert_version: Optional[str] = None, + **kwargs + ): super(CertificateProperties, self).__init__(**kwargs) self.thumbprint = None self.vault_uri = vault_uri @@ -398,8 +511,7 @@ def __init__(self, *, vault_uri: str, key_vault_cert_name: str, cert_version: st class CertificateResource(ProxyResource): """Certificate resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -408,8 +520,7 @@ class CertificateResource(ProxyResource): :ivar type: The type of the resource. :vartype type: str :param properties: Properties of the certificate resource payload. - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateProperties + :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateProperties """ _validation = { @@ -425,55 +536,56 @@ class CertificateResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, } - def __init__(self, *, properties=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["CertificateProperties"] = None, + **kwargs + ): super(CertificateResource, self).__init__(**kwargs) self.properties = properties -class CloudError(Model): - """An error response from the service. +class CertificateResourceCollection(msrest.serialization.Model): + """Collection compose of certificate resources list and a possible link for next page. - :param error: An error response from the service. - :type error: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CloudErrorBody + :param value: The certificate resources list. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] + :param next_link: The link to next page of certificate list. + :type next_link: str """ _attribute_map = { - 'error': {'key': 'error', 'type': 'CloudErrorBody'}, - } - - def __init__(self, *, error=None, **kwargs) -> None: - super(CloudError, self).__init__(**kwargs) - self.error = error - - -class CloudErrorException(HttpOperationError): - """Server responsed with exception of type: 'CloudError'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + 'value': {'key': 'value', 'type': '[CertificateResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["CertificateResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(CertificateResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link -class CloudErrorBody(Model): +class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are - intended to be consumed programmatically. + :param code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. :type code: str - :param message: A message describing the error, intended to be suitable - for display in a user interface. + :param message: A message describing the error, intended to be suitable for display in a user + interface. :type message: str - :param target: The target of the particular error. For example, the name - of the property in error. + :param target: The target of the particular error. For example, the name of the property in + error. :type target: str :param details: A list of additional details about the error. - :type details: - list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CloudErrorBody] + :type details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -483,7 +595,15 @@ class CloudErrorBody(Model): 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, } - def __init__(self, *, code: str=None, message: str=None, target: str=None, details=None, **kwargs) -> None: + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["CloudErrorBody"]] = None, + **kwargs + ): super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -491,24 +611,21 @@ def __init__(self, *, code: str=None, message: str=None, target: str=None, detai self.details = details -class ClusterResourceProperties(Model): +class ClusterResourceProperties(msrest.serialization.Model): """Service properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Provisioning state of the Service. Possible - values include: 'Creating', 'Updating', 'Deleting', 'Deleted', - 'Succeeded', 'Failed', 'Moving', 'Moved', 'MoveFailed' + :ivar provisioning_state: Provisioning state of the Service. Possible values include: + "Creating", "Updating", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", "Moved", + "MoveFailed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ProvisioningState - :param network_profile: Network profile of the Service - :type network_profile: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.NetworkProfile - :ivar version: Version of the Service + :param network_profile: Network profile of the Service. + :type network_profile: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NetworkProfile + :ivar version: Version of the Service. :vartype version: int - :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a - created resource + :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. :vartype service_id: str """ @@ -525,7 +642,12 @@ class ClusterResourceProperties(Model): 'service_id': {'key': 'serviceId', 'type': 'str'}, } - def __init__(self, *, network_profile=None, **kwargs) -> None: + def __init__( + self, + *, + network_profile: Optional["NetworkProfile"] = None, + **kwargs + ): super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.network_profile = network_profile @@ -533,7 +655,7 @@ def __init__(self, *, network_profile=None, **kwargs) -> None: self.service_id = None -class ConfigServerGitProperty(Model): +class ConfigServerGitProperty(msrest.serialization.Model): """Property of git. All required parameters must be populated in order to send to Azure. @@ -541,11 +663,11 @@ class ConfigServerGitProperty(Model): :param repositories: Repositories of git. :type repositories: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.GitPatternRepository] - :param uri: Required. URI of the repository + :param uri: Required. URI of the repository. :type uri: str - :param label: Label of the repository + :param label: Label of the repository. :type label: str - :param search_paths: Searching path of the repository + :param search_paths: Searching path of the repository. :type search_paths: list[str] :param username: Username of git repository basic auth. :type username: str @@ -578,7 +700,21 @@ class ConfigServerGitProperty(Model): 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, } - def __init__(self, *, uri: str, repositories=None, label: str=None, search_paths=None, username: str=None, password: str=None, host_key: str=None, host_key_algorithm: str=None, private_key: str=None, strict_host_key_checking: bool=None, **kwargs) -> None: + def __init__( + self, + *, + uri: str, + repositories: Optional[List["GitPatternRepository"]] = None, + label: Optional[str] = None, + search_paths: Optional[List[str]] = None, + username: Optional[str] = None, + password: Optional[str] = None, + host_key: Optional[str] = None, + host_key_algorithm: Optional[str] = None, + private_key: Optional[str] = None, + strict_host_key_checking: Optional[bool] = None, + **kwargs + ): super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = repositories self.uri = uri @@ -592,21 +728,19 @@ def __init__(self, *, uri: str, repositories=None, label: str=None, search_paths self.strict_host_key_checking = strict_host_key_checking -class ConfigServerProperties(Model): +class ConfigServerProperties(msrest.serialization.Model): """Config server git properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: State of the config server. Possible values - include: 'NotAvailable', 'Deleted', 'Failed', 'Succeeded', 'Updating' + :ivar provisioning_state: State of the config server. Possible values include: "NotAvailable", + "Deleted", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerState :param error: Error when apply config server settings. :type error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error :param config_server: Settings of config server. - :type config_server: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings + :type config_server: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings """ _validation = { @@ -619,7 +753,13 @@ class ConfigServerProperties(Model): 'config_server': {'key': 'configServer', 'type': 'ConfigServerSettings'}, } - def __init__(self, *, error=None, config_server=None, **kwargs) -> None: + def __init__( + self, + *, + error: Optional["Error"] = None, + config_server: Optional["ConfigServerSettings"] = None, + **kwargs + ): super(ConfigServerProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -629,8 +769,7 @@ def __init__(self, *, error=None, config_server=None, **kwargs) -> None: class ConfigServerResource(ProxyResource): """Config Server resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -638,9 +777,8 @@ class ConfigServerResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Config Server resource - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerProperties + :param properties: Properties of the Config Server resource. + :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerProperties """ _validation = { @@ -656,36 +794,45 @@ class ConfigServerResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'ConfigServerProperties'}, } - def __init__(self, *, properties=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["ConfigServerProperties"] = None, + **kwargs + ): super(ConfigServerResource, self).__init__(**kwargs) self.properties = properties -class ConfigServerSettings(Model): +class ConfigServerSettings(msrest.serialization.Model): """The settings of config server. :param git_property: Property of git environment. - :type git_property: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerGitProperty + :type git_property: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerGitProperty """ _attribute_map = { 'git_property': {'key': 'gitProperty', 'type': 'ConfigServerGitProperty'}, } - def __init__(self, *, git_property=None, **kwargs) -> None: + def __init__( + self, + *, + git_property: Optional["ConfigServerGitProperty"] = None, + **kwargs + ): super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = git_property -class ConfigServerSettingsErrorRecord(Model): +class ConfigServerSettingsErrorRecord(msrest.serialization.Model): """Error record of the config server settings. - :param name: The name of the config server settings error record + :param name: The name of the config server settings error record. :type name: str - :param uri: The uri of the config server settings error record + :param uri: The uri of the config server settings error record. :type uri: str - :param messages: The detail error messages of the record + :param messages: The detail error messages of the record. :type messages: list[str] """ @@ -695,19 +842,26 @@ class ConfigServerSettingsErrorRecord(Model): 'messages': {'key': 'messages', 'type': '[str]'}, } - def __init__(self, *, name: str=None, uri: str=None, messages=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + uri: Optional[str] = None, + messages: Optional[List[str]] = None, + **kwargs + ): super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) self.name = name self.uri = uri self.messages = messages -class ConfigServerSettingsValidateResult(Model): +class ConfigServerSettingsValidateResult(msrest.serialization.Model): """Validation result for config server settings. - :param is_valid: Indicate if the config server settings are valid + :param is_valid: Indicate if the config server settings are valid. :type is_valid: bool - :param details: The detail validation results + :param details: The detail validation results. :type details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettingsErrorRecord] """ @@ -717,17 +871,22 @@ class ConfigServerSettingsValidateResult(Model): 'details': {'key': 'details', 'type': '[ConfigServerSettingsErrorRecord]'}, } - def __init__(self, *, is_valid: bool=None, details=None, **kwargs) -> None: + def __init__( + self, + *, + is_valid: Optional[bool] = None, + details: Optional[List["ConfigServerSettingsErrorRecord"]] = None, + **kwargs + ): super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.details = details -class CustomDomainProperties(Model): +class CustomDomainProperties(msrest.serialization.Model): """Custom domain of app resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param thumbprint: The thumbprint of bound certificate. :type thumbprint: str @@ -747,7 +906,13 @@ class CustomDomainProperties(Model): 'cert_name': {'key': 'certName', 'type': 'str'}, } - def __init__(self, *, thumbprint: str=None, cert_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + thumbprint: Optional[str] = None, + cert_name: Optional[str] = None, + **kwargs + ): super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = thumbprint self.app_name = None @@ -757,8 +922,7 @@ def __init__(self, *, thumbprint: str=None, cert_name: str=None, **kwargs) -> No class CustomDomainResource(ProxyResource): """Custom domain resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -767,8 +931,7 @@ class CustomDomainResource(ProxyResource): :ivar type: The type of the resource. :vartype type: str :param properties: Properties of the custom domain resource. - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainProperties + :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainProperties """ _validation = { @@ -784,17 +947,48 @@ class CustomDomainResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'CustomDomainProperties'}, } - def __init__(self, *, properties=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["CustomDomainProperties"] = None, + **kwargs + ): super(CustomDomainResource, self).__init__(**kwargs) self.properties = properties -class CustomDomainValidatePayload(Model): +class CustomDomainResourceCollection(msrest.serialization.Model): + """Collection compose of a custom domain resources list and a possible link for next page. + + :param value: The custom domain resources list. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] + :param next_link: The link to next page of custom domain list. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CustomDomainResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["CustomDomainResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(CustomDomainResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CustomDomainValidatePayload(msrest.serialization.Model): """Custom domain validate payload. All required parameters must be populated in order to send to Azure. - :param name: Required. Name to be validated + :param name: Required. Name to be validated. :type name: str """ @@ -806,12 +1000,17 @@ class CustomDomainValidatePayload(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, name: str, **kwargs) -> None: + def __init__( + self, + *, + name: str, + **kwargs + ): super(CustomDomainValidatePayload, self).__init__(**kwargs) self.name = name -class CustomDomainValidateResult(Model): +class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. :param is_valid: Indicates if domain name is valid. @@ -825,27 +1024,32 @@ class CustomDomainValidateResult(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, is_valid: bool=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + is_valid: Optional[bool] = None, + message: Optional[str] = None, + **kwargs + ): super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.message = message -class DeploymentInstance(Model): +class DeploymentInstance(msrest.serialization.Model): """Deployment instance payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Name of the deployment instance + :ivar name: Name of the deployment instance. :vartype name: str - :ivar status: Status of the deployment instance + :ivar status: Status of the deployment instance. :vartype status: str - :ivar reason: Failed reason of the deployment instance + :ivar reason: Failed reason of the deployment instance. :vartype reason: str - :ivar discovery_status: Discovery status of the deployment instance + :ivar discovery_status: Discovery status of the deployment instance. :vartype discovery_status: str - :ivar start_time: Start time of the deployment instance + :ivar start_time: Start time of the deployment instance. :vartype start_time: str """ @@ -865,7 +1069,10 @@ class DeploymentInstance(Model): 'start_time': {'key': 'startTime', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -877,8 +1084,7 @@ def __init__(self, **kwargs) -> None: class DeploymentResource(ProxyResource): """Deployment resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -886,10 +1092,10 @@ class DeploymentResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Deployment resource + :param properties: Properties of the Deployment resource. :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource + :param sku: Sku of the Deployment resource. :type sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku """ @@ -907,42 +1113,71 @@ class DeploymentResource(ProxyResource): 'sku': {'key': 'sku', 'type': 'Sku'}, } - def __init__(self, *, properties=None, sku=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["DeploymentResourceProperties"] = None, + sku: Optional["Sku"] = None, + **kwargs + ): super(DeploymentResource, self).__init__(**kwargs) self.properties = properties self.sku = sku -class DeploymentResourceProperties(Model): +class DeploymentResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :param value: Collection of Deployment resources. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["DeploymentResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(DeploymentResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DeploymentResourceProperties(msrest.serialization.Model): """Deployment resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param source: Uploaded source information of the deployment. - :type source: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceInfo - :ivar app_name: App name of the deployment + :type source: ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceInfo + :ivar app_name: App name of the deployment. :vartype app_name: str - :param deployment_settings: Deployment settings of the Deployment + :param deployment_settings: Deployment settings of the Deployment. :type deployment_settings: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Possible - values include: 'Creating', 'Updating', 'Succeeded', 'Failed' + :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: + "Creating", "Updating", "Succeeded", "Failed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Possible values include: - 'Unknown', 'Stopped', 'Running', 'Failed', 'Allocating', 'Upgrading', - 'Compiling' + :ivar status: Status of the Deployment. Possible values include: "Unknown", "Stopped", + "Running", "Failed", "Allocating", "Upgrading", "Compiling". :vartype status: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceStatus - :ivar active: Indicates whether the Deployment is active + :ivar active: Indicates whether the Deployment is active. :vartype active: bool - :ivar created_time: Date time when the resource is created - :vartype created_time: datetime - :ivar instances: Collection of instances belong to the Deployment - :vartype instances: - list[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentInstance] + :ivar created_time: Date time when the resource is created. + :vartype created_time: ~datetime.datetime + :ivar instances: Collection of instances belong to the Deployment. + :vartype instances: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentInstance] """ _validation = { @@ -965,7 +1200,13 @@ class DeploymentResourceProperties(Model): 'instances': {'key': 'instances', 'type': '[DeploymentInstance]'}, } - def __init__(self, *, source=None, deployment_settings=None, **kwargs) -> None: + def __init__( + self, + *, + source: Optional["UserSourceInfo"] = None, + deployment_settings: Optional["DeploymentSettings"] = None, + **kwargs + ): super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = source self.app_name = None @@ -977,26 +1218,23 @@ def __init__(self, *, source=None, deployment_settings=None, **kwargs) -> None: self.instances = None -class DeploymentSettings(Model): +class DeploymentSettings(msrest.serialization.Model): """Deployment settings payload. - :param cpu: Required CPU, basic tier should be 1, standard tier should be - in range (1, 4). Default value: 1 . + :param cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). :type cpu: int - :param memory_in_gb: Required Memory size in GB, basic tier should be in - range (1, 2), standard tier should be in range (1, 8). Default value: 1 . + :param memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), standard + tier should be in range (1, 8). :type memory_in_gb: int - :param jvm_options: JVM parameter + :param jvm_options: JVM parameter. :type jvm_options: str - :param net_core_main_entry_path: The path to the .NET executable relative - to zip root + :param net_core_main_entry_path: The path to the .NET executable relative to zip root. :type net_core_main_entry_path: str - :param environment_variables: Collection of environment variables + :param environment_variables: Collection of environment variables. :type environment_variables: dict[str, str] - :param runtime_version: Runtime version. Possible values include: - 'Java_8', 'Java_11', 'NetCore_31' - :type runtime_version: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.RuntimeVersion + :param runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :type runtime_version: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.RuntimeVersion """ _attribute_map = { @@ -1008,7 +1246,17 @@ class DeploymentSettings(Model): 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, } - def __init__(self, *, cpu: int=1, memory_in_gb: int=1, jvm_options: str=None, net_core_main_entry_path: str=None, environment_variables=None, runtime_version=None, **kwargs) -> None: + def __init__( + self, + *, + cpu: Optional[int] = 1, + memory_in_gb: Optional[int] = 1, + jvm_options: Optional[str] = None, + net_core_main_entry_path: Optional[str] = None, + environment_variables: Optional[Dict[str, str]] = None, + runtime_version: Optional[Union[str, "RuntimeVersion"]] = "Java_8", + **kwargs + ): super(DeploymentSettings, self).__init__(**kwargs) self.cpu = cpu self.memory_in_gb = memory_in_gb @@ -1018,7 +1266,7 @@ def __init__(self, *, cpu: int=1, memory_in_gb: int=1, jvm_options: str=None, ne self.runtime_version = runtime_version -class Error(Model): +class Error(msrest.serialization.Model): """The error code compose of code and message. :param code: The code of error. @@ -1032,26 +1280,32 @@ class Error(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): super(Error, self).__init__(**kwargs) self.code = code self.message = message -class GitPatternRepository(Model): +class GitPatternRepository(msrest.serialization.Model): """Git repository property payload. All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the repository + :param name: Required. Name of the repository. :type name: str - :param pattern: Collection of pattern of the repository + :param pattern: Collection of pattern of the repository. :type pattern: list[str] - :param uri: Required. URI of the repository + :param uri: Required. URI of the repository. :type uri: str - :param label: Label of the repository + :param label: Label of the repository. :type label: str - :param search_paths: Searching path of the repository + :param search_paths: Searching path of the repository. :type search_paths: list[str] :param username: Username of git repository basic auth. :type username: str @@ -1086,7 +1340,22 @@ class GitPatternRepository(Model): 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, } - def __init__(self, *, name: str, uri: str, pattern=None, label: str=None, search_paths=None, username: str=None, password: str=None, host_key: str=None, host_key_algorithm: str=None, private_key: str=None, strict_host_key_checking: bool=None, **kwargs) -> None: + def __init__( + self, + *, + name: str, + uri: str, + pattern: Optional[List[str]] = None, + label: Optional[str] = None, + search_paths: Optional[List[str]] = None, + username: Optional[str] = None, + password: Optional[str] = None, + host_key: Optional[str] = None, + host_key_algorithm: Optional[str] = None, + private_key: Optional[str] = None, + strict_host_key_checking: Optional[bool] = None, + **kwargs + ): super(GitPatternRepository, self).__init__(**kwargs) self.name = name self.pattern = pattern @@ -1101,12 +1370,12 @@ def __init__(self, *, name: str, uri: str, pattern=None, label: str=None, search self.strict_host_key_checking = strict_host_key_checking -class LogFileUrlResponse(Model): +class LogFileUrlResponse(msrest.serialization.Model): """Log file URL payload. All required parameters must be populated in order to send to Azure. - :param url: Required. URL of the log file + :param url: Required. URL of the log file. :type url: str """ @@ -1118,19 +1387,24 @@ class LogFileUrlResponse(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, *, url: str, **kwargs) -> None: + def __init__( + self, + *, + url: str, + **kwargs + ): super(LogFileUrlResponse, self).__init__(**kwargs) self.url = url -class LogSpecification(Model): +class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :param name: Name of the log + :param name: Name of the log. :type name: str - :param display_name: Localized friendly display name of the log + :param display_name: Localized friendly display name of the log. :type display_name: str - :param blob_duration: Blob duration of the log + :param blob_duration: Blob duration of the log. :type blob_duration: str """ @@ -1140,23 +1414,29 @@ class LogSpecification(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, *, name: str=None, display_name: str=None, blob_duration: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name self.blob_duration = blob_duration -class ManagedIdentityProperties(Model): +class ManagedIdentityProperties(msrest.serialization.Model): """Managed identity properties retrieved from ARM request headers. - :param type: Type of the managed identity. Possible values include: - 'None', 'SystemAssigned', 'UserAssigned', 'SystemAssigned,UserAssigned' - :type type: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityType - :param principal_id: Principal Id + :param type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :type type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityType + :param principal_id: Principal Id. :type principal_id: str - :param tenant_id: Tenant Id + :param tenant_id: Tenant Id. :type tenant_id: str """ @@ -1166,60 +1446,78 @@ class ManagedIdentityProperties(Model): 'tenant_id': {'key': 'tenantId', 'type': 'str'}, } - def __init__(self, *, type=None, principal_id: str=None, tenant_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + type: Optional[Union[str, "ManagedIdentityType"]] = None, + principal_id: Optional[str] = None, + tenant_id: Optional[str] = None, + **kwargs + ): super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = type self.principal_id = principal_id self.tenant_id = tenant_id -class MetricDimension(Model): +class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension + :param name: Name of the dimension. :type name: str - :param display_name: Localized friendly display name of the dimension + :param display_name: Localized friendly display name of the dimension. :type display_name: str + :param to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :type to_be_exported_for_shoebox: bool """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'display_name': {'key': 'displayName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } - def __init__(self, *, name: str=None, display_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + **kwargs + ): super(MetricDimension, self).__init__(**kwargs) self.name = name self.display_name = display_name + self.to_be_exported_for_shoebox = to_be_exported_for_shoebox -class MetricSpecification(Model): +class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :param name: Name of the metric + :param name: Name of the metric. :type name: str - :param display_name: Localized friendly display name of the metric + :param display_name: Localized friendly display name of the metric. :type display_name: str - :param display_description: Localized friendly description of the metric + :param display_description: Localized friendly description of the metric. :type display_description: str - :param unit: Unit that makes sense for the metric + :param unit: Unit that makes sense for the metric. :type unit: str - :param category: Name of the metric category that the metric belongs to. A - metric can only belong to a single category. + :param category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. :type category: str - :param aggregation_type: Only provide one value for this field. Valid - values: Average, Minimum, Maximum, Total, Count. + :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + Maximum, Total, Count. :type aggregation_type: str - :param supported_aggregation_types: Supported aggregation types + :param supported_aggregation_types: Supported aggregation types. :type supported_aggregation_types: list[str] - :param supported_time_grain_types: Supported time grain types + :param supported_time_grain_types: Supported time grain types. :type supported_time_grain_types: list[str] - :param fill_gap_with_zero: Optional. If set to true, then zero will be - returned for time duration where no metric is emitted/published. + :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. :type fill_gap_with_zero: bool - :param dimensions: Dimensions of the metric - :type dimensions: - list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricDimension] + :param dimensions: Dimensions of the metric. + :type dimensions: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricDimension] """ _attribute_map = { @@ -1235,7 +1533,21 @@ class MetricSpecification(Model): 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, } - def __init__(self, *, name: str=None, display_name: str=None, display_description: str=None, unit: str=None, category: str=None, aggregation_type: str=None, supported_aggregation_types=None, supported_time_grain_types=None, fill_gap_with_zero: bool=None, dimensions=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + category: Optional[str] = None, + aggregation_type: Optional[str] = None, + supported_aggregation_types: Optional[List[str]] = None, + supported_time_grain_types: Optional[List[str]] = None, + fill_gap_with_zero: Optional[bool] = None, + dimensions: Optional[List["MetricDimension"]] = None, + **kwargs + ): super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1249,32 +1561,28 @@ def __init__(self, *, name: str=None, display_name: str=None, display_descriptio self.dimensions = dimensions -class MonitoringSettingProperties(Model): +class MonitoringSettingProperties(msrest.serialization.Model): """Monitoring Setting properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: State of the Monitoring Setting. Possible values - include: 'NotAvailable', 'Failed', 'Succeeded', 'Updating' + :ivar provisioning_state: State of the Monitoring Setting. Possible values include: + "NotAvailable", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingState :param error: Error when apply Monitoring Setting changes. :type error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error - :param trace_enabled: Indicates whether enable the trace functionality, - which will be deprecated since api version 2020-11-01-preview. Please - leverage appInsightsInstrumentationKey to indicate if monitoringSettings - enabled or not + :param trace_enabled: Indicates whether enable the trace functionality, which will be + deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey + to indicate if monitoringSettings enabled or not. :type trace_enabled: bool - :param app_insights_instrumentation_key: Target application insight - instrumentation key, null or whitespace include empty will disable - monitoringSettings + :param app_insights_instrumentation_key: Target application insight instrumentation key, null + or whitespace include empty will disable monitoringSettings. :type app_insights_instrumentation_key: str - :param app_insights_sampling_rate: Indicates the sampling rate of - application insight agent, should be in range [0.0, 100.0] + :param app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + should be in range [0.0, 100.0]. :type app_insights_sampling_rate: float - :param app_insights_agent_versions: Indicates the versions of application - insight agent + :param app_insights_agent_versions: Indicates the versions of application insight agent. :type app_insights_agent_versions: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ApplicationInsightsAgentVersions """ @@ -1293,7 +1601,16 @@ class MonitoringSettingProperties(Model): 'app_insights_agent_versions': {'key': 'appInsightsAgentVersions', 'type': 'ApplicationInsightsAgentVersions'}, } - def __init__(self, *, error=None, trace_enabled: bool=None, app_insights_instrumentation_key: str=None, app_insights_sampling_rate: float=None, app_insights_agent_versions=None, **kwargs) -> None: + def __init__( + self, + *, + error: Optional["Error"] = None, + trace_enabled: Optional[bool] = None, + app_insights_instrumentation_key: Optional[str] = None, + app_insights_sampling_rate: Optional[float] = None, + app_insights_agent_versions: Optional["ApplicationInsightsAgentVersions"] = None, + **kwargs + ): super(MonitoringSettingProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -1306,8 +1623,7 @@ def __init__(self, *, error=None, trace_enabled: bool=None, app_insights_instrum class MonitoringSettingResource(ProxyResource): """Monitoring Setting resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -1315,7 +1631,7 @@ class MonitoringSettingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Monitoring Setting resource + :param properties: Properties of the Monitoring Setting resource. :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingProperties """ @@ -1333,19 +1649,24 @@ class MonitoringSettingResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'MonitoringSettingProperties'}, } - def __init__(self, *, properties=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["MonitoringSettingProperties"] = None, + **kwargs + ): super(MonitoringSettingResource, self).__init__(**kwargs) self.properties = properties -class NameAvailability(Model): +class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :param name_available: Indicates whether the name is available + :param name_available: Indicates whether the name is available. :type name_available: bool - :param reason: Reason why the name is not available + :param reason: Reason why the name is not available. :type reason: str - :param message: Message why the name is not available + :param message: Message why the name is not available. :type message: str """ @@ -1355,21 +1676,28 @@ class NameAvailability(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, name_available: bool=None, reason: str=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): super(NameAvailability, self).__init__(**kwargs) self.name_available = name_available self.reason = reason self.message = message -class NameAvailabilityParameters(Model): +class NameAvailabilityParameters(msrest.serialization.Model): """Name availability parameters payload. All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the resource to check name availability + :param type: Required. Type of the resource to check name availability. :type type: str - :param name: Required. Name to be checked + :param name: Required. Name to be checked. :type name: str """ @@ -1383,44 +1711,47 @@ class NameAvailabilityParameters(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, type: str, name: str, **kwargs) -> None: + def __init__( + self, + *, + type: str, + name: str, + **kwargs + ): super(NameAvailabilityParameters, self).__init__(**kwargs) self.type = type self.name = name -class NetworkProfile(Model): +class NetworkProfile(msrest.serialization.Model): """Service network profile payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param service_runtime_subnet_id: Fully qualified resource Id of the - subnet to host Azure Spring Cloud Service Runtime + :param service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. :type service_runtime_subnet_id: str - :param app_subnet_id: Fully qualified resource Id of the subnet to host - Azure Spring Cloud Apps + :param app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. :type app_subnet_id: str - :param service_cidr: Azure Spring Cloud service reserved CIDR + :param service_cidr: Azure Spring Cloud service reserved CIDR. :type service_cidr: str - :param service_runtime_network_resource_group: Name of the resource group - containing network resources of Azure Spring Cloud Service Runtime + :param service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. :type service_runtime_network_resource_group: str - :param app_network_resource_group: Name of the resource group containing - network resources of Azure Spring Cloud Apps + :param app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. :type app_network_resource_group: str - :ivar outbound_ips: Desired outbound IP resources for Azure Spring Cloud - instance. - :vartype outbound_ips: + :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Cloud instance. + :vartype outbound_i_ps: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure - Spring Cloud instance. + :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Cloud instance. :vartype required_traffics: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.RequiredTraffic] """ _validation = { - 'outbound_ips': {'readonly': True}, + 'outbound_i_ps': {'readonly': True}, 'required_traffics': {'readonly': True}, } @@ -1430,59 +1761,68 @@ class NetworkProfile(Model): 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, 'service_runtime_network_resource_group': {'key': 'serviceRuntimeNetworkResourceGroup', 'type': 'str'}, 'app_network_resource_group': {'key': 'appNetworkResourceGroup', 'type': 'str'}, - 'outbound_ips': {'key': 'outboundIPs', 'type': 'NetworkProfileOutboundIPs'}, + 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'NetworkProfileOutboundIPs'}, 'required_traffics': {'key': 'requiredTraffics', 'type': '[RequiredTraffic]'}, } - def __init__(self, *, service_runtime_subnet_id: str=None, app_subnet_id: str=None, service_cidr: str=None, service_runtime_network_resource_group: str=None, app_network_resource_group: str=None, **kwargs) -> None: + def __init__( + self, + *, + service_runtime_subnet_id: Optional[str] = None, + app_subnet_id: Optional[str] = None, + service_cidr: Optional[str] = None, + service_runtime_network_resource_group: Optional[str] = None, + app_network_resource_group: Optional[str] = None, + **kwargs + ): super(NetworkProfile, self).__init__(**kwargs) self.service_runtime_subnet_id = service_runtime_subnet_id self.app_subnet_id = app_subnet_id self.service_cidr = service_cidr self.service_runtime_network_resource_group = service_runtime_network_resource_group self.app_network_resource_group = app_network_resource_group - self.outbound_ips = None + self.outbound_i_ps = None self.required_traffics = None -class NetworkProfileOutboundIPs(Model): +class NetworkProfileOutboundIPs(msrest.serialization.Model): """Desired outbound IP resources for Azure Spring Cloud instance. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar public_ips: A list of public IP addresses. - :vartype public_ips: list[str] + :ivar public_i_ps: A list of public IP addresses. + :vartype public_i_ps: list[str] """ _validation = { - 'public_ips': {'readonly': True}, + 'public_i_ps': {'readonly': True}, } _attribute_map = { - 'public_ips': {'key': 'publicIPs', 'type': '[str]'}, + 'public_i_ps': {'key': 'publicIPs', 'type': '[str]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(NetworkProfileOutboundIPs, self).__init__(**kwargs) - self.public_ips = None + self.public_i_ps = None -class OperationDetail(Model): +class OperationDetail(msrest.serialization.Model): """Operation detail payload. - :param name: Name of the operation + :param name: Name of the operation. :type name: str - :param is_data_action: Indicates whether the operation is a data action + :param is_data_action: Indicates whether the operation is a data action. :type is_data_action: bool - :param display: Display of the operation - :type display: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDisplay - :param origin: Origin of the operation + :param display: Display of the operation. + :type display: ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDisplay + :param origin: Origin of the operation. :type origin: str - :param properties: Properties of the operation - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationProperties + :param properties: Properties of the operation. + :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationProperties """ _attribute_map = { @@ -1493,7 +1833,16 @@ class OperationDetail(Model): 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } - def __init__(self, *, name: str=None, is_data_action: bool=None, display=None, origin: str=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + properties: Optional["OperationProperties"] = None, + **kwargs + ): super(OperationDetail, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action @@ -1502,16 +1851,16 @@ def __init__(self, *, name: str=None, is_data_action: bool=None, display=None, o self.properties = properties -class OperationDisplay(Model): +class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :param provider: Resource provider of the operation + :param provider: Resource provider of the operation. :type provider: str - :param resource: Resource of the operation + :param resource: Resource of the operation. :type resource: str - :param operation: Localized friendly name for the operation + :param operation: Localized friendly name for the operation. :type operation: str - :param description: Localized friendly description for the operation + :param description: Localized friendly description for the operation. :type description: str """ @@ -1522,7 +1871,15 @@ class OperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1530,10 +1887,10 @@ def __init__(self, *, provider: str=None, resource: str=None, operation: str=Non self.description = description -class OperationProperties(Model): +class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :param service_specification: Service specifications of the operation + :param service_specification: Service specifications of the operation. :type service_specification: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceSpecification """ @@ -1542,22 +1899,26 @@ class OperationProperties(Model): 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, *, service_specification=None, **kwargs) -> None: + def __init__( + self, + *, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification -class PersistentDisk(Model): +class PersistentDisk(msrest.serialization.Model): """Persistent disk payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param size_in_gb: Size of the persistent disk in GB + :param size_in_gb: Size of the persistent disk in GB. :type size_in_gb: int - :ivar used_in_gb: Size of the used persistent disk in GB + :ivar used_in_gb: Size of the used persistent disk in GB. :vartype used_in_gb: int - :param mount_path: Mount path of the persistent disk + :param mount_path: Mount path of the persistent disk. :type mount_path: str """ @@ -1572,22 +1933,27 @@ class PersistentDisk(Model): 'mount_path': {'key': 'mountPath', 'type': 'str'}, } - def __init__(self, *, size_in_gb: int=None, mount_path: str=None, **kwargs) -> None: + def __init__( + self, + *, + size_in_gb: Optional[int] = None, + mount_path: Optional[str] = None, + **kwargs + ): super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.used_in_gb = None self.mount_path = mount_path -class RegenerateTestKeyRequestPayload(Model): +class RegenerateTestKeyRequestPayload(msrest.serialization.Model): """Regenerate test key request payload. All required parameters must be populated in order to send to Azure. - :param key_type: Required. Type of the test key. Possible values include: - 'Primary', 'Secondary' - :type key_type: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeyType + :param key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :type key_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeyType """ _validation = { @@ -1598,29 +1964,32 @@ class RegenerateTestKeyRequestPayload(Model): 'key_type': {'key': 'keyType', 'type': 'str'}, } - def __init__(self, *, key_type, **kwargs) -> None: + def __init__( + self, + *, + key_type: Union[str, "TestKeyType"], + **kwargs + ): super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) self.key_type = key_type -class RequiredTraffic(Model): +class RequiredTraffic(msrest.serialization.Model): """Required inbound or outbound traffic for Azure Spring Cloud instance. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar protocol: The protocol of required traffic + :ivar protocol: The protocol of required traffic. :vartype protocol: str - :ivar port: The port of required traffic + :ivar port: The port of required traffic. :vartype port: int - :ivar ips: The ip list of required traffic + :ivar ips: The ip list of required traffic. :vartype ips: list[str] - :ivar fqdns: The FQDN list of required traffic + :ivar fqdns: The FQDN list of required traffic. :vartype fqdns: list[str] - :ivar direction: The direction of required traffic. Possible values - include: 'Inbound', 'Outbound' - :vartype direction: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.TrafficDirection + :ivar direction: The direction of required traffic. Possible values include: "Inbound", + "Outbound". + :vartype direction: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.TrafficDirection """ _validation = { @@ -1639,7 +2008,10 @@ class RequiredTraffic(Model): 'direction': {'key': 'direction', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -1648,7 +2020,7 @@ def __init__(self, **kwargs) -> None: self.direction = None -class ResourceSku(Model): +class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. :param resource_type: Gets the type of resource the SKU applies to. @@ -1658,16 +2030,14 @@ class ResourceSku(Model): :param tier: Gets the tier of SKU. :type tier: str :param capacity: Gets the capacity of SKU. - :type capacity: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuCapacity + :type capacity: ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuCapacity :param locations: Gets the set of locations that the SKU is available. :type locations: list[str] - :param location_info: Gets a list of locations and availability zones in - those locations where the SKU is available. + :param location_info: Gets a list of locations and availability zones in those locations where + the SKU is available. :type location_info: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuLocationInfo] - :param restrictions: Gets the restrictions because of which SKU cannot be - used. This is + :param restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. :type restrictions: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictions] @@ -1683,7 +2053,18 @@ class ResourceSku(Model): 'restrictions': {'key': 'restrictions', 'type': '[ResourceSkuRestrictions]'}, } - def __init__(self, *, resource_type: str=None, name: str=None, tier: str=None, capacity=None, locations=None, location_info=None, restrictions=None, **kwargs) -> None: + def __init__( + self, + *, + resource_type: Optional[str] = None, + name: Optional[str] = None, + tier: Optional[str] = None, + capacity: Optional["SkuCapacity"] = None, + locations: Optional[List[str]] = None, + location_info: Optional[List["ResourceSkuLocationInfo"]] = None, + restrictions: Optional[List["ResourceSkuRestrictions"]] = None, + **kwargs + ): super(ResourceSku, self).__init__(**kwargs) self.resource_type = resource_type self.name = name @@ -1694,7 +2075,7 @@ def __init__(self, *, resource_type: str=None, name: str=None, tier: str=None, c self.restrictions = restrictions -class ResourceSkuCapabilities(Model): +class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. :param name: Gets an invariant to describe the feature. @@ -1708,21 +2089,53 @@ class ResourceSkuCapabilities(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, *, name: str=None, value: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = name self.value = value -class ResourceSkuLocationInfo(Model): +class ResourceSkuCollection(msrest.serialization.Model): + """Object that includes an array of Azure Spring Cloud SKU and a possible link for next set. + + :param value: Collection of resource SKU. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSku] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceSku]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ResourceSku"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ResourceSkuCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ResourceSkuLocationInfo(msrest.serialization.Model): """Locations and availability zones where the SKU is available. - :param location: Gets location of the SKU + :param location: Gets location of the SKU. :type location: str :param zones: Gets list of availability zones where the SKU is supported. :type zones: list[str] - :param zone_details: Gets details of capabilities available to a SKU in - specific zones. + :param zone_details: Gets details of capabilities available to a SKU in specific zones. :type zone_details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuZoneDetails] """ @@ -1733,17 +2146,24 @@ class ResourceSkuLocationInfo(Model): 'zone_details': {'key': 'zoneDetails', 'type': '[ResourceSkuZoneDetails]'}, } - def __init__(self, *, location: str=None, zones=None, zone_details=None, **kwargs) -> None: + def __init__( + self, + *, + location: Optional[str] = None, + zones: Optional[List[str]] = None, + zone_details: Optional[List["ResourceSkuZoneDetails"]] = None, + **kwargs + ): super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = location self.zones = zones self.zone_details = zone_details -class ResourceSkuRestrictionInfo(Model): +class ResourceSkuRestrictionInfo(msrest.serialization.Model): """Information about the restriction where the SKU cannot be used. - :param locations: Gets locations where the SKU is restricted + :param locations: Gets locations where the SKU is restricted. :type locations: list[str] :param zones: Gets list of availability zones where the SKU is restricted. :type zones: list[str] @@ -1754,29 +2174,35 @@ class ResourceSkuRestrictionInfo(Model): 'zones': {'key': 'zones', 'type': '[str]'}, } - def __init__(self, *, locations=None, zones=None, **kwargs) -> None: + def __init__( + self, + *, + locations: Optional[List[str]] = None, + zones: Optional[List[str]] = None, + **kwargs + ): super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = locations self.zones = zones -class ResourceSkuRestrictions(Model): +class ResourceSkuRestrictions(msrest.serialization.Model): """Restrictions where the SKU cannot be used. - :param type: Gets the type of restrictions. Possible values include: - 'Location', 'Zone' + :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". :type type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionsType - :param values: Gets the value of restrictions. If the restriction type is - set to + :param values: Gets the value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. :type values: list[str] - :param restriction_info: Gets the information about the restriction where - the SKU cannot be used. + :param restriction_info: Gets the information about the restriction where the SKU cannot be + used. :type restriction_info: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionInfo - :param reason_code: Gets the reason for restriction. Possible values - include: 'QuotaId', 'NotAvailableForSubscription' + :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". :type reason_code: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionsReasonCode """ @@ -1788,7 +2214,15 @@ class ResourceSkuRestrictions(Model): 'reason_code': {'key': 'reasonCode', 'type': 'str'}, } - def __init__(self, *, type=None, values=None, restriction_info=None, reason_code=None, **kwargs) -> None: + def __init__( + self, + *, + type: Optional[Union[str, "ResourceSkuRestrictionsType"]] = None, + values: Optional[List[str]] = None, + restriction_info: Optional["ResourceSkuRestrictionInfo"] = None, + reason_code: Optional[Union[str, "ResourceSkuRestrictionsReasonCode"]] = None, + **kwargs + ): super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = type self.values = values @@ -1796,14 +2230,13 @@ def __init__(self, *, type=None, values=None, restriction_info=None, reason_code self.reason_code = reason_code -class ResourceSkuZoneDetails(Model): +class ResourceSkuZoneDetails(msrest.serialization.Model): """Details of capabilities available to a SKU in specific zones. :param name: Gets the set of zones that the SKU is available in with the specified capabilities. :type name: list[str] - :param capabilities: Gets a list of capabilities that are available for - the SKU in the + :param capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. :type capabilities: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuCapabilities] @@ -1814,18 +2247,24 @@ class ResourceSkuZoneDetails(Model): 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, } - def __init__(self, *, name=None, capabilities=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[List[str]] = None, + capabilities: Optional[List["ResourceSkuCapabilities"]] = None, + **kwargs + ): super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = name self.capabilities = capabilities -class ResourceUploadDefinition(Model): +class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :param relative_path: Source relative path + :param relative_path: Source relative path. :type relative_path: str - :param upload_url: Upload URL + :param upload_url: Upload URL. :type upload_url: str """ @@ -1834,7 +2273,13 @@ class ResourceUploadDefinition(Model): 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, } - def __init__(self, *, relative_path: str=None, upload_url: str=None, **kwargs) -> None: + def __init__( + self, + *, + relative_path: Optional[str] = None, + upload_url: Optional[str] = None, + **kwargs + ): super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = relative_path self.upload_url = upload_url @@ -1843,8 +2288,7 @@ def __init__(self, *, relative_path: str=None, upload_url: str=None, **kwargs) - class TrackedResource(Resource): """The resource model definition for a ARM tracked top level resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -1854,7 +2298,7 @@ class TrackedResource(Resource): :vartype type: str :param location: The GEO location of the resource. :type location: str - :param tags: Tags of the service which is a list of key value pairs that + :param tags: A set of tags. Tags of the service which is a list of key value pairs that describe the resource. :type tags: dict[str, str] """ @@ -1873,7 +2317,13 @@ class TrackedResource(Resource): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, location: str=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(TrackedResource, self).__init__(**kwargs) self.location = location self.tags = tags @@ -1882,8 +2332,7 @@ def __init__(self, *, location: str=None, tags=None, **kwargs) -> None: class ServiceResource(TrackedResource): """Service resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -1893,13 +2342,12 @@ class ServiceResource(TrackedResource): :vartype type: str :param location: The GEO location of the resource. :type location: str - :param tags: Tags of the service which is a list of key value pairs that + :param tags: A set of tags. Tags of the service which is a list of key value pairs that describe the resource. :type tags: dict[str, str] - :param properties: Properties of the Service resource - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ClusterResourceProperties - :param sku: Sku of the Service resource + :param properties: Properties of the Service resource. + :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ClusterResourceProperties + :param sku: Sku of the Service resource. :type sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku """ @@ -1919,20 +2367,54 @@ class ServiceResource(TrackedResource): 'sku': {'key': 'sku', 'type': 'Sku'}, } - def __init__(self, *, location: str=None, tags=None, properties=None, sku=None, **kwargs) -> None: + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional["ClusterResourceProperties"] = None, + sku: Optional["Sku"] = None, + **kwargs + ): super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.properties = properties self.sku = sku -class ServiceSpecification(Model): +class ServiceResourceList(msrest.serialization.Model): + """Object that includes an array of Service resources and a possible link for next set. + + :param value: Collection of Service resources. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ServiceResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ServiceResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ServiceResourceList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :param log_specifications: Specifications of the Log for Azure Monitoring + :param log_specifications: Specifications of the Log for Azure Monitoring. :type log_specifications: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.LogSpecification] - :param metric_specifications: Specifications of the Metrics for Azure - Monitoring + :param metric_specifications: Specifications of the Metrics for Azure Monitoring. :type metric_specifications: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricSpecification] """ @@ -1942,20 +2424,26 @@ class ServiceSpecification(Model): 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, } - def __init__(self, *, log_specifications=None, metric_specifications=None, **kwargs) -> None: + def __init__( + self, + *, + log_specifications: Optional[List["LogSpecification"]] = None, + metric_specifications: Optional[List["MetricSpecification"]] = None, + **kwargs + ): super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications -class Sku(Model): +class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :param name: Name of the Sku. Default value: "S0" . + :param name: Name of the Sku. :type name: str - :param tier: Tier of the Sku. Default value: "Standard" . + :param tier: Tier of the Sku. :type tier: str - :param capacity: Current capacity of the target resource + :param capacity: Current capacity of the target resource. :type capacity: int """ @@ -1965,14 +2453,21 @@ class Sku(Model): 'capacity': {'key': 'capacity', 'type': 'int'}, } - def __init__(self, *, name: str="S0", tier: str="Standard", capacity: int=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = "S0", + tier: Optional[str] = "Standard", + capacity: Optional[int] = None, + **kwargs + ): super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier self.capacity = capacity -class SkuCapacity(Model): +class SkuCapacity(msrest.serialization.Model): """The SKU capacity. All required parameters must be populated in order to send to Azure. @@ -1983,10 +2478,9 @@ class SkuCapacity(Model): :type maximum: int :param default: Gets or sets the default. :type default: int - :param scale_type: Gets or sets the type of the scale. Possible values - include: 'None', 'Manual', 'Automatic' - :type scale_type: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuScaleType + :param scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :type scale_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuScaleType """ _validation = { @@ -2000,7 +2494,15 @@ class SkuCapacity(Model): 'scale_type': {'key': 'scaleType', 'type': 'str'}, } - def __init__(self, *, minimum: int, maximum: int=None, default: int=None, scale_type=None, **kwargs) -> None: + def __init__( + self, + *, + minimum: int, + maximum: Optional[int] = None, + default: Optional[int] = None, + scale_type: Optional[Union[str, "SkuScaleType"]] = None, + **kwargs + ): super(SkuCapacity, self).__init__(**kwargs) self.minimum = minimum self.maximum = maximum @@ -2008,15 +2510,14 @@ def __init__(self, *, minimum: int, maximum: int=None, default: int=None, scale_ self.scale_type = scale_type -class SupportedRuntimeVersion(Model): +class SupportedRuntimeVersion(msrest.serialization.Model): """Supported deployment runtime version descriptor. - :param value: The raw value which could be passed to deployment CRUD - operations. Possible values include: 'Java_8', 'Java_11', 'NetCore_31' - :type value: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimeValue - :param platform: The platform of this runtime version (possible values: - "Java" or ".NET"). Possible values include: 'Java', '.NET Core' + :param value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :type value: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimeValue + :param platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". :type platform: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimePlatform :param version: The detailed version (major.minor) of the platform. @@ -2029,19 +2530,26 @@ class SupportedRuntimeVersion(Model): 'version': {'key': 'version', 'type': 'str'}, } - def __init__(self, *, value=None, platform=None, version: str=None, **kwargs) -> None: + def __init__( + self, + *, + value: Optional[Union[str, "SupportedRuntimeValue"]] = None, + platform: Optional[Union[str, "SupportedRuntimePlatform"]] = None, + version: Optional[str] = None, + **kwargs + ): super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = value self.platform = platform self.version = version -class TemporaryDisk(Model): +class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :param size_in_gb: Size of the temporary disk in GB + :param size_in_gb: Size of the temporary disk in GB. :type size_in_gb: int - :param mount_path: Mount path of the temporary disk + :param mount_path: Mount path of the temporary disk. :type mount_path: str """ @@ -2054,24 +2562,30 @@ class TemporaryDisk(Model): 'mount_path': {'key': 'mountPath', 'type': 'str'}, } - def __init__(self, *, size_in_gb: int=None, mount_path: str=None, **kwargs) -> None: + def __init__( + self, + *, + size_in_gb: Optional[int] = None, + mount_path: Optional[str] = "/tmp", + **kwargs + ): super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.mount_path = mount_path -class TestKeys(Model): +class TestKeys(msrest.serialization.Model): """Test keys payload. - :param primary_key: Primary key + :param primary_key: Primary key. :type primary_key: str - :param secondary_key: Secondary key + :param secondary_key: Secondary key. :type secondary_key: str - :param primary_test_endpoint: Primary test endpoint + :param primary_test_endpoint: Primary test endpoint. :type primary_test_endpoint: str - :param secondary_test_endpoint: Secondary test endpoint + :param secondary_test_endpoint: Secondary test endpoint. :type secondary_test_endpoint: str - :param enabled: Indicates whether the test endpoint feature enabled or not + :param enabled: Indicates whether the test endpoint feature enabled or not. :type enabled: bool """ @@ -2083,7 +2597,16 @@ class TestKeys(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, *, primary_key: str=None, secondary_key: str=None, primary_test_endpoint: str=None, secondary_test_endpoint: str=None, enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + primary_key: Optional[str] = None, + secondary_key: Optional[str] = None, + primary_test_endpoint: Optional[str] = None, + secondary_test_endpoint: Optional[str] = None, + enabled: Optional[bool] = None, + **kwargs + ): super(TestKeys, self).__init__(**kwargs) self.primary_key = primary_key self.secondary_key = secondary_key @@ -2092,19 +2615,18 @@ def __init__(self, *, primary_key: str=None, secondary_key: str=None, primary_te self.enabled = enabled -class UserSourceInfo(Model): +class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :param type: Type of the source uploaded. Possible values include: 'Jar', - 'NetCoreZip', 'Source' - :type type: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceType - :param relative_path: Relative path of the storage which stores the source + :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source". + :type type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceType + :param relative_path: Relative path of the storage which stores the source. :type relative_path: str - :param version: Version of the source + :param version: Version of the source. :type version: str - :param artifact_selector: Selector for the artifact to be used for the - deployment for multi-module projects. This should be + :param artifact_selector: Selector for the artifact to be used for the deployment for + multi-module projects. This should be the relative path to the target module/project. :type artifact_selector: str """ @@ -2116,7 +2638,15 @@ class UserSourceInfo(Model): 'artifact_selector': {'key': 'artifactSelector', 'type': 'str'}, } - def __init__(self, *, type=None, relative_path: str=None, version: str=None, artifact_selector: str=None, **kwargs) -> None: + def __init__( + self, + *, + type: Optional[Union[str, "UserSourceType"]] = None, + relative_path: Optional[str] = None, + version: Optional[str] = None, + artifact_selector: Optional[str] = None, + **kwargs + ): super(UserSourceInfo, self).__init__(**kwargs) self.type = type self.relative_path = relative_path diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/models/_paged_models.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/models/_paged_models.py deleted file mode 100644 index d8a3f0b9370..00000000000 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/models/_paged_models.py +++ /dev/null @@ -1,118 +0,0 @@ -# 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. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class ServiceResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`ServiceResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ServiceResource]'} - } - - def __init__(self, *args, **kwargs): - - super(ServiceResourcePaged, self).__init__(*args, **kwargs) -class AppResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`AppResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[AppResource]'} - } - - def __init__(self, *args, **kwargs): - - super(AppResourcePaged, self).__init__(*args, **kwargs) -class BindingResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`BindingResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[BindingResource]'} - } - - def __init__(self, *args, **kwargs): - - super(BindingResourcePaged, self).__init__(*args, **kwargs) -class CertificateResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`CertificateResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CertificateResource]'} - } - - def __init__(self, *args, **kwargs): - - super(CertificateResourcePaged, self).__init__(*args, **kwargs) -class CustomDomainResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`CustomDomainResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CustomDomainResource]'} - } - - def __init__(self, *args, **kwargs): - - super(CustomDomainResourcePaged, self).__init__(*args, **kwargs) -class DeploymentResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`DeploymentResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeploymentResource]'} - } - - def __init__(self, *args, **kwargs): - - super(DeploymentResourcePaged, self).__init__(*args, **kwargs) -class OperationDetailPaged(Paged): - """ - A paging container for iterating over a list of :class:`OperationDetail ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[OperationDetail]'} - } - - def __init__(self, *args, **kwargs): - - super(OperationDetailPaged, self).__init__(*args, **kwargs) -class ResourceSkuPaged(Paged): - """ - A paging container for iterating over a list of :class:`ResourceSku ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ResourceSku]'} - } - - def __init__(self, *args, **kwargs): - - super(ResourceSkuPaged, self).__init__(*args, **kwargs) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/__init__.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/__init__.py index 0a24a9df9f9..aa6fe5cd0cf 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/__init__.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/__init__.py @@ -1,12 +1,9 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from ._services_operations import ServicesOperations diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_apps_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_apps_operations.py index 4aeca2d36be..2b9bcb3d68b 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_apps_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_apps_operations.py @@ -1,634 +1,726 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class AppsOperations(object): """AppsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_11_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2020-11-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-11-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, app_name, sync_status=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + sync_status=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" """Get an App and its properties. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status + :param sync_status: Indicates whether sync status. :type sync_status: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppResource or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResource, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if sync_status is not None: query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AppResource', response) + deserialized = self._deserialize('AppResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, service_name, app_name, app_resource, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(app_resource, 'AppResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AppResource', response) + deserialized = self._deserialize('AppResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('AppResource', response) + deserialized = self._deserialize('AppResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('AppResource', response) + deserialized = self._deserialize('AppResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, service_name, app_name, app_resource, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.AppResource"] """Create a new App or update an exiting App. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param app_resource: Parameters for the create or update operation - :type app_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns AppResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource]] - :raises: :class:`CloudError` + :param app_resource: Parameters for the create or update operation. + :type app_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - app_resource=app_resource, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('AppResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def _delete_initial( - self, resource_group_name, service_name, app_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, service_name, app_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete an App. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def _update_initial( - self, resource_group_name, service_name, app_name, app_resource, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(app_resource, 'AppResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AppResource', response) + deserialized = self._deserialize('AppResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('AppResource', response) + deserialized = self._deserialize('AppResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, service_name, app_name, app_resource, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.AppResource"] """Operation to update an exiting App. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param app_resource: Parameters for the update operation - :type app_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns AppResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource]] - :raises: :class:`CloudError` + :param app_resource: Parameters for the update operation. + :type app_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - app_resource=app_resource, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('AppResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def list( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AppResourceCollection"] """Handles requests to list all resources in a Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppResource - :rtype: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourcePaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore def get_resource_upload_url( - self, resource_group_name, service_name, app_name, custom_headers=None, raw=False, **operation_config): - """Get an resource upload URL for an App, which may be artifacts or source - archive. - - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceUploadDefinition" + """Get an resource upload URL for an App, which may be artifacts or source archive. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ResourceUploadDefinition or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceUploadDefinition - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceUploadDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceUploadDefinition + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL - url = self.get_resource_upload_url.metadata['url'] + url = self.get_resource_upload_url.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ResourceUploadDefinition', response) + deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore def validate_domain( - self, resource_group_name, service_name, app_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + validate_payload, # type: "_models.CustomDomainValidatePayload" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainValidateResult" """Check the resource name is valid as well as not in use. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param name: Name to be validated - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CustomDomainValidateResult or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidateResult - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param validate_payload: Custom domain payload to be validated. + :type validate_payload: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidatePayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidateResult + :raises: ~azure.core.exceptions.HttpResponseError """ - validate_payload = models.CustomDomainValidatePayload(name=name) + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.validate_domain.metadata['url'] + url = self.validate_domain.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CustomDomainValidateResult', response) + deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_bindings_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_bindings_operations.py index 5eaa5f8c6aa..d2d143d8572 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_bindings_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_bindings_operations.py @@ -1,53 +1,65 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class BindingsOperations(object): """BindingsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_11_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2020-11-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-11-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, app_name, binding_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" """Get a Binding and its properties. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -55,127 +67,133 @@ def get( :type app_name: str :param binding_name: The name of the Binding resource. :type binding_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BindingResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BindingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str') + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BindingResource', response) + deserialized = self._deserialize('BindingResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, service_name, app_name, binding_name, properties=None, custom_headers=None, raw=False, **operation_config): - binding_resource = models.BindingResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str') + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(binding_resource, 'BindingResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('BindingResource', response) + deserialized = self._deserialize('BindingResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('BindingResource', response) + deserialized = self._deserialize('BindingResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('BindingResource', response) + deserialized = self._deserialize('BindingResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, service_name, app_name, binding_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.BindingResource"] """Create a new Binding or update an exiting Binding. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -183,98 +201,130 @@ def create_or_update( :type app_name: str :param binding_name: The name of the Binding resource. :type binding_name: str - :param properties: Properties of the Binding resource - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns BindingResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource]] - :raises: :class:`CloudError` + :param binding_resource: Parameters for the create or update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('BindingResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def _delete_initial( - self, resource_group_name, service_name, app_name, binding_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str') + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, service_name, app_name, binding_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Binding. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -282,104 +332,138 @@ def delete( :type app_name: str :param binding_name: The name of the Binding resource. :type binding_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def _update_initial( - self, resource_group_name, service_name, app_name, binding_name, properties=None, custom_headers=None, raw=False, **operation_config): - binding_resource = models.BindingResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str') + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(binding_resource, 'BindingResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('BindingResource', response) + deserialized = self._deserialize('BindingResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('BindingResource', response) + deserialized = self._deserialize('BindingResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, service_name, app_name, binding_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.BindingResource"] """Operation to update an exiting Binding. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -387,124 +471,144 @@ def update( :type app_name: str :param binding_name: The name of the Binding resource. :type binding_name: str - :param properties: Properties of the Binding resource - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns BindingResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource]] - :raises: :class:`CloudError` + :param binding_resource: Parameters for the update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('BindingResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def list( - self, resource_group_name, service_name, app_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.BindingResourceCollection"] """Handles requests to list all resources in an App. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of BindingResource - :rtype: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourcePaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.BindingResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_certificates_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_certificates_operations.py index 586011d287d..0dbefc75ad9 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_certificates_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_certificates_operations.py @@ -1,381 +1,447 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class CertificatesOperations(object): """CertificatesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_11_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2020-11-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-11-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, certificate_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateResource" """Get the certificate resource. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param certificate_name: The name of the certificate resource. :type certificate_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CertificateResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateResource', response) + deserialized = self._deserialize('CertificateResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, service_name, certificate_name, properties=None, custom_headers=None, raw=False, **operation_config): - certificate_resource = models.CertificateResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + certificate_resource, # type: "_models.CertificateResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(certificate_resource, 'CertificateResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_resource, 'CertificateResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('CertificateResource', response) + deserialized = self._deserialize('CertificateResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('CertificateResource', response) + deserialized = self._deserialize('CertificateResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('CertificateResource', response) + deserialized = self._deserialize('CertificateResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, service_name, certificate_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + certificate_resource, # type: "_models.CertificateResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CertificateResource"] """Create or update certificate resource. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param certificate_name: The name of the certificate resource. :type certificate_name: str - :param properties: Properties of the certificate resource payload. - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns CertificateResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource]] - :raises: :class:`CloudError` + :param certificate_resource: Parameters for the create or update operation. + :type certificate_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CertificateResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('CertificateResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + certificate_resource=certificate_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore def _delete_initial( - self, resource_group_name, service_name, certificate_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, service_name, certificate_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete the certificate resource. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param certificate_name: The name of the certificate resource. :type certificate_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore def list( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CertificateResourceCollection"] """List all the certificates of one user. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CertificateResource - :rtype: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResourcePaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CertificateResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_config_servers_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_config_servers_operations.py index 2f7cb0fc9e4..dd9d73e3d8a 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_config_servers_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_config_servers_operations.py @@ -1,428 +1,500 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class ConfigServersOperations(object): """ConfigServersOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_11_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2020-11-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-11-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" """Get the config server and its properties. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ConfigServerResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigServerResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ConfigServerResource', response) + deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _update_put_initial( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, **operation_config): - config_server_resource = models.ConfigServerResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update_put.metadata['url'] + url = self._update_put_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ConfigServerResource', response) + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('ConfigServerResource', response) + deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update_put( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + def begin_update_put( + self, + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerResource"] """Update the config server. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param properties: Properties of the Config Server resource - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns ConfigServerResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource]] - :raises: :class:`CloudError` + :param config_server_resource: Parameters for the update operation. + :type config_server_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('ConfigServerResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _update_patch_initial( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, **operation_config): - config_server_resource = models.ConfigServerResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update_patch.metadata['url'] + url = self._update_patch_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ConfigServerResource', response) + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('ConfigServerResource', response) + deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update_patch( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + def begin_update_patch( + self, + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerResource"] """Update the config server. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param properties: Properties of the Config Server resource - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns ConfigServerResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource]] - :raises: :class:`CloudError` + :param config_server_resource: Parameters for the update operation. + :type config_server_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('ConfigServerResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _validate_initial( - self, resource_group_name, service_name, git_property=None, custom_headers=None, raw=False, **operation_config): - config_server_settings = models.ConfigServerSettings(git_property=git_property) + self, + resource_group_name, # type: str + service_name, # type: str + config_server_settings, # type: "_models.ConfigServerSettings" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerSettingsValidateResult" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.validate.metadata['url'] + url = self._validate_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ConfigServerSettingsValidateResult', response) + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('ConfigServerSettingsValidateResult', response) + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def validate( - self, resource_group_name, service_name, git_property=None, custom_headers=None, raw=False, polling=True, **operation_config): + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + + def begin_validate( + self, + resource_group_name, # type: str + service_name, # type: str + config_server_settings, # type: "_models.ConfigServerSettings" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerSettingsValidateResult"] """Check if the config server settings are valid. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param git_property: Property of git environment. - :type git_property: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerGitProperty - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns - ConfigServerSettingsValidateResult or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettingsValidateResult] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettingsValidateResult]] - :raises: :class:`CloudError` + :param config_server_settings: Config server settings to be validated. + :type config_server_settings: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - git_property=git_property, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('ConfigServerSettingsValidateResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_settings=config_server_settings, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_custom_domains_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_custom_domains_operations.py index 550a865b24a..9981f525763 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_custom_domains_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_custom_domains_operations.py @@ -1,53 +1,65 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class CustomDomainsOperations(object): """CustomDomainsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_11_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2020-11-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-11-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, app_name, domain_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" """Get the custom domain of one lifecycle application. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -55,127 +67,133 @@ def get( :type app_name: str :param domain_name: The name of the custom domain resource. :type domain_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CustomDomainResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str') + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CustomDomainResource', response) + deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, service_name, app_name, domain_name, properties=None, custom_headers=None, raw=False, **operation_config): - domain_resource = models.CustomDomainResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str') + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('CustomDomainResource', response) + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('CustomDomainResource', response) + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('CustomDomainResource', response) + deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, service_name, app_name, domain_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CustomDomainResource"] """Create or update custom domain of one lifecycle application. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -183,98 +201,130 @@ def create_or_update( :type app_name: str :param domain_name: The name of the custom domain resource. :type domain_name: str - :param properties: Properties of the custom domain resource. - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns CustomDomainResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource]] - :raises: :class:`CloudError` + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('CustomDomainResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def _delete_initial( - self, resource_group_name, service_name, app_name, domain_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str') + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, service_name, app_name, domain_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete the custom domain of one lifecycle application. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -282,104 +332,138 @@ def delete( :type app_name: str :param domain_name: The name of the custom domain resource. :type domain_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def _update_initial( - self, resource_group_name, service_name, app_name, domain_name, properties=None, custom_headers=None, raw=False, **operation_config): - domain_resource = models.CustomDomainResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str') + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('CustomDomainResource', response) + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('CustomDomainResource', response) + deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, service_name, app_name, domain_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CustomDomainResource"] """Update custom domain of one lifecycle application. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -387,124 +471,144 @@ def update( :type app_name: str :param domain_name: The name of the custom domain resource. :type domain_name: str - :param properties: Properties of the custom domain resource. - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns CustomDomainResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource]] - :raises: :class:`CloudError` + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('CustomDomainResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def list( - self, resource_group_name, service_name, app_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CustomDomainResourceCollection"] """List the custom domains of one lifecycle application. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CustomDomainResource - :rtype: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResourcePaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CustomDomainResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_deployments_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_deployments_operations.py index f14383c0990..d88630d9689 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_deployments_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_deployments_operations.py @@ -1,53 +1,65 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class DeploymentsOperations(object): """DeploymentsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_11_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2020-11-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-11-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" """Get a Deployment and its properties. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -55,127 +67,133 @@ def get( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DeploymentResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, service_name, app_name, deployment_name, properties=None, sku=None, custom_headers=None, raw=False, **operation_config): - deployment_resource = models.DeploymentResource(properties=properties, sku=sku) + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, service_name, app_name, deployment_name, properties=None, sku=None, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentResource"] """Create a new Deployment or update an exiting Deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -183,101 +201,130 @@ def create_or_update( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param properties: Properties of the Deployment resource - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource - :type sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns DeploymentResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource]] - :raises: :class:`CloudError` + :param deployment_resource: Parameters for the create or update operation. + :type deployment_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - properties=properties, - sku=sku, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('DeploymentResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def _delete_initial( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -285,104 +332,138 @@ def delete( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def _update_initial( - self, resource_group_name, service_name, app_name, deployment_name, properties=None, sku=None, custom_headers=None, raw=False, **operation_config): - deployment_resource = models.DeploymentResource(properties=properties, sku=sku) + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, service_name, app_name, deployment_name, properties=None, sku=None, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentResource"] """Operation to update an exiting Deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -390,260 +471,296 @@ def update( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param properties: Properties of the Deployment resource - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource - :type sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns DeploymentResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource]] - :raises: :class:`CloudError` + :param deployment_resource: Parameters for the update operation. + :type deployment_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - properties=properties, - sku=sku, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('DeploymentResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def list( - self, resource_group_name, service_name, app_name, version=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + version=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentResourceCollection"] """Handles requests to list all resources in an App. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed + :param version: Version of the deployments to be listed. :type version: list[str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DeploymentResource - :rtype: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourcePaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if version is not None: - query_parameters['version'] = self._serialize.query("version", version, '[str]', div=',') + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DeploymentResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore def list_for_cluster( - self, resource_group_name, service_name, version=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + version=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentResourceCollection"] """List deployments for a certain service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed + :param version: Version of the deployments to be listed. :type version: list[str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DeploymentResource - :rtype: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourcePaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_for_cluster.metadata['url'] + url = self.list_for_cluster.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if version is not None: - query_parameters['version'] = self._serialize.query("version", version, '[str]', div=',') + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DeploymentResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} + return pipeline_response + return ItemPaged( + get_next, extract_data + ) + list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore def _start_initial( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL - url = self.start.metadata['url'] + url = self._start_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def start( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + + def begin_start( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Start the deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -651,88 +768,124 @@ def start( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore def _stop_initial( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL - url = self.stop.metadata['url'] + url = self._stop_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def stop( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + + def begin_stop( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Stop the deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -740,88 +893,124 @@ def stop( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore def _restart_initial( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL - url = self.restart.metadata['url'] + url = self._restart_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def restart( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + + def begin_restart( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Restart the deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -829,48 +1018,75 @@ def restart( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore def get_log_file_url( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.LogFileUrlResponse"] """Get deployment log file URL. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -878,58 +1094,52 @@ def get_log_file_url( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: LogFileUrlResponse or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.LogFileUrlResponse - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogFileUrlResponse, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.LogFileUrlResponse or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LogFileUrlResponse"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL - url = self.get_log_file_url.metadata['url'] + url = self.get_log_file_url.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('LogFileUrlResponse', response) + deserialized = self._deserialize('LogFileUrlResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} + get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_monitoring_settings_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_monitoring_settings_operations.py index 481998142ed..a7544e77b78 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_monitoring_settings_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_monitoring_settings_operations.py @@ -1,322 +1,369 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class MonitoringSettingsOperations(object): """MonitoringSettingsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_11_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2020-11-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-11-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" """Get the Monitoring Setting and its properties. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MonitoringSettingResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoringSettingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MonitoringSettingResource', response) + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore def _update_put_initial( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, **operation_config): - monitoring_setting_resource = models.MonitoringSettingResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update_put.metadata['url'] + url = self._update_put_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('MonitoringSettingResource', response) + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('MonitoringSettingResource', response) + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update_put( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + def begin_update_put( + self, + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.MonitoringSettingResource"] """Update the Monitoring Setting. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param properties: Properties of the Monitoring Setting resource - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns - MonitoringSettingResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource]] - :raises: :class:`CloudError` + :param monitoring_setting_resource: Parameters for the update operation. + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('MonitoringSettingResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore def _update_patch_initial( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, **operation_config): - monitoring_setting_resource = models.MonitoringSettingResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update_patch.metadata['url'] + url = self._update_patch_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('MonitoringSettingResource', response) + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('MonitoringSettingResource', response) + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update_patch( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + def begin_update_patch( + self, + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.MonitoringSettingResource"] """Update the Monitoring Setting. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param properties: Properties of the Monitoring Setting resource - :type properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns - MonitoringSettingResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource]] - :raises: :class:`CloudError` + :param monitoring_setting_resource: Parameters for the update operation. + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('MonitoringSettingResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_operations.py index 9b0217b968c..e93fd2c1410 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_operations.py @@ -1,103 +1,109 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class Operations(object): """Operations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_11_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2020-11-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-11-01-preview" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): - """Lists all of the available REST API operations of the - Microsoft.AppPlatform provider. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of OperationDetail - :rtype: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDetailPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDetail] - :raises: :class:`CloudError` + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AvailableOperations"] + """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailableOperations or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AvailableOperations] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] - + url = self.list.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AvailableOperations', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.OperationDetailPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_runtime_versions_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_runtime_versions_operations.py index 143ea4c291b..5c7e5ce3dc2 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_runtime_versions_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_runtime_versions_operations.py @@ -1,93 +1,92 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class RuntimeVersionsOperations(object): """RuntimeVersionsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_11_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2020-11-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-11-01-preview" - - self.config = config + self._config = config def list_runtime_versions( - self, custom_headers=None, raw=False, **operation_config): - """Lists all of the available runtime versions supported by - Microsoft.AppPlatform provider. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AvailableRuntimeVersions or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.AvailableRuntimeVersions - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + self, + **kwargs # type: Any + ): + # type: (...) -> "_models.AvailableRuntimeVersions" + """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailableRuntimeVersions, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AvailableRuntimeVersions + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableRuntimeVersions"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL - url = self.list_runtime_versions.metadata['url'] + url = self.list_runtime_versions.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AvailableRuntimeVersions', response) + deserialized = self._deserialize('AvailableRuntimeVersions', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_services_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_services_operations.py index cd5766c5cbf..2aa4b23d010 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_services_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_services_operations.py @@ -1,859 +1,931 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class ServicesOperations(object): """ServicesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_11_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2020-11-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-11-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" """Get a Service and its properties. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ServiceResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ServiceResource', response) + deserialized = self._deserialize('ServiceResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, service_name, resource, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(resource, 'ServiceResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ServiceResource', response) + deserialized = self._deserialize('ServiceResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('ServiceResource', response) + deserialized = self._deserialize('ServiceResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('ServiceResource', response) + deserialized = self._deserialize('ServiceResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, service_name, resource, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ServiceResource"] """Create a new Service or update an exiting Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param resource: Parameters for the create or update operation - :type resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns ServiceResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource]] - :raises: :class:`CloudError` + :param resource: Parameters for the create or update operation. + :type resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('ServiceResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _delete_initial( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - def delete( - self, resource_group_name, service_name, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_delete( + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _update_initial( - self, resource_group_name, service_name, resource, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(resource, 'ServiceResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ServiceResource', response) + deserialized = self._deserialize('ServiceResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('ServiceResource', response) + deserialized = self._deserialize('ServiceResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, service_name, resource, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ServiceResource"] """Operation to update an exiting Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param resource: Parameters for the update operation - :type resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns ServiceResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource]] - :raises: :class:`CloudError` + :param resource: Parameters for the update operation. + :type resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('ServiceResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def list_test_keys( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """List test keys for a Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TestKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeys or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL - url = self.list_test_keys.metadata['url'] + url = self.list_test_keys.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('TestKeys', response) + deserialized = self._deserialize('TestKeys', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore def regenerate_test_key( - self, resource_group_name, service_name, key_type, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + regenerate_test_key_request, # type: "_models.RegenerateTestKeyRequestPayload" + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """Regenerate a test key for a Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param key_type: Type of the test key. Possible values include: - 'Primary', 'Secondary' - :type key_type: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeyType - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TestKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeys or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param regenerate_test_key_request: Parameters for the operation. + :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2020_11_01_preview.models.RegenerateTestKeyRequestPayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError """ - regenerate_test_key_request = models.RegenerateTestKeyRequestPayload(key_type=key_type) + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.regenerate_test_key.metadata['url'] + url = self.regenerate_test_key.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('TestKeys', response) + deserialized = self._deserialize('TestKeys', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore def disable_test_endpoint( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Disable test endpoint functionality for a Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL - url = self.disable_test_endpoint.metadata['url'] + url = self.disable_test_endpoint.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} + disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore def enable_test_endpoint( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """Enable test endpoint functionality for a Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TestKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeys or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + # Construct URL - url = self.enable_test_endpoint.metadata['url'] + url = self.enable_test_endpoint.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('TestKeys', response) + deserialized = self._deserialize('TestKeys', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore def check_name_availability( - self, location, type, name, custom_headers=None, raw=False, **operation_config): + self, + location, # type: str + availability_parameters, # type: "_models.NameAvailabilityParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.NameAvailability" """Checks that the resource name is valid and is not already in use. - :param location: the region + :param location: the region. :type location: str - :param type: Type of the resource to check name availability - :type type: str - :param name: Name to be checked - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: NameAvailability or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailability or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param availability_parameters: Parameters supplied to the operation. + :type availability_parameters: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailability + :raises: ~azure.core.exceptions.HttpResponseError """ - availability_parameters = models.NameAvailabilityParameters(type=type, name=name) + cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailability"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.check_name_availability.metadata['url'] + url = self.check_name_availability.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('NameAvailability', response) + deserialized = self._deserialize('NameAvailability', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore def list_by_subscription( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServiceResourceList"] """Handles requests to list all resources in a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ServiceResource - :rtype: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourcePaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_subscription.metadata['url'] + url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ServiceResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ServiceResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore def list( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServiceResourceList"] """Handles requests to list all resources in a resource group. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ServiceResource - :rtype: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourcePaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ServiceResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ServiceResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_skus_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_skus_operations.py index b50492dd200..746347c182f 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_skus_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/operations/_skus_operations.py @@ -1,106 +1,113 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class SkusOperations(object): """SkusOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2020_11_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2020-11-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-11-01-preview" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ResourceSkuCollection"] """Lists all of the available skus of the Microsoft.AppPlatform provider. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceSku - :rtype: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSku] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceSkuPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/py.typed b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2020_11_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/__init__.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/__init__.py index ee44eafce0f..d2ddf950056 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/__init__.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/__init__.py @@ -1,19 +1,19 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._configuration import AppPlatformManagementClientConfiguration from ._app_platform_management_client import AppPlatformManagementClient -__all__ = ['AppPlatformManagementClient', 'AppPlatformManagementClientConfiguration'] - -from .version import VERSION +from ._version import VERSION __version__ = VERSION +__all__ = ['AppPlatformManagementClient'] +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/_app_platform_management_client.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/_app_platform_management_client.py index a057464c518..7deee559a53 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/_app_platform_management_client.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/_app_platform_management_client.py @@ -1,16 +1,22 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import SDKClient -from msrest import Serializer, Deserializer +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import AppPlatformManagementClientConfiguration from .operations import ServicesOperations @@ -27,75 +33,107 @@ from . import models -class AppPlatformManagementClient(SDKClient): - """REST API for Azure Spring Cloud +class AppPlatformManagementClient(object): + """REST API for Azure Spring Cloud. - :ivar config: Configuration for client. - :vartype config: AppPlatformManagementClientConfiguration - - :ivar services: Services operations + :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2021_06_01_preview.operations.ServicesOperations - :ivar config_servers: ConfigServers operations + :ivar config_servers: ConfigServersOperations operations :vartype config_servers: azure.mgmt.appplatform.v2021_06_01_preview.operations.ConfigServersOperations - :ivar monitoring_settings: MonitoringSettings operations + :ivar monitoring_settings: MonitoringSettingsOperations operations :vartype monitoring_settings: azure.mgmt.appplatform.v2021_06_01_preview.operations.MonitoringSettingsOperations - :ivar apps: Apps operations + :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2021_06_01_preview.operations.AppsOperations - :ivar bindings: Bindings operations + :ivar bindings: BindingsOperations operations :vartype bindings: azure.mgmt.appplatform.v2021_06_01_preview.operations.BindingsOperations - :ivar certificates: Certificates operations + :ivar certificates: CertificatesOperations operations :vartype certificates: azure.mgmt.appplatform.v2021_06_01_preview.operations.CertificatesOperations - :ivar custom_domains: CustomDomains operations + :ivar custom_domains: CustomDomainsOperations operations :vartype custom_domains: azure.mgmt.appplatform.v2021_06_01_preview.operations.CustomDomainsOperations - :ivar deployments: Deployments operations + :ivar deployments: DeploymentsOperations operations :vartype deployments: azure.mgmt.appplatform.v2021_06_01_preview.operations.DeploymentsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2021_06_01_preview.operations.Operations - :ivar runtime_versions: RuntimeVersions operations + :ivar runtime_versions: RuntimeVersionsOperations operations :vartype runtime_versions: azure.mgmt.appplatform.v2021_06_01_preview.operations.RuntimeVersionsOperations - :ivar skus: Skus operations + :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2021_06_01_preview.operations.SkusOperations - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Gets subscription ID which uniquely identify the - Microsoft Azure subscription. The subscription ID forms part of the URI - for every service call. + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = AppPlatformManagementClientConfiguration(credentials, subscription_id, base_url) - super(AppPlatformManagementClient, self).__init__(self.config.credentials, self.config) + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2021-06-01-preview' self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.services = ServicesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.config_servers = ConfigServersOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.monitoring_settings = MonitoringSettingsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.apps = AppsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.bindings = BindingsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.certificates = CertificatesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.custom_domains = CustomDomainsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.deployments = DeploymentsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.operations = Operations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.runtime_versions = RuntimeVersionsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.skus = SkusOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> AppPlatformManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/_configuration.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/_configuration.py index 5a7f3752f05..a358948766f 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/_configuration.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/_configuration.py @@ -1,50 +1,71 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrestazure import AzureConfiguration -from .version import VERSION +from typing import TYPE_CHECKING +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class AppPlatformManagementClientConfiguration(Configuration): + """Configuration for AppPlatformManagementClient. -class AppPlatformManagementClientConfiguration(AzureConfiguration): - """Configuration for AppPlatformManagementClient Note that all parameters used to create this instance are saved as instance attributes. - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Gets subscription ID which uniquely identify the - Microsoft Azure subscription. The subscription ID forms part of the URI - for every service call. + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - if not base_url: - base_url = 'https://management.azure.com' - - super(AppPlatformManagementClientConfiguration, self).__init__(base_url) - - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) - self.add_user_agent('azure-mgmt-appplatform/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials + self.credential = credential self.subscription_id = subscription_id + self.api_version = "2021-06-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/_metadata.json b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/_metadata.json new file mode 100644 index 00000000000..c8bb068cd9a --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/_metadata.json @@ -0,0 +1,113 @@ +{ + "chosen_version": "2021-06-01-preview", + "total_api_version_list": ["2021-06-01-preview"], + "client": { + "name": "AppPlatformManagementClient", + "filename": "_app_platform_management_client", + "description": "REST API for Azure Spring Cloud.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AppPlatformManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "services": "ServicesOperations", + "config_servers": "ConfigServersOperations", + "monitoring_settings": "MonitoringSettingsOperations", + "apps": "AppsOperations", + "bindings": "BindingsOperations", + "certificates": "CertificatesOperations", + "custom_domains": "CustomDomainsOperations", + "deployments": "DeploymentsOperations", + "operations": "Operations", + "runtime_versions": "RuntimeVersionsOperations", + "skus": "SkusOperations" + } +} \ No newline at end of file diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/_version.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/_version.py new file mode 100644 index 00000000000..92453d8691d --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/_version.py @@ -0,0 +1,9 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "6.1.0" diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/__init__.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/__init__.py new file mode 100644 index 00000000000..39f10548873 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/__init__.py @@ -0,0 +1,10 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._app_platform_management_client import AppPlatformManagementClient +__all__ = ['AppPlatformManagementClient'] diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/_app_platform_management_client.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/_app_platform_management_client.py new file mode 100644 index 00000000000..dfc7ace8ede --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/_app_platform_management_client.py @@ -0,0 +1,132 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import ServicesOperations +from .operations import ConfigServersOperations +from .operations import MonitoringSettingsOperations +from .operations import AppsOperations +from .operations import BindingsOperations +from .operations import CertificatesOperations +from .operations import CustomDomainsOperations +from .operations import DeploymentsOperations +from .operations import Operations +from .operations import RuntimeVersionsOperations +from .operations import SkusOperations +from .. import models + + +class AppPlatformManagementClient(object): + """REST API for Azure Spring Cloud. + + :ivar services: ServicesOperations operations + :vartype services: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.ServicesOperations + :ivar config_servers: ConfigServersOperations operations + :vartype config_servers: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.ConfigServersOperations + :ivar monitoring_settings: MonitoringSettingsOperations operations + :vartype monitoring_settings: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.MonitoringSettingsOperations + :ivar apps: AppsOperations operations + :vartype apps: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.AppsOperations + :ivar bindings: BindingsOperations operations + :vartype bindings: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.BindingsOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.CertificatesOperations + :ivar custom_domains: CustomDomainsOperations operations + :vartype custom_domains: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.CustomDomainsOperations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.DeploymentsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.Operations + :ivar runtime_versions: RuntimeVersionsOperations operations + :vartype runtime_versions: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.RuntimeVersionsOperations + :ivar skus: SkusOperations operations + :vartype skus: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.SkusOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.services = ServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "AppPlatformManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/_configuration.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/_configuration.py new file mode 100644 index 00000000000..80c22c56c44 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/_configuration.py @@ -0,0 +1,67 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class AppPlatformManagementClientConfiguration(Configuration): + """Configuration for AppPlatformManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-06-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/__init__.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/__init__.py new file mode 100644 index 00000000000..aa6fe5cd0cf --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/__init__.py @@ -0,0 +1,33 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._services_operations import ServicesOperations +from ._config_servers_operations import ConfigServersOperations +from ._monitoring_settings_operations import MonitoringSettingsOperations +from ._apps_operations import AppsOperations +from ._bindings_operations import BindingsOperations +from ._certificates_operations import CertificatesOperations +from ._custom_domains_operations import CustomDomainsOperations +from ._deployments_operations import DeploymentsOperations +from ._operations import Operations +from ._runtime_versions_operations import RuntimeVersionsOperations +from ._skus_operations import SkusOperations + +__all__ = [ + 'ServicesOperations', + 'ConfigServersOperations', + 'MonitoringSettingsOperations', + 'AppsOperations', + 'BindingsOperations', + 'CertificatesOperations', + 'CustomDomainsOperations', + 'DeploymentsOperations', + 'Operations', + 'RuntimeVersionsOperations', + 'SkusOperations', +] diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_apps_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_apps_operations.py new file mode 100644 index 00000000000..4de955a7168 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_apps_operations.py @@ -0,0 +1,712 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AppsOperations: + """AppsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + sync_status: Optional[str] = None, + **kwargs: Any + ) -> "_models.AppResource": + """Get an App and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param sync_status: Indicates whether sync status. + :type sync_status: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if sync_status is not None: + query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.AppResource"]: + """Create a new App or update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param app_resource: Parameters for the create or update operation. + :type app_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.AppResource"]: + """Operation to update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param app_resource: Parameters for the update operation. + :type app_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.AppResourceCollection"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AppResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + + async def get_resource_upload_url( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> "_models.ResourceUploadDefinition": + """Get an resource upload URL for an App, which may be artifacts or source archive. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceUploadDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceUploadDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_resource_upload_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore + + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: "_models.CustomDomainValidatePayload", + **kwargs: Any + ) -> "_models.CustomDomainValidateResult": + """Check the resource name is valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param validate_payload: Custom domain payload to be validated. + :type validate_payload: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidatePayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidateResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.validate_domain.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_bindings_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_bindings_operations.py new file mode 100644 index 00000000000..b4572f289da --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_bindings_operations.py @@ -0,0 +1,602 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BindingsOperations: + """BindingsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> "_models.BindingResource": + """Get a Binding and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BindingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.BindingResource"]: + """Create a new Binding or update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :param binding_resource: Parameters for the create or update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete a Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.BindingResource"]: + """Operation to update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :param binding_resource: Parameters for the update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BindingResourceCollection"]: + """Handles requests to list all resources in an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_certificates_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_certificates_operations.py new file mode 100644 index 00000000000..60ac54d7607 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_certificates_operations.py @@ -0,0 +1,437 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CertificatesOperations: + """CertificatesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> "_models.CertificateResource": + """Get the certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> "_models.CertificateResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_resource, 'CertificateResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.CertificateResource"]: + """Create or update certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :param certificate_resource: Parameters for the create or update operation. + :type certificate_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + certificate_resource=certificate_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.CertificateResourceCollection"]: + """List all the certificates of one user. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_config_servers_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_config_servers_operations.py new file mode 100644 index 00000000000..b032bebe43d --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_config_servers_operations.py @@ -0,0 +1,489 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConfigServersOperations: + """ConfigServersOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ConfigServerResource": + """Get the config server and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigServerResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + async def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigServerResource"]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param config_server_resource: Parameters for the update operation. + :type config_server_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + async def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigServerResource"]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param config_server_resource: Parameters for the update operation. + :type config_server_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + async def _validate_initial( + self, + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> "_models.ConfigServerSettingsValidateResult": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigServerSettingsValidateResult"]: + """Check if the config server settings are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param config_server_settings: Config server settings to be validated. + :type config_server_settings: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_settings=config_server_settings, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_custom_domains_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_custom_domains_operations.py new file mode 100644 index 00000000000..4c1b197d9f5 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_custom_domains_operations.py @@ -0,0 +1,602 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CustomDomainsOperations: + """CustomDomainsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.CustomDomainResource": + """Get the custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.CustomDomainResource"]: + """Create or update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.CustomDomainResource"]: + """Update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.CustomDomainResourceCollection"]: + """List the custom domains of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_deployments_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_deployments_operations.py new file mode 100644 index 00000000000..ef6fc17c694 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_deployments_operations.py @@ -0,0 +1,1125 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DeploymentsOperations: + """DeploymentsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> "_models.DeploymentResource": + """Get a Deployment and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.DeploymentResource"]: + """Create a new Deployment or update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param deployment_resource: Parameters for the create or update operation. + :type deployment_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete a Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.DeploymentResource"]: + """Operation to update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param deployment_resource: Parameters for the update operation. + :type deployment_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DeploymentResourceCollection"]: + """Handles requests to list all resources in an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param version: Version of the deployments to be listed. + :type version: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore + + def list_for_cluster( + self, + resource_group_name: str, + service_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DeploymentResourceCollection"]: + """List deployments for a certain service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param version: Version of the deployments to be listed. + :type version: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_for_cluster.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore + + async def _start_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + + async def begin_start( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Start the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + + async def _stop_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + + async def begin_stop( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Stop the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._stop_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + + async def _restart_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + + async def begin_restart( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restart the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + + async def get_log_file_url( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> Optional["_models.LogFileUrlResponse"]: + """Get deployment log file URL. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogFileUrlResponse, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.LogFileUrlResponse or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LogFileUrlResponse"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_log_file_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LogFileUrlResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_monitoring_settings_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_monitoring_settings_operations.py new file mode 100644 index 00000000000..49ecf2833cd --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_monitoring_settings_operations.py @@ -0,0 +1,360 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MonitoringSettingsOperations: + """MonitoringSettingsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.MonitoringSettingResource": + """Get the Monitoring Setting and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoringSettingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + async def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.MonitoringSettingResource"]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + async def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.MonitoringSettingResource"]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_operations.py new file mode 100644 index 00000000000..8ccd1eee431 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_operations.py @@ -0,0 +1,104 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.AvailableOperations"]: + """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailableOperations or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AvailableOperations] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AvailableOperations', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_runtime_versions_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_runtime_versions_operations.py new file mode 100644 index 00000000000..1b2936a30aa --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_runtime_versions_operations.py @@ -0,0 +1,87 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RuntimeVersionsOperations: + """RuntimeVersionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list_runtime_versions( + self, + **kwargs: Any + ) -> "_models.AvailableRuntimeVersions": + """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailableRuntimeVersions, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AvailableRuntimeVersions + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableRuntimeVersions"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_runtime_versions.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AvailableRuntimeVersions', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_services_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_services_operations.py new file mode 100644 index 00000000000..a7d0539bc53 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_services_operations.py @@ -0,0 +1,913 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ServicesOperations: + """ServicesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ServiceResource": + """Get a Service and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ServiceResource"]: + """Create a new Service or update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param resource: Parameters for the create or update operation. + :type resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ServiceResource"]: + """Operation to update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param resource: Parameters for the update operation. + :type resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + async def list_test_keys( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": + """List test keys for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_test_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + + async def regenerate_test_key( + self, + resource_group_name: str, + service_name: str, + regenerate_test_key_request: "_models.RegenerateTestKeyRequestPayload", + **kwargs: Any + ) -> "_models.TestKeys": + """Regenerate a test key for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param regenerate_test_key_request: Parameters for the operation. + :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2021_06_01_preview.models.RegenerateTestKeyRequestPayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_test_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore + + async def disable_test_endpoint( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: + """Disable test endpoint functionality for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.disable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + + async def enable_test_endpoint( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": + """Enable test endpoint functionality for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.enable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore + + async def check_name_availability( + self, + location: str, + availability_parameters: "_models.NameAvailabilityParameters", + **kwargs: Any + ) -> "_models.NameAvailability": + """Checks that the resource name is valid and is not already in use. + + :param location: the region. + :type location: str + :param availability_parameters: Parameters supplied to the operation. + :type availability_parameters: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailability + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailability"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NameAvailability', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ServiceResourceList"]: + """Handles requests to list all resources in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ServiceResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + + def list( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ServiceResourceList"]: + """Handles requests to list all resources in a resource group. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ServiceResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_skus_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_skus_operations.py new file mode 100644 index 00000000000..8ed38802659 --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_skus_operations.py @@ -0,0 +1,108 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SkusOperations: + """SkusOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ResourceSkuCollection"]: + """Lists all of the available skus of the Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/models/__init__.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/models/__init__.py index e2b1091ec8a..4fcc9dd5cc6 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/models/__init__.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/models/__init__.py @@ -1,23 +1,25 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- try: - from ._models_py3 import ApplicationInsightsAgentVersions from ._models_py3 import AppResource + from ._models_py3 import AppResourceCollection from ._models_py3 import AppResourceProperties + from ._models_py3 import ApplicationInsightsAgentVersions + from ._models_py3 import AvailableOperations from ._models_py3 import AvailableRuntimeVersions from ._models_py3 import BindingResource + from ._models_py3 import BindingResourceCollection from ._models_py3 import BindingResourceProperties from ._models_py3 import CertificateProperties from ._models_py3 import CertificateResource + from ._models_py3 import CertificateResourceCollection + from ._models_py3 import CloudErrorBody from ._models_py3 import ClusterResourceProperties from ._models_py3 import ConfigServerGitProperty from ._models_py3 import ConfigServerProperties @@ -25,16 +27,20 @@ from ._models_py3 import ConfigServerSettings from ._models_py3 import ConfigServerSettingsErrorRecord from ._models_py3 import ConfigServerSettingsValidateResult + from ._models_py3 import CustomContainer from ._models_py3 import CustomDomainProperties from ._models_py3 import CustomDomainResource + from ._models_py3 import CustomDomainResourceCollection from ._models_py3 import CustomDomainValidatePayload from ._models_py3 import CustomDomainValidateResult from ._models_py3 import DeploymentInstance from ._models_py3 import DeploymentResource + from ._models_py3 import DeploymentResourceCollection from ._models_py3 import DeploymentResourceProperties from ._models_py3 import DeploymentSettings from ._models_py3 import Error from ._models_py3 import GitPatternRepository + from ._models_py3 import ImageRegistryCredential from ._models_py3 import LogFileUrlResponse from ._models_py3 import LogSpecification from ._models_py3 import ManagedIdentityProperties @@ -57,12 +63,14 @@ from ._models_py3 import ResourceRequests from ._models_py3 import ResourceSku from ._models_py3 import ResourceSkuCapabilities + from ._models_py3 import ResourceSkuCollection from ._models_py3 import ResourceSkuLocationInfo from ._models_py3 import ResourceSkuRestrictionInfo from ._models_py3 import ResourceSkuRestrictions from ._models_py3 import ResourceSkuZoneDetails from ._models_py3 import ResourceUploadDefinition from ._models_py3 import ServiceResource + from ._models_py3 import ServiceResourceList from ._models_py3 import ServiceSpecification from ._models_py3 import Sku from ._models_py3 import SkuCapacity @@ -72,103 +80,112 @@ from ._models_py3 import TrackedResource from ._models_py3 import UserSourceInfo except (SyntaxError, ImportError): - from ._models import ApplicationInsightsAgentVersions - from ._models import AppResource - from ._models import AppResourceProperties - from ._models import AvailableRuntimeVersions - from ._models import BindingResource - from ._models import BindingResourceProperties - from ._models import CertificateProperties - from ._models import CertificateResource - from ._models import ClusterResourceProperties - from ._models import ConfigServerGitProperty - from ._models import ConfigServerProperties - from ._models import ConfigServerResource - from ._models import ConfigServerSettings - from ._models import ConfigServerSettingsErrorRecord - from ._models import ConfigServerSettingsValidateResult - from ._models import CustomDomainProperties - from ._models import CustomDomainResource - from ._models import CustomDomainValidatePayload - from ._models import CustomDomainValidateResult - from ._models import DeploymentInstance - from ._models import DeploymentResource - from ._models import DeploymentResourceProperties - from ._models import DeploymentSettings - from ._models import Error - from ._models import GitPatternRepository - from ._models import LogFileUrlResponse - from ._models import LogSpecification - from ._models import ManagedIdentityProperties - from ._models import MetricDimension - from ._models import MetricSpecification - from ._models import MonitoringSettingProperties - from ._models import MonitoringSettingResource - from ._models import NameAvailability - from ._models import NameAvailabilityParameters - from ._models import NetworkProfile - from ._models import NetworkProfileOutboundIPs - from ._models import OperationDetail - from ._models import OperationDisplay - from ._models import OperationProperties - from ._models import PersistentDisk - from ._models import ProxyResource - from ._models import RegenerateTestKeyRequestPayload - from ._models import RequiredTraffic - from ._models import Resource - from ._models import ResourceRequests - from ._models import ResourceSku - from ._models import ResourceSkuCapabilities - from ._models import ResourceSkuLocationInfo - from ._models import ResourceSkuRestrictionInfo - from ._models import ResourceSkuRestrictions - from ._models import ResourceSkuZoneDetails - from ._models import ResourceUploadDefinition - from ._models import ServiceResource - from ._models import ServiceSpecification - from ._models import Sku - from ._models import SkuCapacity - from ._models import SupportedRuntimeVersion - from ._models import TemporaryDisk - from ._models import TestKeys - from ._models import TrackedResource - from ._models import UserSourceInfo -from ._paged_models import AppResourcePaged -from ._paged_models import BindingResourcePaged -from ._paged_models import CertificateResourcePaged -from ._paged_models import CustomDomainResourcePaged -from ._paged_models import DeploymentResourcePaged -from ._paged_models import OperationDetailPaged -from ._paged_models import ResourceSkuPaged -from ._paged_models import ServiceResourcePaged + from ._models import AppResource # type: ignore + from ._models import AppResourceCollection # type: ignore + from ._models import AppResourceProperties # type: ignore + from ._models import ApplicationInsightsAgentVersions # type: ignore + from ._models import AvailableOperations # type: ignore + from ._models import AvailableRuntimeVersions # type: ignore + from ._models import BindingResource # type: ignore + from ._models import BindingResourceCollection # type: ignore + from ._models import BindingResourceProperties # type: ignore + from ._models import CertificateProperties # type: ignore + from ._models import CertificateResource # type: ignore + from ._models import CertificateResourceCollection # type: ignore + from ._models import CloudErrorBody # type: ignore + from ._models import ClusterResourceProperties # type: ignore + from ._models import ConfigServerGitProperty # type: ignore + from ._models import ConfigServerProperties # type: ignore + from ._models import ConfigServerResource # type: ignore + from ._models import ConfigServerSettings # type: ignore + from ._models import ConfigServerSettingsErrorRecord # type: ignore + from ._models import ConfigServerSettingsValidateResult # type: ignore + from ._models import CustomContainer # type: ignore + from ._models import CustomDomainProperties # type: ignore + from ._models import CustomDomainResource # type: ignore + from ._models import CustomDomainResourceCollection # type: ignore + from ._models import CustomDomainValidatePayload # type: ignore + from ._models import CustomDomainValidateResult # type: ignore + from ._models import DeploymentInstance # type: ignore + from ._models import DeploymentResource # type: ignore + from ._models import DeploymentResourceCollection # type: ignore + from ._models import DeploymentResourceProperties # type: ignore + from ._models import DeploymentSettings # type: ignore + from ._models import Error # type: ignore + from ._models import GitPatternRepository # type: ignore + from ._models import ImageRegistryCredential # type: ignore + from ._models import LogFileUrlResponse # type: ignore + from ._models import LogSpecification # type: ignore + from ._models import ManagedIdentityProperties # type: ignore + from ._models import MetricDimension # type: ignore + from ._models import MetricSpecification # type: ignore + from ._models import MonitoringSettingProperties # type: ignore + from ._models import MonitoringSettingResource # type: ignore + from ._models import NameAvailability # type: ignore + from ._models import NameAvailabilityParameters # type: ignore + from ._models import NetworkProfile # type: ignore + from ._models import NetworkProfileOutboundIPs # type: ignore + from ._models import OperationDetail # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationProperties # type: ignore + from ._models import PersistentDisk # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import RegenerateTestKeyRequestPayload # type: ignore + from ._models import RequiredTraffic # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceRequests # type: ignore + from ._models import ResourceSku # type: ignore + from ._models import ResourceSkuCapabilities # type: ignore + from ._models import ResourceSkuCollection # type: ignore + from ._models import ResourceSkuLocationInfo # type: ignore + from ._models import ResourceSkuRestrictionInfo # type: ignore + from ._models import ResourceSkuRestrictions # type: ignore + from ._models import ResourceSkuZoneDetails # type: ignore + from ._models import ResourceUploadDefinition # type: ignore + from ._models import ServiceResource # type: ignore + from ._models import ServiceResourceList # type: ignore + from ._models import ServiceSpecification # type: ignore + from ._models import Sku # type: ignore + from ._models import SkuCapacity # type: ignore + from ._models import SupportedRuntimeVersion # type: ignore + from ._models import TemporaryDisk # type: ignore + from ._models import TestKeys # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import UserSourceInfo # type: ignore + from ._app_platform_management_client_enums import ( - ProvisioningState, - TrafficDirection, - ManagedIdentityType, - ConfigServerState, - MonitoringSettingState, - TestKeyType, AppResourceProvisioningState, - UserSourceType, - RuntimeVersion, + ConfigServerState, DeploymentResourceProvisioningState, DeploymentResourceStatus, - SkuScaleType, - ResourceSkuRestrictionsType, + ManagedIdentityType, + MonitoringSettingState, + ProvisioningState, ResourceSkuRestrictionsReasonCode, - SupportedRuntimeValue, + ResourceSkuRestrictionsType, + RuntimeVersion, + SkuScaleType, SupportedRuntimePlatform, + SupportedRuntimeValue, + TestKeyType, + TrafficDirection, + UserSourceType, ) __all__ = [ - 'ApplicationInsightsAgentVersions', 'AppResource', + 'AppResourceCollection', 'AppResourceProperties', + 'ApplicationInsightsAgentVersions', + 'AvailableOperations', 'AvailableRuntimeVersions', 'BindingResource', + 'BindingResourceCollection', 'BindingResourceProperties', 'CertificateProperties', 'CertificateResource', + 'CertificateResourceCollection', + 'CloudErrorBody', 'ClusterResourceProperties', 'ConfigServerGitProperty', 'ConfigServerProperties', @@ -176,16 +193,20 @@ 'ConfigServerSettings', 'ConfigServerSettingsErrorRecord', 'ConfigServerSettingsValidateResult', + 'CustomContainer', 'CustomDomainProperties', 'CustomDomainResource', + 'CustomDomainResourceCollection', 'CustomDomainValidatePayload', 'CustomDomainValidateResult', 'DeploymentInstance', 'DeploymentResource', + 'DeploymentResourceCollection', 'DeploymentResourceProperties', 'DeploymentSettings', 'Error', 'GitPatternRepository', + 'ImageRegistryCredential', 'LogFileUrlResponse', 'LogSpecification', 'ManagedIdentityProperties', @@ -208,12 +229,14 @@ 'ResourceRequests', 'ResourceSku', 'ResourceSkuCapabilities', + 'ResourceSkuCollection', 'ResourceSkuLocationInfo', 'ResourceSkuRestrictionInfo', 'ResourceSkuRestrictions', 'ResourceSkuZoneDetails', 'ResourceUploadDefinition', 'ServiceResource', + 'ServiceResourceList', 'ServiceSpecification', 'Sku', 'SkuCapacity', @@ -222,28 +245,20 @@ 'TestKeys', 'TrackedResource', 'UserSourceInfo', - 'ServiceResourcePaged', - 'AppResourcePaged', - 'BindingResourcePaged', - 'CertificateResourcePaged', - 'CustomDomainResourcePaged', - 'DeploymentResourcePaged', - 'OperationDetailPaged', - 'ResourceSkuPaged', - 'ProvisioningState', - 'TrafficDirection', - 'ManagedIdentityType', - 'ConfigServerState', - 'MonitoringSettingState', - 'TestKeyType', 'AppResourceProvisioningState', - 'UserSourceType', - 'RuntimeVersion', + 'ConfigServerState', 'DeploymentResourceProvisioningState', 'DeploymentResourceStatus', - 'SkuScaleType', - 'ResourceSkuRestrictionsType', + 'ManagedIdentityType', + 'MonitoringSettingState', + 'ProvisioningState', 'ResourceSkuRestrictionsReasonCode', - 'SupportedRuntimeValue', + 'ResourceSkuRestrictionsType', + 'RuntimeVersion', + 'SkuScaleType', 'SupportedRuntimePlatform', + 'SupportedRuntimeValue', + 'TestKeyType', + 'TrafficDirection', + 'UserSourceType', ] diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/models/_app_platform_management_client_enums.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/models/_app_platform_management_client_enums.py index 5ae8632fbad..aa047f451ec 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/models/_app_platform_management_client_enums.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/models/_app_platform_management_client_enums.py @@ -1,135 +1,168 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum - - -class ProvisioningState(str, Enum): - - creating = "Creating" - updating = "Updating" - deleting = "Deleting" - deleted = "Deleted" - succeeded = "Succeeded" - failed = "Failed" - moving = "Moving" - moved = "Moved" - move_failed = "MoveFailed" - - -class TrafficDirection(str, Enum): - - inbound = "Inbound" - outbound = "Outbound" - - -class ManagedIdentityType(str, Enum): - - none = "None" - system_assigned = "SystemAssigned" - user_assigned = "UserAssigned" - system_assigned_user_assigned = "SystemAssigned,UserAssigned" - - -class ConfigServerState(str, Enum): - - not_available = "NotAvailable" - deleted = "Deleted" - failed = "Failed" - succeeded = "Succeeded" - updating = "Updating" - - -class MonitoringSettingState(str, Enum): - - not_available = "NotAvailable" - failed = "Failed" - succeeded = "Succeeded" - updating = "Updating" - - -class TestKeyType(str, Enum): - - primary = "Primary" - secondary = "Secondary" - - -class AppResourceProvisioningState(str, Enum): - - succeeded = "Succeeded" - failed = "Failed" - creating = "Creating" - updating = "Updating" - - -class UserSourceType(str, Enum): - - jar = "Jar" - net_core_zip = "NetCoreZip" - source = "Source" - - -class RuntimeVersion(str, Enum): - - java_8 = "Java_8" - java_11 = "Java_11" - net_core_31 = "NetCore_31" - - -class DeploymentResourceProvisioningState(str, Enum): - - creating = "Creating" - updating = "Updating" - succeeded = "Succeeded" - failed = "Failed" - - -class DeploymentResourceStatus(str, Enum): - - unknown = "Unknown" - stopped = "Stopped" - running = "Running" - failed = "Failed" - allocating = "Allocating" - upgrading = "Upgrading" - compiling = "Compiling" - - -class SkuScaleType(str, Enum): - - none = "None" - manual = "Manual" - automatic = "Automatic" - - -class ResourceSkuRestrictionsType(str, Enum): - - location = "Location" - zone = "Zone" - - -class ResourceSkuRestrictionsReasonCode(str, Enum): - - quota_id = "QuotaId" - not_available_for_subscription = "NotAvailableForSubscription" - - -class SupportedRuntimeValue(str, Enum): - - java_8 = "Java_8" - java_11 = "Java_11" - net_core_31 = "NetCore_31" - - -class SupportedRuntimePlatform(str, Enum): - - java = "Java" - net_core = ".NET Core" +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the App + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CREATING = "Creating" + UPDATING = "Updating" + +class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State of the config server. + """ + + NOT_AVAILABLE = "NotAvailable" + DELETED = "Deleted" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + +class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Deployment + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + +class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of the Deployment + """ + + UNKNOWN = "Unknown" + STOPPED = "Stopped" + RUNNING = "Running" + FAILED = "Failed" + ALLOCATING = "Allocating" + UPGRADING = "Upgrading" + COMPILING = "Compiling" + +class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the managed identity + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + +class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State of the Monitoring Setting. + """ + + NOT_AVAILABLE = "NotAvailable" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Service + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + DELETED = "Deleted" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + MOVING = "Moving" + MOVED = "Moved" + MOVE_FAILED = "MoveFailed" + +class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription' + """ + + QUOTA_ID = "QuotaId" + NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" + +class ResourceSkuRestrictionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Gets the type of restrictions. Possible values include: 'Location', 'Zone' + """ + + LOCATION = "Location" + ZONE = "Zone" + +class RuntimeVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Runtime version + """ + + JAVA8 = "Java_8" + JAVA11 = "Java_11" + NET_CORE31 = "NetCore_31" + +class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Gets or sets the type of the scale. + """ + + NONE = "None" + MANUAL = "Manual" + AUTOMATIC = "Automatic" + +class SupportedRuntimePlatform(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The platform of this runtime version (possible values: "Java" or ".NET"). + """ + + JAVA = "Java" + _NET_CORE = ".NET Core" + +class SupportedRuntimeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The raw value which could be passed to deployment CRUD operations. + """ + + JAVA8 = "Java_8" + JAVA11 = "Java_11" + NET_CORE31 = "NetCore_31" + +class TestKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the test key + """ + + PRIMARY = "Primary" + SECONDARY = "Secondary" + +class TrafficDirection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The direction of required traffic + """ + + INBOUND = "Inbound" + OUTBOUND = "Outbound" + +class UserSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the source uploaded + """ + + JAR = "Jar" + NET_CORE_ZIP = "NetCoreZip" + SOURCE = "Source" + CONTAINER = "Container" diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/models/_models.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/models/_models.py index e7be2477a24..0fff45f07e4 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/models/_models.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/models/_models.py @@ -1,25 +1,20 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +import msrest.serialization -class ApplicationInsightsAgentVersions(Model): +class ApplicationInsightsAgentVersions(msrest.serialization.Model): """Application Insights agent versions properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar java: Indicates the version of application insight java agent + :ivar java: Indicates the version of application insight java agent. :vartype java: str """ @@ -31,16 +26,18 @@ class ApplicationInsightsAgentVersions(Model): 'java': {'key': 'java', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ApplicationInsightsAgentVersions, self).__init__(**kwargs) self.java = None -class Resource(Model): +class Resource(msrest.serialization.Model): """The core properties of ARM resources. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -62,7 +59,10 @@ class Resource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -70,11 +70,9 @@ def __init__(self, **kwargs): class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have - everything other than required location and tags. + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -96,15 +94,17 @@ class ProxyResource(Resource): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ProxyResource, self).__init__(**kwargs) class AppResource(ProxyResource): """App resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -112,14 +112,11 @@ class AppResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the App resource - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceProperties - :param identity: The Managed Identity type of the app resource - :type identity: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityProperties - :param location: The GEO location of the application, always the same with - its parent resource + :param properties: Properties of the App resource. + :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceProperties + :param identity: The Managed Identity type of the app resource. + :type identity: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityProperties + :param location: The GEO location of the application, always the same with its parent resource. :type location: str """ @@ -138,41 +135,65 @@ class AppResource(ProxyResource): 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.identity = kwargs.get('identity', None) self.location = kwargs.get('location', None) -class AppResourceProperties(Model): +class AppResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :param value: Collection of App resources. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AppResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class AppResourceProperties(msrest.serialization.Model): """App resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param public: Indicates whether the App exposes public endpoint + :param public: Indicates whether the App exposes public endpoint. :type public: bool - :ivar url: URL of the App + :ivar url: URL of the App. :vartype url: str - :ivar provisioning_state: Provisioning state of the App. Possible values - include: 'Succeeded', 'Failed', 'Creating', 'Updating' + :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", + "Failed", "Creating", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceProvisioningState - :param active_deployment_name: Name of the active deployment of the App + :param active_deployment_name: Name of the active deployment of the App. :type active_deployment_name: str :param fqdn: Fully qualified dns Name. :type fqdn: str :param https_only: Indicate if only https is allowed. :type https_only: bool - :ivar created_time: Date time when the resource is created - :vartype created_time: datetime - :param temporary_disk: Temporary disk settings - :type temporary_disk: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.TemporaryDisk - :param persistent_disk: Persistent disk settings - :type persistent_disk: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.PersistentDisk + :ivar created_time: Date time when the resource is created. + :vartype created_time: ~datetime.datetime + :param temporary_disk: Temporary disk settings. + :type temporary_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TemporaryDisk + :param persistent_disk: Persistent disk settings. + :type persistent_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.PersistentDisk :param enable_end_to_end_tls: Indicate if end to end TLS is enabled. :type enable_end_to_end_tls: bool """ @@ -196,7 +217,10 @@ class AppResourceProperties(Model): 'enable_end_to_end_tls': {'key': 'enableEndToEndTLS', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AppResourceProperties, self).__init__(**kwargs) self.public = kwargs.get('public', None) self.url = None @@ -210,11 +234,34 @@ def __init__(self, **kwargs): self.enable_end_to_end_tls = kwargs.get('enable_end_to_end_tls', None) -class AvailableRuntimeVersions(Model): +class AvailableOperations(msrest.serialization.Model): + """Available operations of the service. + + :param value: Collection of available operation details. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDetail] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationDetail]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AvailableOperations, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class AvailableRuntimeVersions(msrest.serialization.Model): """AvailableRuntimeVersions. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar value: A list of all supported runtime versions. :vartype value: @@ -229,7 +276,10 @@ class AvailableRuntimeVersions(Model): 'value': {'key': 'value', 'type': '[SupportedRuntimeVersion]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -237,8 +287,7 @@ def __init__(self, **kwargs): class BindingResource(ProxyResource): """Binding resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -246,9 +295,8 @@ class BindingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Binding resource - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceProperties + :param properties: Properties of the Binding resource. + :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceProperties """ _validation = { @@ -264,34 +312,59 @@ class BindingResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'BindingResourceProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BindingResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class BindingResourceProperties(Model): +class BindingResourceCollection(msrest.serialization.Model): + """Object that includes an array of Binding resources and a possible link for next set. + + :param value: Collection of Binding resources. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BindingResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BindingResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class BindingResourceProperties(msrest.serialization.Model): """Binding resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar resource_name: The name of the bound resource + :ivar resource_name: The name of the bound resource. :vartype resource_name: str - :ivar resource_type: The standard Azure resource type of the bound - resource + :ivar resource_type: The standard Azure resource type of the bound resource. :vartype resource_type: str - :param resource_id: The Azure resource id of the bound resource + :param resource_id: The Azure resource id of the bound resource. :type resource_id: str - :param key: The key of the bound resource + :param key: The key of the bound resource. :type key: str - :param binding_parameters: Binding parameters of the Binding resource - :type binding_parameters: dict[str, object] - :ivar generated_properties: The generated Spring Boot property file for - this binding. The secret will be deducted. + :param binding_parameters: Binding parameters of the Binding resource. + :type binding_parameters: dict[str, any] + :ivar generated_properties: The generated Spring Boot property file for this binding. The + secret will be deducted. :vartype generated_properties: str - :ivar created_at: Creation time of the Binding resource + :ivar created_at: Creation time of the Binding resource. :vartype created_at: str - :ivar updated_at: Update time of the Binding resource + :ivar updated_at: Update time of the Binding resource. :vartype updated_at: str """ @@ -314,7 +387,10 @@ class BindingResourceProperties(Model): 'updated_at': {'key': 'updatedAt', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -326,11 +402,10 @@ def __init__(self, **kwargs): self.updated_at = None -class CertificateProperties(Model): +class CertificateProperties(msrest.serialization.Model): """Certificate resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -381,11 +456,14 @@ class CertificateProperties(Model): 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateProperties, self).__init__(**kwargs) self.thumbprint = None - self.vault_uri = kwargs.get('vault_uri', None) - self.key_vault_cert_name = kwargs.get('key_vault_cert_name', None) + self.vault_uri = kwargs['vault_uri'] + self.key_vault_cert_name = kwargs['key_vault_cert_name'] self.cert_version = kwargs.get('cert_version', None) self.issuer = None self.issued_date = None @@ -398,8 +476,7 @@ def __init__(self, **kwargs): class CertificateResource(ProxyResource): """Certificate resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -408,8 +485,7 @@ class CertificateResource(ProxyResource): :ivar type: The type of the resource. :vartype type: str :param properties: Properties of the certificate resource payload. - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateProperties + :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateProperties """ _validation = { @@ -425,55 +501,51 @@ class CertificateResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class CloudError(Model): - """An error response from the service. +class CertificateResourceCollection(msrest.serialization.Model): + """Collection compose of certificate resources list and a possible link for next page. - :param error: An error response from the service. - :type error: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CloudErrorBody + :param value: The certificate resources list. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] + :param next_link: The link to next page of certificate list. + :type next_link: str """ _attribute_map = { - 'error': {'key': 'error', 'type': 'CloudErrorBody'}, + 'value': {'key': 'value', 'type': '[CertificateResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): - super(CloudError, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class CloudErrorException(HttpOperationError): - """Server responsed with exception of type: 'CloudError'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + def __init__( + self, + **kwargs + ): + super(CertificateResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) -class CloudErrorBody(Model): +class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are - intended to be consumed programmatically. + :param code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. :type code: str - :param message: A message describing the error, intended to be suitable - for display in a user interface. + :param message: A message describing the error, intended to be suitable for display in a user + interface. :type message: str - :param target: The target of the particular error. For example, the name - of the property in error. + :param target: The target of the particular error. For example, the name of the property in + error. :type target: str :param details: A list of additional details about the error. - :type details: - list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CloudErrorBody] + :type details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -483,7 +555,10 @@ class CloudErrorBody(Model): 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CloudErrorBody, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -491,24 +566,21 @@ def __init__(self, **kwargs): self.details = kwargs.get('details', None) -class ClusterResourceProperties(Model): +class ClusterResourceProperties(msrest.serialization.Model): """Service properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Provisioning state of the Service. Possible - values include: 'Creating', 'Updating', 'Deleting', 'Deleted', - 'Succeeded', 'Failed', 'Moving', 'Moved', 'MoveFailed' + :ivar provisioning_state: Provisioning state of the Service. Possible values include: + "Creating", "Updating", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", "Moved", + "MoveFailed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ProvisioningState - :param network_profile: Network profile of the Service - :type network_profile: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.NetworkProfile - :ivar version: Version of the Service + :param network_profile: Network profile of the Service. + :type network_profile: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NetworkProfile + :ivar version: Version of the Service. :vartype version: int - :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a - created resource + :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. :vartype service_id: str """ @@ -525,7 +597,10 @@ class ClusterResourceProperties(Model): 'service_id': {'key': 'serviceId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.network_profile = kwargs.get('network_profile', None) @@ -533,7 +608,7 @@ def __init__(self, **kwargs): self.service_id = None -class ConfigServerGitProperty(Model): +class ConfigServerGitProperty(msrest.serialization.Model): """Property of git. All required parameters must be populated in order to send to Azure. @@ -541,11 +616,11 @@ class ConfigServerGitProperty(Model): :param repositories: Repositories of git. :type repositories: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.GitPatternRepository] - :param uri: Required. URI of the repository + :param uri: Required. URI of the repository. :type uri: str - :param label: Label of the repository + :param label: Label of the repository. :type label: str - :param search_paths: Searching path of the repository + :param search_paths: Searching path of the repository. :type search_paths: list[str] :param username: Username of git repository basic auth. :type username: str @@ -578,10 +653,13 @@ class ConfigServerGitProperty(Model): 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = kwargs.get('repositories', None) - self.uri = kwargs.get('uri', None) + self.uri = kwargs['uri'] self.label = kwargs.get('label', None) self.search_paths = kwargs.get('search_paths', None) self.username = kwargs.get('username', None) @@ -592,21 +670,19 @@ def __init__(self, **kwargs): self.strict_host_key_checking = kwargs.get('strict_host_key_checking', None) -class ConfigServerProperties(Model): +class ConfigServerProperties(msrest.serialization.Model): """Config server git properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: State of the config server. Possible values - include: 'NotAvailable', 'Deleted', 'Failed', 'Succeeded', 'Updating' + :ivar provisioning_state: State of the config server. Possible values include: "NotAvailable", + "Deleted", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerState :param error: Error when apply config server settings. :type error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error :param config_server: Settings of config server. - :type config_server: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings + :type config_server: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings """ _validation = { @@ -619,7 +695,10 @@ class ConfigServerProperties(Model): 'config_server': {'key': 'configServer', 'type': 'ConfigServerSettings'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConfigServerProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = kwargs.get('error', None) @@ -629,8 +708,7 @@ def __init__(self, **kwargs): class ConfigServerResource(ProxyResource): """Config Server resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -638,9 +716,8 @@ class ConfigServerResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Config Server resource - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerProperties + :param properties: Properties of the Config Server resource. + :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerProperties """ _validation = { @@ -656,36 +733,41 @@ class ConfigServerResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'ConfigServerProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConfigServerResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class ConfigServerSettings(Model): +class ConfigServerSettings(msrest.serialization.Model): """The settings of config server. :param git_property: Property of git environment. - :type git_property: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerGitProperty + :type git_property: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerGitProperty """ _attribute_map = { 'git_property': {'key': 'gitProperty', 'type': 'ConfigServerGitProperty'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = kwargs.get('git_property', None) -class ConfigServerSettingsErrorRecord(Model): +class ConfigServerSettingsErrorRecord(msrest.serialization.Model): """Error record of the config server settings. - :param name: The name of the config server settings error record + :param name: The name of the config server settings error record. :type name: str - :param uri: The uri of the config server settings error record + :param uri: The uri of the config server settings error record. :type uri: str - :param messages: The detail error messages of the record + :param messages: The detail error messages of the record. :type messages: list[str] """ @@ -695,19 +777,22 @@ class ConfigServerSettingsErrorRecord(Model): 'messages': {'key': 'messages', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.uri = kwargs.get('uri', None) self.messages = kwargs.get('messages', None) -class ConfigServerSettingsValidateResult(Model): +class ConfigServerSettingsValidateResult(msrest.serialization.Model): """Validation result for config server settings. - :param is_valid: Indicate if the config server settings are valid + :param is_valid: Indicate if the config server settings are valid. :type is_valid: bool - :param details: The detail validation results + :param details: The detail validation results. :type details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettingsErrorRecord] """ @@ -717,17 +802,58 @@ class ConfigServerSettingsValidateResult(Model): 'details': {'key': 'details', 'type': '[ConfigServerSettingsErrorRecord]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) self.is_valid = kwargs.get('is_valid', None) self.details = kwargs.get('details', None) -class CustomDomainProperties(Model): +class CustomContainer(msrest.serialization.Model): + """Custom container payload. + + :param server: The name of the registry that contains the container image. + :type server: str + :param container_image: Container image of the custom container. This should be in the form of + :code:``::code:`` without the server name of the registry. + :type container_image: str + :param command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is + used if this is not provided. + :type command: list[str] + :param args: Arguments to the entrypoint. The docker image's CMD is used if this is not + provided. + :type args: list[str] + :param image_registry_credential: Credential of the image registry. + :type image_registry_credential: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ImageRegistryCredential + """ + + _attribute_map = { + 'server': {'key': 'server', 'type': 'str'}, + 'container_image': {'key': 'containerImage', 'type': 'str'}, + 'command': {'key': 'command', 'type': '[str]'}, + 'args': {'key': 'args', 'type': '[str]'}, + 'image_registry_credential': {'key': 'imageRegistryCredential', 'type': 'ImageRegistryCredential'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomContainer, self).__init__(**kwargs) + self.server = kwargs.get('server', None) + self.container_image = kwargs.get('container_image', None) + self.command = kwargs.get('command', None) + self.args = kwargs.get('args', None) + self.image_registry_credential = kwargs.get('image_registry_credential', None) + + +class CustomDomainProperties(msrest.serialization.Model): """Custom domain of app resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param thumbprint: The thumbprint of bound certificate. :type thumbprint: str @@ -747,7 +873,10 @@ class CustomDomainProperties(Model): 'cert_name': {'key': 'certName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = kwargs.get('thumbprint', None) self.app_name = None @@ -757,8 +886,7 @@ def __init__(self, **kwargs): class CustomDomainResource(ProxyResource): """Custom domain resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -767,8 +895,7 @@ class CustomDomainResource(ProxyResource): :ivar type: The type of the resource. :vartype type: str :param properties: Properties of the custom domain resource. - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainProperties + :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainProperties """ _validation = { @@ -784,17 +911,43 @@ class CustomDomainResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'CustomDomainProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CustomDomainResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class CustomDomainValidatePayload(Model): +class CustomDomainResourceCollection(msrest.serialization.Model): + """Collection compose of a custom domain resources list and a possible link for next page. + + :param value: The custom domain resources list. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] + :param next_link: The link to next page of custom domain list. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CustomDomainResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomDomainResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class CustomDomainValidatePayload(msrest.serialization.Model): """Custom domain validate payload. All required parameters must be populated in order to send to Azure. - :param name: Required. Name to be validated + :param name: Required. Name to be validated. :type name: str """ @@ -806,12 +959,15 @@ class CustomDomainValidatePayload(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CustomDomainValidatePayload, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + self.name = kwargs['name'] -class CustomDomainValidateResult(Model): +class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. :param is_valid: Indicates if domain name is valid. @@ -825,27 +981,29 @@ class CustomDomainValidateResult(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = kwargs.get('is_valid', None) self.message = kwargs.get('message', None) -class DeploymentInstance(Model): +class DeploymentInstance(msrest.serialization.Model): """Deployment instance payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Name of the deployment instance + :ivar name: Name of the deployment instance. :vartype name: str - :ivar status: Status of the deployment instance + :ivar status: Status of the deployment instance. :vartype status: str - :ivar reason: Failed reason of the deployment instance + :ivar reason: Failed reason of the deployment instance. :vartype reason: str - :ivar discovery_status: Discovery status of the deployment instance + :ivar discovery_status: Discovery status of the deployment instance. :vartype discovery_status: str - :ivar start_time: Start time of the deployment instance + :ivar start_time: Start time of the deployment instance. :vartype start_time: str """ @@ -865,7 +1023,10 @@ class DeploymentInstance(Model): 'start_time': {'key': 'startTime', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -877,8 +1038,7 @@ def __init__(self, **kwargs): class DeploymentResource(ProxyResource): """Deployment resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -886,10 +1046,10 @@ class DeploymentResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Deployment resource + :param properties: Properties of the Deployment resource. :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource + :param sku: Sku of the Deployment resource. :type sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku """ @@ -907,42 +1067,65 @@ class DeploymentResource(ProxyResource): 'sku': {'key': 'sku', 'type': 'Sku'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeploymentResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.sku = kwargs.get('sku', None) -class DeploymentResourceProperties(Model): +class DeploymentResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :param value: Collection of Deployment resources. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeploymentResourceCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class DeploymentResourceProperties(msrest.serialization.Model): """Deployment resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param source: Uploaded source information of the deployment. - :type source: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceInfo - :ivar app_name: App name of the deployment + :type source: ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceInfo + :ivar app_name: App name of the deployment. :vartype app_name: str - :param deployment_settings: Deployment settings of the Deployment + :param deployment_settings: Deployment settings of the Deployment. :type deployment_settings: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Possible - values include: 'Creating', 'Updating', 'Succeeded', 'Failed' + :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: + "Creating", "Updating", "Succeeded", "Failed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Possible values include: - 'Unknown', 'Stopped', 'Running', 'Failed', 'Allocating', 'Upgrading', - 'Compiling' + :ivar status: Status of the Deployment. Possible values include: "Unknown", "Stopped", + "Running", "Failed", "Allocating", "Upgrading", "Compiling". :vartype status: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceStatus - :ivar active: Indicates whether the Deployment is active + :ivar active: Indicates whether the Deployment is active. :vartype active: bool - :ivar created_time: Date time when the resource is created - :vartype created_time: datetime - :ivar instances: Collection of instances belong to the Deployment - :vartype instances: - list[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentInstance] + :ivar created_time: Date time when the resource is created. + :vartype created_time: ~datetime.datetime + :ivar instances: Collection of instances belong to the Deployment. + :vartype instances: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentInstance] """ _validation = { @@ -965,7 +1148,10 @@ class DeploymentResourceProperties(Model): 'instances': {'key': 'instances', 'type': '[DeploymentInstance]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = kwargs.get('source', None) self.app_name = None @@ -977,36 +1163,30 @@ def __init__(self, **kwargs): self.instances = None -class DeploymentSettings(Model): +class DeploymentSettings(msrest.serialization.Model): """Deployment settings payload. - :param cpu: Required CPU. This should be 1 for Basic tier, and in range - [1, 4] for Standard tier. This is deprecated starting from API version - 2021-06-01-preview. Please use the resourceRequests field to set the CPU - size. Default value: 1 . + :param cpu: Required CPU. This should be 1 for Basic tier, and in range [1, 4] for Standard + tier. This is deprecated starting from API version 2021-06-01-preview. Please use the + resourceRequests field to set the CPU size. :type cpu: int - :param memory_in_gb: Required Memory size in GB. This should be in range - [1, 2] for Basic tier, and in range [1, 8] for Standard tier. This is - deprecated starting from API version 2021-06-01-preview. Please use the - resourceRequests field to set the the memory size. Default value: 1 . + :param memory_in_gb: Required Memory size in GB. This should be in range [1, 2] for Basic tier, + and in range [1, 8] for Standard tier. This is deprecated starting from API version + 2021-06-01-preview. Please use the resourceRequests field to set the the memory size. :type memory_in_gb: int - :param resource_requests: The requested resource quantity for required CPU - and Memory. It is recommended that using this field to represent the - required CPU and Memory, the old field cpu and memoryInGB will be - deprecated later. - :type resource_requests: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceRequests - :param jvm_options: JVM parameter + :param resource_requests: The requested resource quantity for required CPU and Memory. It is + recommended that using this field to represent the required CPU and Memory, the old field cpu + and memoryInGB will be deprecated later. + :type resource_requests: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceRequests + :param jvm_options: JVM parameter. :type jvm_options: str - :param net_core_main_entry_path: The path to the .NET executable relative - to zip root + :param net_core_main_entry_path: The path to the .NET executable relative to zip root. :type net_core_main_entry_path: str - :param environment_variables: Collection of environment variables + :param environment_variables: Collection of environment variables. :type environment_variables: dict[str, str] - :param runtime_version: Runtime version. Possible values include: - 'Java_8', 'Java_11', 'NetCore_31' - :type runtime_version: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.RuntimeVersion + :param runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". + :type runtime_version: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.RuntimeVersion """ _attribute_map = { @@ -1019,7 +1199,10 @@ class DeploymentSettings(Model): 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeploymentSettings, self).__init__(**kwargs) self.cpu = kwargs.get('cpu', 1) self.memory_in_gb = kwargs.get('memory_in_gb', 1) @@ -1030,7 +1213,7 @@ def __init__(self, **kwargs): self.runtime_version = kwargs.get('runtime_version', None) -class Error(Model): +class Error(msrest.serialization.Model): """The error code compose of code and message. :param code: The code of error. @@ -1044,26 +1227,29 @@ class Error(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Error, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) -class GitPatternRepository(Model): +class GitPatternRepository(msrest.serialization.Model): """Git repository property payload. All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the repository + :param name: Required. Name of the repository. :type name: str - :param pattern: Collection of pattern of the repository + :param pattern: Collection of pattern of the repository. :type pattern: list[str] - :param uri: Required. URI of the repository + :param uri: Required. URI of the repository. :type uri: str - :param label: Label of the repository + :param label: Label of the repository. :type label: str - :param search_paths: Searching path of the repository + :param search_paths: Searching path of the repository. :type search_paths: list[str] :param username: Username of git repository basic auth. :type username: str @@ -1098,11 +1284,14 @@ class GitPatternRepository(Model): 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(GitPatternRepository, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + self.name = kwargs['name'] self.pattern = kwargs.get('pattern', None) - self.uri = kwargs.get('uri', None) + self.uri = kwargs['uri'] self.label = kwargs.get('label', None) self.search_paths = kwargs.get('search_paths', None) self.username = kwargs.get('username', None) @@ -1113,12 +1302,35 @@ def __init__(self, **kwargs): self.strict_host_key_checking = kwargs.get('strict_host_key_checking', None) -class LogFileUrlResponse(Model): +class ImageRegistryCredential(msrest.serialization.Model): + """Credential of the image registry. + + :param username: The username of the image registry credential. + :type username: str + :param password: The password of the image registry credential. + :type password: str + """ + + _attribute_map = { + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ImageRegistryCredential, self).__init__(**kwargs) + self.username = kwargs.get('username', None) + self.password = kwargs.get('password', None) + + +class LogFileUrlResponse(msrest.serialization.Model): """Log file URL payload. All required parameters must be populated in order to send to Azure. - :param url: Required. URL of the log file + :param url: Required. URL of the log file. :type url: str """ @@ -1130,19 +1342,22 @@ class LogFileUrlResponse(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LogFileUrlResponse, self).__init__(**kwargs) - self.url = kwargs.get('url', None) + self.url = kwargs['url'] -class LogSpecification(Model): +class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :param name: Name of the log + :param name: Name of the log. :type name: str - :param display_name: Localized friendly display name of the log + :param display_name: Localized friendly display name of the log. :type display_name: str - :param blob_duration: Blob duration of the log + :param blob_duration: Blob duration of the log. :type blob_duration: str """ @@ -1152,23 +1367,25 @@ class LogSpecification(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LogSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) self.blob_duration = kwargs.get('blob_duration', None) -class ManagedIdentityProperties(Model): +class ManagedIdentityProperties(msrest.serialization.Model): """Managed identity properties retrieved from ARM request headers. - :param type: Type of the managed identity. Possible values include: - 'None', 'SystemAssigned', 'UserAssigned', 'SystemAssigned,UserAssigned' - :type type: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityType - :param principal_id: Principal Id + :param type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :type type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityType + :param principal_id: Principal Id. :type principal_id: str - :param tenant_id: Tenant Id + :param tenant_id: Tenant Id. :type tenant_id: str """ @@ -1178,60 +1395,70 @@ class ManagedIdentityProperties(Model): 'tenant_id': {'key': 'tenantId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.principal_id = kwargs.get('principal_id', None) self.tenant_id = kwargs.get('tenant_id', None) -class MetricDimension(Model): +class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension + :param name: Name of the dimension. :type name: str - :param display_name: Localized friendly display name of the dimension + :param display_name: Localized friendly display name of the dimension. :type display_name: str + :param to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :type to_be_exported_for_shoebox: bool """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'display_name': {'key': 'displayName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MetricDimension, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) + self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) -class MetricSpecification(Model): +class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :param name: Name of the metric + :param name: Name of the metric. :type name: str - :param display_name: Localized friendly display name of the metric + :param display_name: Localized friendly display name of the metric. :type display_name: str - :param display_description: Localized friendly description of the metric + :param display_description: Localized friendly description of the metric. :type display_description: str - :param unit: Unit that makes sense for the metric + :param unit: Unit that makes sense for the metric. :type unit: str - :param category: Name of the metric category that the metric belongs to. A - metric can only belong to a single category. + :param category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. :type category: str - :param aggregation_type: Only provide one value for this field. Valid - values: Average, Minimum, Maximum, Total, Count. + :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + Maximum, Total, Count. :type aggregation_type: str - :param supported_aggregation_types: Supported aggregation types + :param supported_aggregation_types: Supported aggregation types. :type supported_aggregation_types: list[str] - :param supported_time_grain_types: Supported time grain types + :param supported_time_grain_types: Supported time grain types. :type supported_time_grain_types: list[str] - :param fill_gap_with_zero: Optional. If set to true, then zero will be - returned for time duration where no metric is emitted/published. + :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. :type fill_gap_with_zero: bool - :param dimensions: Dimensions of the metric - :type dimensions: - list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricDimension] + :param dimensions: Dimensions of the metric. + :type dimensions: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricDimension] """ _attribute_map = { @@ -1247,7 +1474,10 @@ class MetricSpecification(Model): 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MetricSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1261,32 +1491,28 @@ def __init__(self, **kwargs): self.dimensions = kwargs.get('dimensions', None) -class MonitoringSettingProperties(Model): +class MonitoringSettingProperties(msrest.serialization.Model): """Monitoring Setting properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: State of the Monitoring Setting. Possible values - include: 'NotAvailable', 'Failed', 'Succeeded', 'Updating' + :ivar provisioning_state: State of the Monitoring Setting. Possible values include: + "NotAvailable", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingState :param error: Error when apply Monitoring Setting changes. :type error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error - :param trace_enabled: Indicates whether enable the trace functionality, - which will be deprecated since api version 2020-11-01-preview. Please - leverage appInsightsInstrumentationKey to indicate if monitoringSettings - enabled or not + :param trace_enabled: Indicates whether enable the trace functionality, which will be + deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey + to indicate if monitoringSettings enabled or not. :type trace_enabled: bool - :param app_insights_instrumentation_key: Target application insight - instrumentation key, null or whitespace include empty will disable - monitoringSettings + :param app_insights_instrumentation_key: Target application insight instrumentation key, null + or whitespace include empty will disable monitoringSettings. :type app_insights_instrumentation_key: str - :param app_insights_sampling_rate: Indicates the sampling rate of - application insight agent, should be in range [0.0, 100.0] + :param app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + should be in range [0.0, 100.0]. :type app_insights_sampling_rate: float - :param app_insights_agent_versions: Indicates the versions of application - insight agent + :param app_insights_agent_versions: Indicates the versions of application insight agent. :type app_insights_agent_versions: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ApplicationInsightsAgentVersions """ @@ -1305,7 +1531,10 @@ class MonitoringSettingProperties(Model): 'app_insights_agent_versions': {'key': 'appInsightsAgentVersions', 'type': 'ApplicationInsightsAgentVersions'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MonitoringSettingProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = kwargs.get('error', None) @@ -1318,8 +1547,7 @@ def __init__(self, **kwargs): class MonitoringSettingResource(ProxyResource): """Monitoring Setting resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -1327,7 +1555,7 @@ class MonitoringSettingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Monitoring Setting resource + :param properties: Properties of the Monitoring Setting resource. :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingProperties """ @@ -1345,19 +1573,22 @@ class MonitoringSettingResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'MonitoringSettingProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(MonitoringSettingResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class NameAvailability(Model): +class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :param name_available: Indicates whether the name is available + :param name_available: Indicates whether the name is available. :type name_available: bool - :param reason: Reason why the name is not available + :param reason: Reason why the name is not available. :type reason: str - :param message: Message why the name is not available + :param message: Message why the name is not available. :type message: str """ @@ -1367,21 +1598,24 @@ class NameAvailability(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NameAvailability, self).__init__(**kwargs) self.name_available = kwargs.get('name_available', None) self.reason = kwargs.get('reason', None) self.message = kwargs.get('message', None) -class NameAvailabilityParameters(Model): +class NameAvailabilityParameters(msrest.serialization.Model): """Name availability parameters payload. All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the resource to check name availability + :param type: Required. Type of the resource to check name availability. :type type: str - :param name: Required. Name to be checked + :param name: Required. Name to be checked. :type name: str """ @@ -1395,44 +1629,44 @@ class NameAvailabilityParameters(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NameAvailabilityParameters, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.name = kwargs.get('name', None) + self.type = kwargs['type'] + self.name = kwargs['name'] -class NetworkProfile(Model): +class NetworkProfile(msrest.serialization.Model): """Service network profile payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param service_runtime_subnet_id: Fully qualified resource Id of the - subnet to host Azure Spring Cloud Service Runtime + :param service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. :type service_runtime_subnet_id: str - :param app_subnet_id: Fully qualified resource Id of the subnet to host - Azure Spring Cloud Apps + :param app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. :type app_subnet_id: str - :param service_cidr: Azure Spring Cloud service reserved CIDR + :param service_cidr: Azure Spring Cloud service reserved CIDR. :type service_cidr: str - :param service_runtime_network_resource_group: Name of the resource group - containing network resources of Azure Spring Cloud Service Runtime + :param service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. :type service_runtime_network_resource_group: str - :param app_network_resource_group: Name of the resource group containing - network resources of Azure Spring Cloud Apps + :param app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. :type app_network_resource_group: str - :ivar outbound_ips: Desired outbound IP resources for Azure Spring Cloud - instance. - :vartype outbound_ips: + :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Cloud instance. + :vartype outbound_i_ps: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure - Spring Cloud instance. + :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Cloud instance. :vartype required_traffics: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.RequiredTraffic] """ _validation = { - 'outbound_ips': {'readonly': True}, + 'outbound_i_ps': {'readonly': True}, 'required_traffics': {'readonly': True}, } @@ -1442,59 +1676,62 @@ class NetworkProfile(Model): 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, 'service_runtime_network_resource_group': {'key': 'serviceRuntimeNetworkResourceGroup', 'type': 'str'}, 'app_network_resource_group': {'key': 'appNetworkResourceGroup', 'type': 'str'}, - 'outbound_ips': {'key': 'outboundIPs', 'type': 'NetworkProfileOutboundIPs'}, + 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'NetworkProfileOutboundIPs'}, 'required_traffics': {'key': 'requiredTraffics', 'type': '[RequiredTraffic]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NetworkProfile, self).__init__(**kwargs) self.service_runtime_subnet_id = kwargs.get('service_runtime_subnet_id', None) self.app_subnet_id = kwargs.get('app_subnet_id', None) self.service_cidr = kwargs.get('service_cidr', None) self.service_runtime_network_resource_group = kwargs.get('service_runtime_network_resource_group', None) self.app_network_resource_group = kwargs.get('app_network_resource_group', None) - self.outbound_ips = None + self.outbound_i_ps = None self.required_traffics = None -class NetworkProfileOutboundIPs(Model): +class NetworkProfileOutboundIPs(msrest.serialization.Model): """Desired outbound IP resources for Azure Spring Cloud instance. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar public_ips: A list of public IP addresses. - :vartype public_ips: list[str] + :ivar public_i_ps: A list of public IP addresses. + :vartype public_i_ps: list[str] """ _validation = { - 'public_ips': {'readonly': True}, + 'public_i_ps': {'readonly': True}, } _attribute_map = { - 'public_ips': {'key': 'publicIPs', 'type': '[str]'}, + 'public_i_ps': {'key': 'publicIPs', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NetworkProfileOutboundIPs, self).__init__(**kwargs) - self.public_ips = None + self.public_i_ps = None -class OperationDetail(Model): +class OperationDetail(msrest.serialization.Model): """Operation detail payload. - :param name: Name of the operation + :param name: Name of the operation. :type name: str - :param is_data_action: Indicates whether the operation is a data action + :param is_data_action: Indicates whether the operation is a data action. :type is_data_action: bool - :param display: Display of the operation - :type display: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDisplay - :param origin: Origin of the operation + :param display: Display of the operation. + :type display: ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDisplay + :param origin: Origin of the operation. :type origin: str - :param properties: Properties of the operation - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationProperties + :param properties: Properties of the operation. + :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationProperties """ _attribute_map = { @@ -1505,7 +1742,10 @@ class OperationDetail(Model): 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OperationDetail, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.is_data_action = kwargs.get('is_data_action', None) @@ -1514,16 +1754,16 @@ def __init__(self, **kwargs): self.properties = kwargs.get('properties', None) -class OperationDisplay(Model): +class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :param provider: Resource provider of the operation + :param provider: Resource provider of the operation. :type provider: str - :param resource: Resource of the operation + :param resource: Resource of the operation. :type resource: str - :param operation: Localized friendly name for the operation + :param operation: Localized friendly name for the operation. :type operation: str - :param description: Localized friendly description for the operation + :param description: Localized friendly description for the operation. :type description: str """ @@ -1534,7 +1774,10 @@ class OperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OperationDisplay, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -1542,10 +1785,10 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) -class OperationProperties(Model): +class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :param service_specification: Service specifications of the operation + :param service_specification: Service specifications of the operation. :type service_specification: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceSpecification """ @@ -1554,22 +1797,24 @@ class OperationProperties(Model): 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OperationProperties, self).__init__(**kwargs) self.service_specification = kwargs.get('service_specification', None) -class PersistentDisk(Model): +class PersistentDisk(msrest.serialization.Model): """Persistent disk payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param size_in_gb: Size of the persistent disk in GB + :param size_in_gb: Size of the persistent disk in GB. :type size_in_gb: int - :ivar used_in_gb: Size of the used persistent disk in GB + :ivar used_in_gb: Size of the used persistent disk in GB. :vartype used_in_gb: int - :param mount_path: Mount path of the persistent disk + :param mount_path: Mount path of the persistent disk. :type mount_path: str """ @@ -1584,22 +1829,24 @@ class PersistentDisk(Model): 'mount_path': {'key': 'mountPath', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = kwargs.get('size_in_gb', None) self.used_in_gb = None self.mount_path = kwargs.get('mount_path', None) -class RegenerateTestKeyRequestPayload(Model): +class RegenerateTestKeyRequestPayload(msrest.serialization.Model): """Regenerate test key request payload. All required parameters must be populated in order to send to Azure. - :param key_type: Required. Type of the test key. Possible values include: - 'Primary', 'Secondary' - :type key_type: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeyType + :param key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :type key_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeyType """ _validation = { @@ -1610,29 +1857,30 @@ class RegenerateTestKeyRequestPayload(Model): 'key_type': {'key': 'keyType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) - self.key_type = kwargs.get('key_type', None) + self.key_type = kwargs['key_type'] -class RequiredTraffic(Model): +class RequiredTraffic(msrest.serialization.Model): """Required inbound or outbound traffic for Azure Spring Cloud instance. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar protocol: The protocol of required traffic + :ivar protocol: The protocol of required traffic. :vartype protocol: str - :ivar port: The port of required traffic + :ivar port: The port of required traffic. :vartype port: int - :ivar ips: The ip list of required traffic + :ivar ips: The ip list of required traffic. :vartype ips: list[str] - :ivar fqdns: The FQDN list of required traffic + :ivar fqdns: The FQDN list of required traffic. :vartype fqdns: list[str] - :ivar direction: The direction of required traffic. Possible values - include: 'Inbound', 'Outbound' - :vartype direction: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.TrafficDirection + :ivar direction: The direction of required traffic. Possible values include: "Inbound", + "Outbound". + :vartype direction: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.TrafficDirection """ _validation = { @@ -1651,7 +1899,10 @@ class RequiredTraffic(Model): 'direction': {'key': 'direction', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -1660,16 +1911,14 @@ def __init__(self, **kwargs): self.direction = None -class ResourceRequests(Model): +class ResourceRequests(msrest.serialization.Model): """Deployment resource request payload. - :param cpu: Required CPU. 1 core can be represented by 1 or 1000m. This - should be 500m or 1 for Basic tier, and {500m, 1, 2, 3, 4} for Standard - tier. + :param cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for + Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. :type cpu: str - :param memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. - This should be {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, - ..., 8Gi} for Standard tier. + :param memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be + {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. :type memory: str """ @@ -1678,13 +1927,16 @@ class ResourceRequests(Model): 'memory': {'key': 'memory', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceRequests, self).__init__(**kwargs) self.cpu = kwargs.get('cpu', None) self.memory = kwargs.get('memory', None) -class ResourceSku(Model): +class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. :param resource_type: Gets the type of resource the SKU applies to. @@ -1694,16 +1946,14 @@ class ResourceSku(Model): :param tier: Gets the tier of SKU. :type tier: str :param capacity: Gets the capacity of SKU. - :type capacity: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuCapacity + :type capacity: ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuCapacity :param locations: Gets the set of locations that the SKU is available. :type locations: list[str] - :param location_info: Gets a list of locations and availability zones in - those locations where the SKU is available. + :param location_info: Gets a list of locations and availability zones in those locations where + the SKU is available. :type location_info: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuLocationInfo] - :param restrictions: Gets the restrictions because of which SKU cannot be - used. This is + :param restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. :type restrictions: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictions] @@ -1719,7 +1969,10 @@ class ResourceSku(Model): 'restrictions': {'key': 'restrictions', 'type': '[ResourceSkuRestrictions]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSku, self).__init__(**kwargs) self.resource_type = kwargs.get('resource_type', None) self.name = kwargs.get('name', None) @@ -1730,7 +1983,7 @@ def __init__(self, **kwargs): self.restrictions = kwargs.get('restrictions', None) -class ResourceSkuCapabilities(Model): +class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. :param name: Gets an invariant to describe the feature. @@ -1744,21 +1997,47 @@ class ResourceSkuCapabilities(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.value = kwargs.get('value', None) -class ResourceSkuLocationInfo(Model): +class ResourceSkuCollection(msrest.serialization.Model): + """Object that includes an array of Azure Spring Cloud SKU and a possible link for next set. + + :param value: Collection of resource SKU. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSku] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceSku]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceSkuCollection, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ResourceSkuLocationInfo(msrest.serialization.Model): """Locations and availability zones where the SKU is available. - :param location: Gets location of the SKU + :param location: Gets location of the SKU. :type location: str :param zones: Gets list of availability zones where the SKU is supported. :type zones: list[str] - :param zone_details: Gets details of capabilities available to a SKU in - specific zones. + :param zone_details: Gets details of capabilities available to a SKU in specific zones. :type zone_details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuZoneDetails] """ @@ -1769,17 +2048,20 @@ class ResourceSkuLocationInfo(Model): 'zone_details': {'key': 'zoneDetails', 'type': '[ResourceSkuZoneDetails]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.zones = kwargs.get('zones', None) self.zone_details = kwargs.get('zone_details', None) -class ResourceSkuRestrictionInfo(Model): +class ResourceSkuRestrictionInfo(msrest.serialization.Model): """Information about the restriction where the SKU cannot be used. - :param locations: Gets locations where the SKU is restricted + :param locations: Gets locations where the SKU is restricted. :type locations: list[str] :param zones: Gets list of availability zones where the SKU is restricted. :type zones: list[str] @@ -1790,29 +2072,32 @@ class ResourceSkuRestrictionInfo(Model): 'zones': {'key': 'zones', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = kwargs.get('locations', None) self.zones = kwargs.get('zones', None) -class ResourceSkuRestrictions(Model): +class ResourceSkuRestrictions(msrest.serialization.Model): """Restrictions where the SKU cannot be used. - :param type: Gets the type of restrictions. Possible values include: - 'Location', 'Zone' + :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". :type type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionsType - :param values: Gets the value of restrictions. If the restriction type is - set to + :param values: Gets the value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. :type values: list[str] - :param restriction_info: Gets the information about the restriction where - the SKU cannot be used. + :param restriction_info: Gets the information about the restriction where the SKU cannot be + used. :type restriction_info: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionInfo - :param reason_code: Gets the reason for restriction. Possible values - include: 'QuotaId', 'NotAvailableForSubscription' + :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". :type reason_code: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionsReasonCode """ @@ -1824,7 +2109,10 @@ class ResourceSkuRestrictions(Model): 'reason_code': {'key': 'reasonCode', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.values = kwargs.get('values', None) @@ -1832,14 +2120,13 @@ def __init__(self, **kwargs): self.reason_code = kwargs.get('reason_code', None) -class ResourceSkuZoneDetails(Model): +class ResourceSkuZoneDetails(msrest.serialization.Model): """Details of capabilities available to a SKU in specific zones. :param name: Gets the set of zones that the SKU is available in with the specified capabilities. :type name: list[str] - :param capabilities: Gets a list of capabilities that are available for - the SKU in the + :param capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. :type capabilities: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuCapabilities] @@ -1850,18 +2137,21 @@ class ResourceSkuZoneDetails(Model): 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.capabilities = kwargs.get('capabilities', None) -class ResourceUploadDefinition(Model): +class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :param relative_path: Source relative path + :param relative_path: Source relative path. :type relative_path: str - :param upload_url: Upload URL + :param upload_url: Upload URL. :type upload_url: str """ @@ -1870,7 +2160,10 @@ class ResourceUploadDefinition(Model): 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = kwargs.get('relative_path', None) self.upload_url = kwargs.get('upload_url', None) @@ -1879,8 +2172,7 @@ def __init__(self, **kwargs): class TrackedResource(Resource): """The resource model definition for a ARM tracked top level resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -1890,7 +2182,7 @@ class TrackedResource(Resource): :vartype type: str :param location: The GEO location of the resource. :type location: str - :param tags: Tags of the service which is a list of key value pairs that + :param tags: A set of tags. Tags of the service which is a list of key value pairs that describe the resource. :type tags: dict[str, str] """ @@ -1909,7 +2201,10 @@ class TrackedResource(Resource): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TrackedResource, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.tags = kwargs.get('tags', None) @@ -1918,8 +2213,7 @@ def __init__(self, **kwargs): class ServiceResource(TrackedResource): """Service resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -1929,13 +2223,12 @@ class ServiceResource(TrackedResource): :vartype type: str :param location: The GEO location of the resource. :type location: str - :param tags: Tags of the service which is a list of key value pairs that + :param tags: A set of tags. Tags of the service which is a list of key value pairs that describe the resource. :type tags: dict[str, str] - :param properties: Properties of the Service resource - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ClusterResourceProperties - :param sku: Sku of the Service resource + :param properties: Properties of the Service resource. + :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ClusterResourceProperties + :param sku: Sku of the Service resource. :type sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku """ @@ -1955,20 +2248,46 @@ class ServiceResource(TrackedResource): 'sku': {'key': 'sku', 'type': 'Sku'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServiceResource, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) self.sku = kwargs.get('sku', None) -class ServiceSpecification(Model): +class ServiceResourceList(msrest.serialization.Model): + """Object that includes an array of Service resources and a possible link for next set. + + :param value: Collection of Service resources. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ServiceResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ServiceResourceList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :param log_specifications: Specifications of the Log for Azure Monitoring + :param log_specifications: Specifications of the Log for Azure Monitoring. :type log_specifications: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.LogSpecification] - :param metric_specifications: Specifications of the Metrics for Azure - Monitoring + :param metric_specifications: Specifications of the Metrics for Azure Monitoring. :type metric_specifications: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricSpecification] """ @@ -1978,20 +2297,23 @@ class ServiceSpecification(Model): 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = kwargs.get('log_specifications', None) self.metric_specifications = kwargs.get('metric_specifications', None) -class Sku(Model): +class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :param name: Name of the Sku. Default value: "S0" . + :param name: Name of the Sku. :type name: str - :param tier: Tier of the Sku. Default value: "Standard" . + :param tier: Tier of the Sku. :type tier: str - :param capacity: Current capacity of the target resource + :param capacity: Current capacity of the target resource. :type capacity: int """ @@ -2001,14 +2323,17 @@ class Sku(Model): 'capacity': {'key': 'capacity', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Sku, self).__init__(**kwargs) self.name = kwargs.get('name', "S0") self.tier = kwargs.get('tier', "Standard") self.capacity = kwargs.get('capacity', None) -class SkuCapacity(Model): +class SkuCapacity(msrest.serialization.Model): """The SKU capacity. All required parameters must be populated in order to send to Azure. @@ -2019,10 +2344,9 @@ class SkuCapacity(Model): :type maximum: int :param default: Gets or sets the default. :type default: int - :param scale_type: Gets or sets the type of the scale. Possible values - include: 'None', 'Manual', 'Automatic' - :type scale_type: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuScaleType + :param scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :type scale_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuScaleType """ _validation = { @@ -2036,23 +2360,25 @@ class SkuCapacity(Model): 'scale_type': {'key': 'scaleType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SkuCapacity, self).__init__(**kwargs) - self.minimum = kwargs.get('minimum', None) + self.minimum = kwargs['minimum'] self.maximum = kwargs.get('maximum', None) self.default = kwargs.get('default', None) self.scale_type = kwargs.get('scale_type', None) -class SupportedRuntimeVersion(Model): +class SupportedRuntimeVersion(msrest.serialization.Model): """Supported deployment runtime version descriptor. - :param value: The raw value which could be passed to deployment CRUD - operations. Possible values include: 'Java_8', 'Java_11', 'NetCore_31' - :type value: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimeValue - :param platform: The platform of this runtime version (possible values: - "Java" or ".NET"). Possible values include: 'Java', '.NET Core' + :param value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :type value: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimeValue + :param platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". :type platform: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimePlatform :param version: The detailed version (major.minor) of the platform. @@ -2065,19 +2391,22 @@ class SupportedRuntimeVersion(Model): 'version': {'key': 'version', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.platform = kwargs.get('platform', None) self.version = kwargs.get('version', None) -class TemporaryDisk(Model): +class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :param size_in_gb: Size of the temporary disk in GB + :param size_in_gb: Size of the temporary disk in GB. :type size_in_gb: int - :param mount_path: Mount path of the temporary disk + :param mount_path: Mount path of the temporary disk. :type mount_path: str """ @@ -2090,24 +2419,27 @@ class TemporaryDisk(Model): 'mount_path': {'key': 'mountPath', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = kwargs.get('size_in_gb', None) self.mount_path = kwargs.get('mount_path', None) -class TestKeys(Model): +class TestKeys(msrest.serialization.Model): """Test keys payload. - :param primary_key: Primary key + :param primary_key: Primary key. :type primary_key: str - :param secondary_key: Secondary key + :param secondary_key: Secondary key. :type secondary_key: str - :param primary_test_endpoint: Primary test endpoint + :param primary_test_endpoint: Primary test endpoint. :type primary_test_endpoint: str - :param secondary_test_endpoint: Secondary test endpoint + :param secondary_test_endpoint: Secondary test endpoint. :type secondary_test_endpoint: str - :param enabled: Indicates whether the test endpoint feature enabled or not + :param enabled: Indicates whether the test endpoint feature enabled or not. :type enabled: bool """ @@ -2119,7 +2451,10 @@ class TestKeys(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TestKeys, self).__init__(**kwargs) self.primary_key = kwargs.get('primary_key', None) self.secondary_key = kwargs.get('secondary_key', None) @@ -2128,21 +2463,22 @@ def __init__(self, **kwargs): self.enabled = kwargs.get('enabled', None) -class UserSourceInfo(Model): +class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :param type: Type of the source uploaded. Possible values include: 'Jar', - 'NetCoreZip', 'Source' - :type type: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceType - :param relative_path: Relative path of the storage which stores the source + :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source", "Container". + :type type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceType + :param relative_path: Relative path of the storage which stores the source. :type relative_path: str - :param version: Version of the source + :param version: Version of the source. :type version: str - :param artifact_selector: Selector for the artifact to be used for the - deployment for multi-module projects. This should be + :param artifact_selector: Selector for the artifact to be used for the deployment for + multi-module projects. This should be the relative path to the target module/project. :type artifact_selector: str + :param custom_container: Custom container payload. + :type custom_container: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomContainer """ _attribute_map = { @@ -2150,11 +2486,16 @@ class UserSourceInfo(Model): 'relative_path': {'key': 'relativePath', 'type': 'str'}, 'version': {'key': 'version', 'type': 'str'}, 'artifact_selector': {'key': 'artifactSelector', 'type': 'str'}, + 'custom_container': {'key': 'customContainer', 'type': 'CustomContainer'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(UserSourceInfo, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.relative_path = kwargs.get('relative_path', None) self.version = kwargs.get('version', None) self.artifact_selector = kwargs.get('artifact_selector', None) + self.custom_container = kwargs.get('custom_container', None) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/models/_models_py3.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/models/_models_py3.py index 5efc5bf4c4b..f2bb0bee5df 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/models/_models_py3.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/models/_models_py3.py @@ -1,25 +1,24 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +from typing import Any, Dict, List, Optional, Union +import msrest.serialization -class ApplicationInsightsAgentVersions(Model): +from ._app_platform_management_client_enums import * + + +class ApplicationInsightsAgentVersions(msrest.serialization.Model): """Application Insights agent versions properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar java: Indicates the version of application insight java agent + :ivar java: Indicates the version of application insight java agent. :vartype java: str """ @@ -31,16 +30,18 @@ class ApplicationInsightsAgentVersions(Model): 'java': {'key': 'java', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ApplicationInsightsAgentVersions, self).__init__(**kwargs) self.java = None -class Resource(Model): +class Resource(msrest.serialization.Model): """The core properties of ARM resources. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -62,7 +63,10 @@ class Resource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -70,11 +74,9 @@ def __init__(self, **kwargs) -> None: class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have - everything other than required location and tags. + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -96,15 +98,17 @@ class ProxyResource(Resource): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ProxyResource, self).__init__(**kwargs) class AppResource(ProxyResource): """App resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -112,14 +116,11 @@ class AppResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the App resource - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceProperties - :param identity: The Managed Identity type of the app resource - :type identity: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityProperties - :param location: The GEO location of the application, always the same with - its parent resource + :param properties: Properties of the App resource. + :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceProperties + :param identity: The Managed Identity type of the app resource. + :type identity: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityProperties + :param location: The GEO location of the application, always the same with its parent resource. :type location: str """ @@ -138,41 +139,72 @@ class AppResource(ProxyResource): 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, *, properties=None, identity=None, location: str=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["AppResourceProperties"] = None, + identity: Optional["ManagedIdentityProperties"] = None, + location: Optional[str] = None, + **kwargs + ): super(AppResource, self).__init__(**kwargs) self.properties = properties self.identity = identity self.location = location -class AppResourceProperties(Model): +class AppResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :param value: Collection of App resources. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["AppResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(AppResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AppResourceProperties(msrest.serialization.Model): """App resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param public: Indicates whether the App exposes public endpoint + :param public: Indicates whether the App exposes public endpoint. :type public: bool - :ivar url: URL of the App + :ivar url: URL of the App. :vartype url: str - :ivar provisioning_state: Provisioning state of the App. Possible values - include: 'Succeeded', 'Failed', 'Creating', 'Updating' + :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", + "Failed", "Creating", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceProvisioningState - :param active_deployment_name: Name of the active deployment of the App + :param active_deployment_name: Name of the active deployment of the App. :type active_deployment_name: str :param fqdn: Fully qualified dns Name. :type fqdn: str :param https_only: Indicate if only https is allowed. :type https_only: bool - :ivar created_time: Date time when the resource is created - :vartype created_time: datetime - :param temporary_disk: Temporary disk settings - :type temporary_disk: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.TemporaryDisk - :param persistent_disk: Persistent disk settings - :type persistent_disk: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.PersistentDisk + :ivar created_time: Date time when the resource is created. + :vartype created_time: ~datetime.datetime + :param temporary_disk: Temporary disk settings. + :type temporary_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TemporaryDisk + :param persistent_disk: Persistent disk settings. + :type persistent_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.PersistentDisk :param enable_end_to_end_tls: Indicate if end to end TLS is enabled. :type enable_end_to_end_tls: bool """ @@ -196,7 +228,18 @@ class AppResourceProperties(Model): 'enable_end_to_end_tls': {'key': 'enableEndToEndTLS', 'type': 'bool'}, } - def __init__(self, *, public: bool=None, active_deployment_name: str=None, fqdn: str=None, https_only: bool=None, temporary_disk=None, persistent_disk=None, enable_end_to_end_tls: bool=None, **kwargs) -> None: + def __init__( + self, + *, + public: Optional[bool] = None, + active_deployment_name: Optional[str] = None, + fqdn: Optional[str] = None, + https_only: Optional[bool] = None, + temporary_disk: Optional["TemporaryDisk"] = None, + persistent_disk: Optional["PersistentDisk"] = None, + enable_end_to_end_tls: Optional[bool] = None, + **kwargs + ): super(AppResourceProperties, self).__init__(**kwargs) self.public = public self.url = None @@ -210,11 +253,37 @@ def __init__(self, *, public: bool=None, active_deployment_name: str=None, fqdn: self.enable_end_to_end_tls = enable_end_to_end_tls -class AvailableRuntimeVersions(Model): +class AvailableOperations(msrest.serialization.Model): + """Available operations of the service. + + :param value: Collection of available operation details. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDetail] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationDetail]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["OperationDetail"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(AvailableOperations, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AvailableRuntimeVersions(msrest.serialization.Model): """AvailableRuntimeVersions. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar value: A list of all supported runtime versions. :vartype value: @@ -229,7 +298,10 @@ class AvailableRuntimeVersions(Model): 'value': {'key': 'value', 'type': '[SupportedRuntimeVersion]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -237,8 +309,7 @@ def __init__(self, **kwargs) -> None: class BindingResource(ProxyResource): """Binding resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -246,9 +317,8 @@ class BindingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Binding resource - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceProperties + :param properties: Properties of the Binding resource. + :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceProperties """ _validation = { @@ -264,34 +334,64 @@ class BindingResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'BindingResourceProperties'}, } - def __init__(self, *, properties=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["BindingResourceProperties"] = None, + **kwargs + ): super(BindingResource, self).__init__(**kwargs) self.properties = properties -class BindingResourceProperties(Model): +class BindingResourceCollection(msrest.serialization.Model): + """Object that includes an array of Binding resources and a possible link for next set. + + :param value: Collection of Binding resources. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BindingResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["BindingResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(BindingResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BindingResourceProperties(msrest.serialization.Model): """Binding resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar resource_name: The name of the bound resource + :ivar resource_name: The name of the bound resource. :vartype resource_name: str - :ivar resource_type: The standard Azure resource type of the bound - resource + :ivar resource_type: The standard Azure resource type of the bound resource. :vartype resource_type: str - :param resource_id: The Azure resource id of the bound resource + :param resource_id: The Azure resource id of the bound resource. :type resource_id: str - :param key: The key of the bound resource + :param key: The key of the bound resource. :type key: str - :param binding_parameters: Binding parameters of the Binding resource - :type binding_parameters: dict[str, object] - :ivar generated_properties: The generated Spring Boot property file for - this binding. The secret will be deducted. + :param binding_parameters: Binding parameters of the Binding resource. + :type binding_parameters: dict[str, any] + :ivar generated_properties: The generated Spring Boot property file for this binding. The + secret will be deducted. :vartype generated_properties: str - :ivar created_at: Creation time of the Binding resource + :ivar created_at: Creation time of the Binding resource. :vartype created_at: str - :ivar updated_at: Update time of the Binding resource + :ivar updated_at: Update time of the Binding resource. :vartype updated_at: str """ @@ -314,7 +414,14 @@ class BindingResourceProperties(Model): 'updated_at': {'key': 'updatedAt', 'type': 'str'}, } - def __init__(self, *, resource_id: str=None, key: str=None, binding_parameters=None, **kwargs) -> None: + def __init__( + self, + *, + resource_id: Optional[str] = None, + key: Optional[str] = None, + binding_parameters: Optional[Dict[str, Any]] = None, + **kwargs + ): super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -326,11 +433,10 @@ def __init__(self, *, resource_id: str=None, key: str=None, binding_parameters=N self.updated_at = None -class CertificateProperties(Model): +class CertificateProperties(msrest.serialization.Model): """Certificate resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -381,7 +487,14 @@ class CertificateProperties(Model): 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, } - def __init__(self, *, vault_uri: str, key_vault_cert_name: str, cert_version: str=None, **kwargs) -> None: + def __init__( + self, + *, + vault_uri: str, + key_vault_cert_name: str, + cert_version: Optional[str] = None, + **kwargs + ): super(CertificateProperties, self).__init__(**kwargs) self.thumbprint = None self.vault_uri = vault_uri @@ -398,8 +511,7 @@ def __init__(self, *, vault_uri: str, key_vault_cert_name: str, cert_version: st class CertificateResource(ProxyResource): """Certificate resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -408,8 +520,7 @@ class CertificateResource(ProxyResource): :ivar type: The type of the resource. :vartype type: str :param properties: Properties of the certificate resource payload. - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateProperties + :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateProperties """ _validation = { @@ -425,55 +536,56 @@ class CertificateResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, } - def __init__(self, *, properties=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["CertificateProperties"] = None, + **kwargs + ): super(CertificateResource, self).__init__(**kwargs) self.properties = properties -class CloudError(Model): - """An error response from the service. +class CertificateResourceCollection(msrest.serialization.Model): + """Collection compose of certificate resources list and a possible link for next page. - :param error: An error response from the service. - :type error: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CloudErrorBody + :param value: The certificate resources list. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] + :param next_link: The link to next page of certificate list. + :type next_link: str """ _attribute_map = { - 'error': {'key': 'error', 'type': 'CloudErrorBody'}, - } - - def __init__(self, *, error=None, **kwargs) -> None: - super(CloudError, self).__init__(**kwargs) - self.error = error - - -class CloudErrorException(HttpOperationError): - """Server responsed with exception of type: 'CloudError'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + 'value': {'key': 'value', 'type': '[CertificateResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["CertificateResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(CertificateResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link -class CloudErrorBody(Model): +class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are - intended to be consumed programmatically. + :param code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. :type code: str - :param message: A message describing the error, intended to be suitable - for display in a user interface. + :param message: A message describing the error, intended to be suitable for display in a user + interface. :type message: str - :param target: The target of the particular error. For example, the name - of the property in error. + :param target: The target of the particular error. For example, the name of the property in + error. :type target: str :param details: A list of additional details about the error. - :type details: - list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CloudErrorBody] + :type details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -483,7 +595,15 @@ class CloudErrorBody(Model): 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, } - def __init__(self, *, code: str=None, message: str=None, target: str=None, details=None, **kwargs) -> None: + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["CloudErrorBody"]] = None, + **kwargs + ): super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -491,24 +611,21 @@ def __init__(self, *, code: str=None, message: str=None, target: str=None, detai self.details = details -class ClusterResourceProperties(Model): +class ClusterResourceProperties(msrest.serialization.Model): """Service properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Provisioning state of the Service. Possible - values include: 'Creating', 'Updating', 'Deleting', 'Deleted', - 'Succeeded', 'Failed', 'Moving', 'Moved', 'MoveFailed' + :ivar provisioning_state: Provisioning state of the Service. Possible values include: + "Creating", "Updating", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", "Moved", + "MoveFailed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ProvisioningState - :param network_profile: Network profile of the Service - :type network_profile: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.NetworkProfile - :ivar version: Version of the Service + :param network_profile: Network profile of the Service. + :type network_profile: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NetworkProfile + :ivar version: Version of the Service. :vartype version: int - :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a - created resource + :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. :vartype service_id: str """ @@ -525,7 +642,12 @@ class ClusterResourceProperties(Model): 'service_id': {'key': 'serviceId', 'type': 'str'}, } - def __init__(self, *, network_profile=None, **kwargs) -> None: + def __init__( + self, + *, + network_profile: Optional["NetworkProfile"] = None, + **kwargs + ): super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.network_profile = network_profile @@ -533,7 +655,7 @@ def __init__(self, *, network_profile=None, **kwargs) -> None: self.service_id = None -class ConfigServerGitProperty(Model): +class ConfigServerGitProperty(msrest.serialization.Model): """Property of git. All required parameters must be populated in order to send to Azure. @@ -541,11 +663,11 @@ class ConfigServerGitProperty(Model): :param repositories: Repositories of git. :type repositories: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.GitPatternRepository] - :param uri: Required. URI of the repository + :param uri: Required. URI of the repository. :type uri: str - :param label: Label of the repository + :param label: Label of the repository. :type label: str - :param search_paths: Searching path of the repository + :param search_paths: Searching path of the repository. :type search_paths: list[str] :param username: Username of git repository basic auth. :type username: str @@ -578,7 +700,21 @@ class ConfigServerGitProperty(Model): 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, } - def __init__(self, *, uri: str, repositories=None, label: str=None, search_paths=None, username: str=None, password: str=None, host_key: str=None, host_key_algorithm: str=None, private_key: str=None, strict_host_key_checking: bool=None, **kwargs) -> None: + def __init__( + self, + *, + uri: str, + repositories: Optional[List["GitPatternRepository"]] = None, + label: Optional[str] = None, + search_paths: Optional[List[str]] = None, + username: Optional[str] = None, + password: Optional[str] = None, + host_key: Optional[str] = None, + host_key_algorithm: Optional[str] = None, + private_key: Optional[str] = None, + strict_host_key_checking: Optional[bool] = None, + **kwargs + ): super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = repositories self.uri = uri @@ -592,21 +728,19 @@ def __init__(self, *, uri: str, repositories=None, label: str=None, search_paths self.strict_host_key_checking = strict_host_key_checking -class ConfigServerProperties(Model): +class ConfigServerProperties(msrest.serialization.Model): """Config server git properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: State of the config server. Possible values - include: 'NotAvailable', 'Deleted', 'Failed', 'Succeeded', 'Updating' + :ivar provisioning_state: State of the config server. Possible values include: "NotAvailable", + "Deleted", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerState :param error: Error when apply config server settings. :type error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error :param config_server: Settings of config server. - :type config_server: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings + :type config_server: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings """ _validation = { @@ -619,7 +753,13 @@ class ConfigServerProperties(Model): 'config_server': {'key': 'configServer', 'type': 'ConfigServerSettings'}, } - def __init__(self, *, error=None, config_server=None, **kwargs) -> None: + def __init__( + self, + *, + error: Optional["Error"] = None, + config_server: Optional["ConfigServerSettings"] = None, + **kwargs + ): super(ConfigServerProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -629,8 +769,7 @@ def __init__(self, *, error=None, config_server=None, **kwargs) -> None: class ConfigServerResource(ProxyResource): """Config Server resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -638,9 +777,8 @@ class ConfigServerResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Config Server resource - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerProperties + :param properties: Properties of the Config Server resource. + :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerProperties """ _validation = { @@ -656,36 +794,45 @@ class ConfigServerResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'ConfigServerProperties'}, } - def __init__(self, *, properties=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["ConfigServerProperties"] = None, + **kwargs + ): super(ConfigServerResource, self).__init__(**kwargs) self.properties = properties -class ConfigServerSettings(Model): +class ConfigServerSettings(msrest.serialization.Model): """The settings of config server. :param git_property: Property of git environment. - :type git_property: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerGitProperty + :type git_property: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerGitProperty """ _attribute_map = { 'git_property': {'key': 'gitProperty', 'type': 'ConfigServerGitProperty'}, } - def __init__(self, *, git_property=None, **kwargs) -> None: + def __init__( + self, + *, + git_property: Optional["ConfigServerGitProperty"] = None, + **kwargs + ): super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = git_property -class ConfigServerSettingsErrorRecord(Model): +class ConfigServerSettingsErrorRecord(msrest.serialization.Model): """Error record of the config server settings. - :param name: The name of the config server settings error record + :param name: The name of the config server settings error record. :type name: str - :param uri: The uri of the config server settings error record + :param uri: The uri of the config server settings error record. :type uri: str - :param messages: The detail error messages of the record + :param messages: The detail error messages of the record. :type messages: list[str] """ @@ -695,19 +842,26 @@ class ConfigServerSettingsErrorRecord(Model): 'messages': {'key': 'messages', 'type': '[str]'}, } - def __init__(self, *, name: str=None, uri: str=None, messages=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + uri: Optional[str] = None, + messages: Optional[List[str]] = None, + **kwargs + ): super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) self.name = name self.uri = uri self.messages = messages -class ConfigServerSettingsValidateResult(Model): +class ConfigServerSettingsValidateResult(msrest.serialization.Model): """Validation result for config server settings. - :param is_valid: Indicate if the config server settings are valid + :param is_valid: Indicate if the config server settings are valid. :type is_valid: bool - :param details: The detail validation results + :param details: The detail validation results. :type details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettingsErrorRecord] """ @@ -717,17 +871,67 @@ class ConfigServerSettingsValidateResult(Model): 'details': {'key': 'details', 'type': '[ConfigServerSettingsErrorRecord]'}, } - def __init__(self, *, is_valid: bool=None, details=None, **kwargs) -> None: + def __init__( + self, + *, + is_valid: Optional[bool] = None, + details: Optional[List["ConfigServerSettingsErrorRecord"]] = None, + **kwargs + ): super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.details = details -class CustomDomainProperties(Model): +class CustomContainer(msrest.serialization.Model): + """Custom container payload. + + :param server: The name of the registry that contains the container image. + :type server: str + :param container_image: Container image of the custom container. This should be in the form of + :code:``::code:`` without the server name of the registry. + :type container_image: str + :param command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is + used if this is not provided. + :type command: list[str] + :param args: Arguments to the entrypoint. The docker image's CMD is used if this is not + provided. + :type args: list[str] + :param image_registry_credential: Credential of the image registry. + :type image_registry_credential: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ImageRegistryCredential + """ + + _attribute_map = { + 'server': {'key': 'server', 'type': 'str'}, + 'container_image': {'key': 'containerImage', 'type': 'str'}, + 'command': {'key': 'command', 'type': '[str]'}, + 'args': {'key': 'args', 'type': '[str]'}, + 'image_registry_credential': {'key': 'imageRegistryCredential', 'type': 'ImageRegistryCredential'}, + } + + def __init__( + self, + *, + server: Optional[str] = None, + container_image: Optional[str] = None, + command: Optional[List[str]] = None, + args: Optional[List[str]] = None, + image_registry_credential: Optional["ImageRegistryCredential"] = None, + **kwargs + ): + super(CustomContainer, self).__init__(**kwargs) + self.server = server + self.container_image = container_image + self.command = command + self.args = args + self.image_registry_credential = image_registry_credential + + +class CustomDomainProperties(msrest.serialization.Model): """Custom domain of app resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param thumbprint: The thumbprint of bound certificate. :type thumbprint: str @@ -747,7 +951,13 @@ class CustomDomainProperties(Model): 'cert_name': {'key': 'certName', 'type': 'str'}, } - def __init__(self, *, thumbprint: str=None, cert_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + thumbprint: Optional[str] = None, + cert_name: Optional[str] = None, + **kwargs + ): super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = thumbprint self.app_name = None @@ -757,8 +967,7 @@ def __init__(self, *, thumbprint: str=None, cert_name: str=None, **kwargs) -> No class CustomDomainResource(ProxyResource): """Custom domain resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -767,8 +976,7 @@ class CustomDomainResource(ProxyResource): :ivar type: The type of the resource. :vartype type: str :param properties: Properties of the custom domain resource. - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainProperties + :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainProperties """ _validation = { @@ -784,17 +992,48 @@ class CustomDomainResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'CustomDomainProperties'}, } - def __init__(self, *, properties=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["CustomDomainProperties"] = None, + **kwargs + ): super(CustomDomainResource, self).__init__(**kwargs) self.properties = properties -class CustomDomainValidatePayload(Model): +class CustomDomainResourceCollection(msrest.serialization.Model): + """Collection compose of a custom domain resources list and a possible link for next page. + + :param value: The custom domain resources list. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] + :param next_link: The link to next page of custom domain list. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CustomDomainResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["CustomDomainResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(CustomDomainResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CustomDomainValidatePayload(msrest.serialization.Model): """Custom domain validate payload. All required parameters must be populated in order to send to Azure. - :param name: Required. Name to be validated + :param name: Required. Name to be validated. :type name: str """ @@ -806,12 +1045,17 @@ class CustomDomainValidatePayload(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, name: str, **kwargs) -> None: + def __init__( + self, + *, + name: str, + **kwargs + ): super(CustomDomainValidatePayload, self).__init__(**kwargs) self.name = name -class CustomDomainValidateResult(Model): +class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. :param is_valid: Indicates if domain name is valid. @@ -825,27 +1069,32 @@ class CustomDomainValidateResult(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, is_valid: bool=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + is_valid: Optional[bool] = None, + message: Optional[str] = None, + **kwargs + ): super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.message = message -class DeploymentInstance(Model): +class DeploymentInstance(msrest.serialization.Model): """Deployment instance payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Name of the deployment instance + :ivar name: Name of the deployment instance. :vartype name: str - :ivar status: Status of the deployment instance + :ivar status: Status of the deployment instance. :vartype status: str - :ivar reason: Failed reason of the deployment instance + :ivar reason: Failed reason of the deployment instance. :vartype reason: str - :ivar discovery_status: Discovery status of the deployment instance + :ivar discovery_status: Discovery status of the deployment instance. :vartype discovery_status: str - :ivar start_time: Start time of the deployment instance + :ivar start_time: Start time of the deployment instance. :vartype start_time: str """ @@ -865,7 +1114,10 @@ class DeploymentInstance(Model): 'start_time': {'key': 'startTime', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -877,8 +1129,7 @@ def __init__(self, **kwargs) -> None: class DeploymentResource(ProxyResource): """Deployment resource payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -886,10 +1137,10 @@ class DeploymentResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Deployment resource + :param properties: Properties of the Deployment resource. :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource + :param sku: Sku of the Deployment resource. :type sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku """ @@ -907,42 +1158,71 @@ class DeploymentResource(ProxyResource): 'sku': {'key': 'sku', 'type': 'Sku'}, } - def __init__(self, *, properties=None, sku=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["DeploymentResourceProperties"] = None, + sku: Optional["Sku"] = None, + **kwargs + ): super(DeploymentResource, self).__init__(**kwargs) self.properties = properties self.sku = sku -class DeploymentResourceProperties(Model): +class DeploymentResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :param value: Collection of Deployment resources. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["DeploymentResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(DeploymentResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DeploymentResourceProperties(msrest.serialization.Model): """Deployment resource properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :param source: Uploaded source information of the deployment. - :type source: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceInfo - :ivar app_name: App name of the deployment + :type source: ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceInfo + :ivar app_name: App name of the deployment. :vartype app_name: str - :param deployment_settings: Deployment settings of the Deployment + :param deployment_settings: Deployment settings of the Deployment. :type deployment_settings: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Possible - values include: 'Creating', 'Updating', 'Succeeded', 'Failed' + :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: + "Creating", "Updating", "Succeeded", "Failed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Possible values include: - 'Unknown', 'Stopped', 'Running', 'Failed', 'Allocating', 'Upgrading', - 'Compiling' + :ivar status: Status of the Deployment. Possible values include: "Unknown", "Stopped", + "Running", "Failed", "Allocating", "Upgrading", "Compiling". :vartype status: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceStatus - :ivar active: Indicates whether the Deployment is active + :ivar active: Indicates whether the Deployment is active. :vartype active: bool - :ivar created_time: Date time when the resource is created - :vartype created_time: datetime - :ivar instances: Collection of instances belong to the Deployment - :vartype instances: - list[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentInstance] + :ivar created_time: Date time when the resource is created. + :vartype created_time: ~datetime.datetime + :ivar instances: Collection of instances belong to the Deployment. + :vartype instances: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentInstance] """ _validation = { @@ -965,7 +1245,13 @@ class DeploymentResourceProperties(Model): 'instances': {'key': 'instances', 'type': '[DeploymentInstance]'}, } - def __init__(self, *, source=None, deployment_settings=None, **kwargs) -> None: + def __init__( + self, + *, + source: Optional["UserSourceInfo"] = None, + deployment_settings: Optional["DeploymentSettings"] = None, + **kwargs + ): super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = source self.app_name = None @@ -977,36 +1263,30 @@ def __init__(self, *, source=None, deployment_settings=None, **kwargs) -> None: self.instances = None -class DeploymentSettings(Model): +class DeploymentSettings(msrest.serialization.Model): """Deployment settings payload. - :param cpu: Required CPU. This should be 1 for Basic tier, and in range - [1, 4] for Standard tier. This is deprecated starting from API version - 2021-06-01-preview. Please use the resourceRequests field to set the CPU - size. Default value: 1 . + :param cpu: Required CPU. This should be 1 for Basic tier, and in range [1, 4] for Standard + tier. This is deprecated starting from API version 2021-06-01-preview. Please use the + resourceRequests field to set the CPU size. :type cpu: int - :param memory_in_gb: Required Memory size in GB. This should be in range - [1, 2] for Basic tier, and in range [1, 8] for Standard tier. This is - deprecated starting from API version 2021-06-01-preview. Please use the - resourceRequests field to set the the memory size. Default value: 1 . + :param memory_in_gb: Required Memory size in GB. This should be in range [1, 2] for Basic tier, + and in range [1, 8] for Standard tier. This is deprecated starting from API version + 2021-06-01-preview. Please use the resourceRequests field to set the the memory size. :type memory_in_gb: int - :param resource_requests: The requested resource quantity for required CPU - and Memory. It is recommended that using this field to represent the - required CPU and Memory, the old field cpu and memoryInGB will be - deprecated later. - :type resource_requests: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceRequests - :param jvm_options: JVM parameter + :param resource_requests: The requested resource quantity for required CPU and Memory. It is + recommended that using this field to represent the required CPU and Memory, the old field cpu + and memoryInGB will be deprecated later. + :type resource_requests: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceRequests + :param jvm_options: JVM parameter. :type jvm_options: str - :param net_core_main_entry_path: The path to the .NET executable relative - to zip root + :param net_core_main_entry_path: The path to the .NET executable relative to zip root. :type net_core_main_entry_path: str - :param environment_variables: Collection of environment variables + :param environment_variables: Collection of environment variables. :type environment_variables: dict[str, str] - :param runtime_version: Runtime version. Possible values include: - 'Java_8', 'Java_11', 'NetCore_31' - :type runtime_version: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.RuntimeVersion + :param runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". + :type runtime_version: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.RuntimeVersion """ _attribute_map = { @@ -1019,7 +1299,18 @@ class DeploymentSettings(Model): 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, } - def __init__(self, *, cpu: int=1, memory_in_gb: int=1, resource_requests=None, jvm_options: str=None, net_core_main_entry_path: str=None, environment_variables=None, runtime_version=None, **kwargs) -> None: + def __init__( + self, + *, + cpu: Optional[int] = 1, + memory_in_gb: Optional[int] = 1, + resource_requests: Optional["ResourceRequests"] = None, + jvm_options: Optional[str] = None, + net_core_main_entry_path: Optional[str] = None, + environment_variables: Optional[Dict[str, str]] = None, + runtime_version: Optional[Union[str, "RuntimeVersion"]] = None, + **kwargs + ): super(DeploymentSettings, self).__init__(**kwargs) self.cpu = cpu self.memory_in_gb = memory_in_gb @@ -1030,7 +1321,7 @@ def __init__(self, *, cpu: int=1, memory_in_gb: int=1, resource_requests=None, j self.runtime_version = runtime_version -class Error(Model): +class Error(msrest.serialization.Model): """The error code compose of code and message. :param code: The code of error. @@ -1044,26 +1335,32 @@ class Error(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): super(Error, self).__init__(**kwargs) self.code = code self.message = message -class GitPatternRepository(Model): +class GitPatternRepository(msrest.serialization.Model): """Git repository property payload. All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the repository + :param name: Required. Name of the repository. :type name: str - :param pattern: Collection of pattern of the repository + :param pattern: Collection of pattern of the repository. :type pattern: list[str] - :param uri: Required. URI of the repository + :param uri: Required. URI of the repository. :type uri: str - :param label: Label of the repository + :param label: Label of the repository. :type label: str - :param search_paths: Searching path of the repository + :param search_paths: Searching path of the repository. :type search_paths: list[str] :param username: Username of git repository basic auth. :type username: str @@ -1098,7 +1395,22 @@ class GitPatternRepository(Model): 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, } - def __init__(self, *, name: str, uri: str, pattern=None, label: str=None, search_paths=None, username: str=None, password: str=None, host_key: str=None, host_key_algorithm: str=None, private_key: str=None, strict_host_key_checking: bool=None, **kwargs) -> None: + def __init__( + self, + *, + name: str, + uri: str, + pattern: Optional[List[str]] = None, + label: Optional[str] = None, + search_paths: Optional[List[str]] = None, + username: Optional[str] = None, + password: Optional[str] = None, + host_key: Optional[str] = None, + host_key_algorithm: Optional[str] = None, + private_key: Optional[str] = None, + strict_host_key_checking: Optional[bool] = None, + **kwargs + ): super(GitPatternRepository, self).__init__(**kwargs) self.name = name self.pattern = pattern @@ -1113,12 +1425,38 @@ def __init__(self, *, name: str, uri: str, pattern=None, label: str=None, search self.strict_host_key_checking = strict_host_key_checking -class LogFileUrlResponse(Model): +class ImageRegistryCredential(msrest.serialization.Model): + """Credential of the image registry. + + :param username: The username of the image registry credential. + :type username: str + :param password: The password of the image registry credential. + :type password: str + """ + + _attribute_map = { + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + } + + def __init__( + self, + *, + username: Optional[str] = None, + password: Optional[str] = None, + **kwargs + ): + super(ImageRegistryCredential, self).__init__(**kwargs) + self.username = username + self.password = password + + +class LogFileUrlResponse(msrest.serialization.Model): """Log file URL payload. All required parameters must be populated in order to send to Azure. - :param url: Required. URL of the log file + :param url: Required. URL of the log file. :type url: str """ @@ -1130,19 +1468,24 @@ class LogFileUrlResponse(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, *, url: str, **kwargs) -> None: + def __init__( + self, + *, + url: str, + **kwargs + ): super(LogFileUrlResponse, self).__init__(**kwargs) self.url = url -class LogSpecification(Model): +class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :param name: Name of the log + :param name: Name of the log. :type name: str - :param display_name: Localized friendly display name of the log + :param display_name: Localized friendly display name of the log. :type display_name: str - :param blob_duration: Blob duration of the log + :param blob_duration: Blob duration of the log. :type blob_duration: str """ @@ -1152,23 +1495,29 @@ class LogSpecification(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, *, name: str=None, display_name: str=None, blob_duration: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name self.blob_duration = blob_duration -class ManagedIdentityProperties(Model): +class ManagedIdentityProperties(msrest.serialization.Model): """Managed identity properties retrieved from ARM request headers. - :param type: Type of the managed identity. Possible values include: - 'None', 'SystemAssigned', 'UserAssigned', 'SystemAssigned,UserAssigned' - :type type: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityType - :param principal_id: Principal Id + :param type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :type type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityType + :param principal_id: Principal Id. :type principal_id: str - :param tenant_id: Tenant Id + :param tenant_id: Tenant Id. :type tenant_id: str """ @@ -1178,60 +1527,78 @@ class ManagedIdentityProperties(Model): 'tenant_id': {'key': 'tenantId', 'type': 'str'}, } - def __init__(self, *, type=None, principal_id: str=None, tenant_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + type: Optional[Union[str, "ManagedIdentityType"]] = None, + principal_id: Optional[str] = None, + tenant_id: Optional[str] = None, + **kwargs + ): super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = type self.principal_id = principal_id self.tenant_id = tenant_id -class MetricDimension(Model): +class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension + :param name: Name of the dimension. :type name: str - :param display_name: Localized friendly display name of the dimension + :param display_name: Localized friendly display name of the dimension. :type display_name: str + :param to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :type to_be_exported_for_shoebox: bool """ _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'display_name': {'key': 'displayName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } - def __init__(self, *, name: str=None, display_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + **kwargs + ): super(MetricDimension, self).__init__(**kwargs) self.name = name self.display_name = display_name + self.to_be_exported_for_shoebox = to_be_exported_for_shoebox -class MetricSpecification(Model): +class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :param name: Name of the metric + :param name: Name of the metric. :type name: str - :param display_name: Localized friendly display name of the metric + :param display_name: Localized friendly display name of the metric. :type display_name: str - :param display_description: Localized friendly description of the metric + :param display_description: Localized friendly description of the metric. :type display_description: str - :param unit: Unit that makes sense for the metric + :param unit: Unit that makes sense for the metric. :type unit: str - :param category: Name of the metric category that the metric belongs to. A - metric can only belong to a single category. + :param category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. :type category: str - :param aggregation_type: Only provide one value for this field. Valid - values: Average, Minimum, Maximum, Total, Count. + :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + Maximum, Total, Count. :type aggregation_type: str - :param supported_aggregation_types: Supported aggregation types + :param supported_aggregation_types: Supported aggregation types. :type supported_aggregation_types: list[str] - :param supported_time_grain_types: Supported time grain types + :param supported_time_grain_types: Supported time grain types. :type supported_time_grain_types: list[str] - :param fill_gap_with_zero: Optional. If set to true, then zero will be - returned for time duration where no metric is emitted/published. + :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. :type fill_gap_with_zero: bool - :param dimensions: Dimensions of the metric - :type dimensions: - list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricDimension] + :param dimensions: Dimensions of the metric. + :type dimensions: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricDimension] """ _attribute_map = { @@ -1247,7 +1614,21 @@ class MetricSpecification(Model): 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, } - def __init__(self, *, name: str=None, display_name: str=None, display_description: str=None, unit: str=None, category: str=None, aggregation_type: str=None, supported_aggregation_types=None, supported_time_grain_types=None, fill_gap_with_zero: bool=None, dimensions=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + category: Optional[str] = None, + aggregation_type: Optional[str] = None, + supported_aggregation_types: Optional[List[str]] = None, + supported_time_grain_types: Optional[List[str]] = None, + fill_gap_with_zero: Optional[bool] = None, + dimensions: Optional[List["MetricDimension"]] = None, + **kwargs + ): super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1261,32 +1642,28 @@ def __init__(self, *, name: str=None, display_name: str=None, display_descriptio self.dimensions = dimensions -class MonitoringSettingProperties(Model): +class MonitoringSettingProperties(msrest.serialization.Model): """Monitoring Setting properties payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: State of the Monitoring Setting. Possible values - include: 'NotAvailable', 'Failed', 'Succeeded', 'Updating' + :ivar provisioning_state: State of the Monitoring Setting. Possible values include: + "NotAvailable", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingState :param error: Error when apply Monitoring Setting changes. :type error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error - :param trace_enabled: Indicates whether enable the trace functionality, - which will be deprecated since api version 2020-11-01-preview. Please - leverage appInsightsInstrumentationKey to indicate if monitoringSettings - enabled or not + :param trace_enabled: Indicates whether enable the trace functionality, which will be + deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey + to indicate if monitoringSettings enabled or not. :type trace_enabled: bool - :param app_insights_instrumentation_key: Target application insight - instrumentation key, null or whitespace include empty will disable - monitoringSettings + :param app_insights_instrumentation_key: Target application insight instrumentation key, null + or whitespace include empty will disable monitoringSettings. :type app_insights_instrumentation_key: str - :param app_insights_sampling_rate: Indicates the sampling rate of - application insight agent, should be in range [0.0, 100.0] + :param app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + should be in range [0.0, 100.0]. :type app_insights_sampling_rate: float - :param app_insights_agent_versions: Indicates the versions of application - insight agent + :param app_insights_agent_versions: Indicates the versions of application insight agent. :type app_insights_agent_versions: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ApplicationInsightsAgentVersions """ @@ -1305,7 +1682,16 @@ class MonitoringSettingProperties(Model): 'app_insights_agent_versions': {'key': 'appInsightsAgentVersions', 'type': 'ApplicationInsightsAgentVersions'}, } - def __init__(self, *, error=None, trace_enabled: bool=None, app_insights_instrumentation_key: str=None, app_insights_sampling_rate: float=None, app_insights_agent_versions=None, **kwargs) -> None: + def __init__( + self, + *, + error: Optional["Error"] = None, + trace_enabled: Optional[bool] = None, + app_insights_instrumentation_key: Optional[str] = None, + app_insights_sampling_rate: Optional[float] = None, + app_insights_agent_versions: Optional["ApplicationInsightsAgentVersions"] = None, + **kwargs + ): super(MonitoringSettingProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -1318,8 +1704,7 @@ def __init__(self, *, error=None, trace_enabled: bool=None, app_insights_instrum class MonitoringSettingResource(ProxyResource): """Monitoring Setting resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -1327,7 +1712,7 @@ class MonitoringSettingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Monitoring Setting resource + :param properties: Properties of the Monitoring Setting resource. :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingProperties """ @@ -1345,19 +1730,24 @@ class MonitoringSettingResource(ProxyResource): 'properties': {'key': 'properties', 'type': 'MonitoringSettingProperties'}, } - def __init__(self, *, properties=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["MonitoringSettingProperties"] = None, + **kwargs + ): super(MonitoringSettingResource, self).__init__(**kwargs) self.properties = properties -class NameAvailability(Model): +class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :param name_available: Indicates whether the name is available + :param name_available: Indicates whether the name is available. :type name_available: bool - :param reason: Reason why the name is not available + :param reason: Reason why the name is not available. :type reason: str - :param message: Message why the name is not available + :param message: Message why the name is not available. :type message: str """ @@ -1367,21 +1757,28 @@ class NameAvailability(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, name_available: bool=None, reason: str=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): super(NameAvailability, self).__init__(**kwargs) self.name_available = name_available self.reason = reason self.message = message -class NameAvailabilityParameters(Model): +class NameAvailabilityParameters(msrest.serialization.Model): """Name availability parameters payload. All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the resource to check name availability + :param type: Required. Type of the resource to check name availability. :type type: str - :param name: Required. Name to be checked + :param name: Required. Name to be checked. :type name: str """ @@ -1395,44 +1792,47 @@ class NameAvailabilityParameters(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, type: str, name: str, **kwargs) -> None: + def __init__( + self, + *, + type: str, + name: str, + **kwargs + ): super(NameAvailabilityParameters, self).__init__(**kwargs) self.type = type self.name = name -class NetworkProfile(Model): +class NetworkProfile(msrest.serialization.Model): """Service network profile payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param service_runtime_subnet_id: Fully qualified resource Id of the - subnet to host Azure Spring Cloud Service Runtime + :param service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. :type service_runtime_subnet_id: str - :param app_subnet_id: Fully qualified resource Id of the subnet to host - Azure Spring Cloud Apps + :param app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. :type app_subnet_id: str - :param service_cidr: Azure Spring Cloud service reserved CIDR + :param service_cidr: Azure Spring Cloud service reserved CIDR. :type service_cidr: str - :param service_runtime_network_resource_group: Name of the resource group - containing network resources of Azure Spring Cloud Service Runtime + :param service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. :type service_runtime_network_resource_group: str - :param app_network_resource_group: Name of the resource group containing - network resources of Azure Spring Cloud Apps + :param app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. :type app_network_resource_group: str - :ivar outbound_ips: Desired outbound IP resources for Azure Spring Cloud - instance. - :vartype outbound_ips: + :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Cloud instance. + :vartype outbound_i_ps: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure - Spring Cloud instance. + :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Cloud instance. :vartype required_traffics: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.RequiredTraffic] """ _validation = { - 'outbound_ips': {'readonly': True}, + 'outbound_i_ps': {'readonly': True}, 'required_traffics': {'readonly': True}, } @@ -1442,59 +1842,68 @@ class NetworkProfile(Model): 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, 'service_runtime_network_resource_group': {'key': 'serviceRuntimeNetworkResourceGroup', 'type': 'str'}, 'app_network_resource_group': {'key': 'appNetworkResourceGroup', 'type': 'str'}, - 'outbound_ips': {'key': 'outboundIPs', 'type': 'NetworkProfileOutboundIPs'}, + 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'NetworkProfileOutboundIPs'}, 'required_traffics': {'key': 'requiredTraffics', 'type': '[RequiredTraffic]'}, } - def __init__(self, *, service_runtime_subnet_id: str=None, app_subnet_id: str=None, service_cidr: str=None, service_runtime_network_resource_group: str=None, app_network_resource_group: str=None, **kwargs) -> None: + def __init__( + self, + *, + service_runtime_subnet_id: Optional[str] = None, + app_subnet_id: Optional[str] = None, + service_cidr: Optional[str] = None, + service_runtime_network_resource_group: Optional[str] = None, + app_network_resource_group: Optional[str] = None, + **kwargs + ): super(NetworkProfile, self).__init__(**kwargs) self.service_runtime_subnet_id = service_runtime_subnet_id self.app_subnet_id = app_subnet_id self.service_cidr = service_cidr self.service_runtime_network_resource_group = service_runtime_network_resource_group self.app_network_resource_group = app_network_resource_group - self.outbound_ips = None + self.outbound_i_ps = None self.required_traffics = None -class NetworkProfileOutboundIPs(Model): +class NetworkProfileOutboundIPs(msrest.serialization.Model): """Desired outbound IP resources for Azure Spring Cloud instance. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar public_ips: A list of public IP addresses. - :vartype public_ips: list[str] + :ivar public_i_ps: A list of public IP addresses. + :vartype public_i_ps: list[str] """ _validation = { - 'public_ips': {'readonly': True}, + 'public_i_ps': {'readonly': True}, } _attribute_map = { - 'public_ips': {'key': 'publicIPs', 'type': '[str]'}, + 'public_i_ps': {'key': 'publicIPs', 'type': '[str]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(NetworkProfileOutboundIPs, self).__init__(**kwargs) - self.public_ips = None + self.public_i_ps = None -class OperationDetail(Model): +class OperationDetail(msrest.serialization.Model): """Operation detail payload. - :param name: Name of the operation + :param name: Name of the operation. :type name: str - :param is_data_action: Indicates whether the operation is a data action + :param is_data_action: Indicates whether the operation is a data action. :type is_data_action: bool - :param display: Display of the operation - :type display: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDisplay - :param origin: Origin of the operation + :param display: Display of the operation. + :type display: ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDisplay + :param origin: Origin of the operation. :type origin: str - :param properties: Properties of the operation - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationProperties + :param properties: Properties of the operation. + :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationProperties """ _attribute_map = { @@ -1505,7 +1914,16 @@ class OperationDetail(Model): 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } - def __init__(self, *, name: str=None, is_data_action: bool=None, display=None, origin: str=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + properties: Optional["OperationProperties"] = None, + **kwargs + ): super(OperationDetail, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action @@ -1514,16 +1932,16 @@ def __init__(self, *, name: str=None, is_data_action: bool=None, display=None, o self.properties = properties -class OperationDisplay(Model): +class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :param provider: Resource provider of the operation + :param provider: Resource provider of the operation. :type provider: str - :param resource: Resource of the operation + :param resource: Resource of the operation. :type resource: str - :param operation: Localized friendly name for the operation + :param operation: Localized friendly name for the operation. :type operation: str - :param description: Localized friendly description for the operation + :param description: Localized friendly description for the operation. :type description: str """ @@ -1534,7 +1952,15 @@ class OperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1542,10 +1968,10 @@ def __init__(self, *, provider: str=None, resource: str=None, operation: str=Non self.description = description -class OperationProperties(Model): +class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :param service_specification: Service specifications of the operation + :param service_specification: Service specifications of the operation. :type service_specification: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceSpecification """ @@ -1554,22 +1980,26 @@ class OperationProperties(Model): 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, *, service_specification=None, **kwargs) -> None: + def __init__( + self, + *, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification -class PersistentDisk(Model): +class PersistentDisk(msrest.serialization.Model): """Persistent disk payload. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param size_in_gb: Size of the persistent disk in GB + :param size_in_gb: Size of the persistent disk in GB. :type size_in_gb: int - :ivar used_in_gb: Size of the used persistent disk in GB + :ivar used_in_gb: Size of the used persistent disk in GB. :vartype used_in_gb: int - :param mount_path: Mount path of the persistent disk + :param mount_path: Mount path of the persistent disk. :type mount_path: str """ @@ -1584,22 +2014,27 @@ class PersistentDisk(Model): 'mount_path': {'key': 'mountPath', 'type': 'str'}, } - def __init__(self, *, size_in_gb: int=None, mount_path: str=None, **kwargs) -> None: + def __init__( + self, + *, + size_in_gb: Optional[int] = None, + mount_path: Optional[str] = None, + **kwargs + ): super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.used_in_gb = None self.mount_path = mount_path -class RegenerateTestKeyRequestPayload(Model): +class RegenerateTestKeyRequestPayload(msrest.serialization.Model): """Regenerate test key request payload. All required parameters must be populated in order to send to Azure. - :param key_type: Required. Type of the test key. Possible values include: - 'Primary', 'Secondary' - :type key_type: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeyType + :param key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :type key_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeyType """ _validation = { @@ -1610,29 +2045,32 @@ class RegenerateTestKeyRequestPayload(Model): 'key_type': {'key': 'keyType', 'type': 'str'}, } - def __init__(self, *, key_type, **kwargs) -> None: + def __init__( + self, + *, + key_type: Union[str, "TestKeyType"], + **kwargs + ): super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) self.key_type = key_type -class RequiredTraffic(Model): +class RequiredTraffic(msrest.serialization.Model): """Required inbound or outbound traffic for Azure Spring Cloud instance. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar protocol: The protocol of required traffic + :ivar protocol: The protocol of required traffic. :vartype protocol: str - :ivar port: The port of required traffic + :ivar port: The port of required traffic. :vartype port: int - :ivar ips: The ip list of required traffic + :ivar ips: The ip list of required traffic. :vartype ips: list[str] - :ivar fqdns: The FQDN list of required traffic + :ivar fqdns: The FQDN list of required traffic. :vartype fqdns: list[str] - :ivar direction: The direction of required traffic. Possible values - include: 'Inbound', 'Outbound' - :vartype direction: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.TrafficDirection + :ivar direction: The direction of required traffic. Possible values include: "Inbound", + "Outbound". + :vartype direction: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.TrafficDirection """ _validation = { @@ -1651,7 +2089,10 @@ class RequiredTraffic(Model): 'direction': {'key': 'direction', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -1660,16 +2101,14 @@ def __init__(self, **kwargs) -> None: self.direction = None -class ResourceRequests(Model): +class ResourceRequests(msrest.serialization.Model): """Deployment resource request payload. - :param cpu: Required CPU. 1 core can be represented by 1 or 1000m. This - should be 500m or 1 for Basic tier, and {500m, 1, 2, 3, 4} for Standard - tier. + :param cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for + Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. :type cpu: str - :param memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. - This should be {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, - ..., 8Gi} for Standard tier. + :param memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be + {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. :type memory: str """ @@ -1678,13 +2117,19 @@ class ResourceRequests(Model): 'memory': {'key': 'memory', 'type': 'str'}, } - def __init__(self, *, cpu: str=None, memory: str=None, **kwargs) -> None: + def __init__( + self, + *, + cpu: Optional[str] = None, + memory: Optional[str] = None, + **kwargs + ): super(ResourceRequests, self).__init__(**kwargs) self.cpu = cpu self.memory = memory -class ResourceSku(Model): +class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. :param resource_type: Gets the type of resource the SKU applies to. @@ -1694,16 +2139,14 @@ class ResourceSku(Model): :param tier: Gets the tier of SKU. :type tier: str :param capacity: Gets the capacity of SKU. - :type capacity: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuCapacity + :type capacity: ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuCapacity :param locations: Gets the set of locations that the SKU is available. :type locations: list[str] - :param location_info: Gets a list of locations and availability zones in - those locations where the SKU is available. + :param location_info: Gets a list of locations and availability zones in those locations where + the SKU is available. :type location_info: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuLocationInfo] - :param restrictions: Gets the restrictions because of which SKU cannot be - used. This is + :param restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. :type restrictions: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictions] @@ -1719,7 +2162,18 @@ class ResourceSku(Model): 'restrictions': {'key': 'restrictions', 'type': '[ResourceSkuRestrictions]'}, } - def __init__(self, *, resource_type: str=None, name: str=None, tier: str=None, capacity=None, locations=None, location_info=None, restrictions=None, **kwargs) -> None: + def __init__( + self, + *, + resource_type: Optional[str] = None, + name: Optional[str] = None, + tier: Optional[str] = None, + capacity: Optional["SkuCapacity"] = None, + locations: Optional[List[str]] = None, + location_info: Optional[List["ResourceSkuLocationInfo"]] = None, + restrictions: Optional[List["ResourceSkuRestrictions"]] = None, + **kwargs + ): super(ResourceSku, self).__init__(**kwargs) self.resource_type = resource_type self.name = name @@ -1730,7 +2184,7 @@ def __init__(self, *, resource_type: str=None, name: str=None, tier: str=None, c self.restrictions = restrictions -class ResourceSkuCapabilities(Model): +class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. :param name: Gets an invariant to describe the feature. @@ -1744,21 +2198,53 @@ class ResourceSkuCapabilities(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, *, name: str=None, value: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = name self.value = value -class ResourceSkuLocationInfo(Model): +class ResourceSkuCollection(msrest.serialization.Model): + """Object that includes an array of Azure Spring Cloud SKU and a possible link for next set. + + :param value: Collection of resource SKU. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSku] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceSku]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ResourceSku"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ResourceSkuCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ResourceSkuLocationInfo(msrest.serialization.Model): """Locations and availability zones where the SKU is available. - :param location: Gets location of the SKU + :param location: Gets location of the SKU. :type location: str :param zones: Gets list of availability zones where the SKU is supported. :type zones: list[str] - :param zone_details: Gets details of capabilities available to a SKU in - specific zones. + :param zone_details: Gets details of capabilities available to a SKU in specific zones. :type zone_details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuZoneDetails] """ @@ -1769,17 +2255,24 @@ class ResourceSkuLocationInfo(Model): 'zone_details': {'key': 'zoneDetails', 'type': '[ResourceSkuZoneDetails]'}, } - def __init__(self, *, location: str=None, zones=None, zone_details=None, **kwargs) -> None: + def __init__( + self, + *, + location: Optional[str] = None, + zones: Optional[List[str]] = None, + zone_details: Optional[List["ResourceSkuZoneDetails"]] = None, + **kwargs + ): super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = location self.zones = zones self.zone_details = zone_details -class ResourceSkuRestrictionInfo(Model): +class ResourceSkuRestrictionInfo(msrest.serialization.Model): """Information about the restriction where the SKU cannot be used. - :param locations: Gets locations where the SKU is restricted + :param locations: Gets locations where the SKU is restricted. :type locations: list[str] :param zones: Gets list of availability zones where the SKU is restricted. :type zones: list[str] @@ -1790,29 +2283,35 @@ class ResourceSkuRestrictionInfo(Model): 'zones': {'key': 'zones', 'type': '[str]'}, } - def __init__(self, *, locations=None, zones=None, **kwargs) -> None: + def __init__( + self, + *, + locations: Optional[List[str]] = None, + zones: Optional[List[str]] = None, + **kwargs + ): super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = locations self.zones = zones -class ResourceSkuRestrictions(Model): +class ResourceSkuRestrictions(msrest.serialization.Model): """Restrictions where the SKU cannot be used. - :param type: Gets the type of restrictions. Possible values include: - 'Location', 'Zone' + :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". :type type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionsType - :param values: Gets the value of restrictions. If the restriction type is - set to + :param values: Gets the value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. :type values: list[str] - :param restriction_info: Gets the information about the restriction where - the SKU cannot be used. + :param restriction_info: Gets the information about the restriction where the SKU cannot be + used. :type restriction_info: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionInfo - :param reason_code: Gets the reason for restriction. Possible values - include: 'QuotaId', 'NotAvailableForSubscription' + :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". :type reason_code: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionsReasonCode """ @@ -1824,7 +2323,15 @@ class ResourceSkuRestrictions(Model): 'reason_code': {'key': 'reasonCode', 'type': 'str'}, } - def __init__(self, *, type=None, values=None, restriction_info=None, reason_code=None, **kwargs) -> None: + def __init__( + self, + *, + type: Optional[Union[str, "ResourceSkuRestrictionsType"]] = None, + values: Optional[List[str]] = None, + restriction_info: Optional["ResourceSkuRestrictionInfo"] = None, + reason_code: Optional[Union[str, "ResourceSkuRestrictionsReasonCode"]] = None, + **kwargs + ): super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = type self.values = values @@ -1832,14 +2339,13 @@ def __init__(self, *, type=None, values=None, restriction_info=None, reason_code self.reason_code = reason_code -class ResourceSkuZoneDetails(Model): +class ResourceSkuZoneDetails(msrest.serialization.Model): """Details of capabilities available to a SKU in specific zones. :param name: Gets the set of zones that the SKU is available in with the specified capabilities. :type name: list[str] - :param capabilities: Gets a list of capabilities that are available for - the SKU in the + :param capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. :type capabilities: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuCapabilities] @@ -1850,18 +2356,24 @@ class ResourceSkuZoneDetails(Model): 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, } - def __init__(self, *, name=None, capabilities=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[List[str]] = None, + capabilities: Optional[List["ResourceSkuCapabilities"]] = None, + **kwargs + ): super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = name self.capabilities = capabilities -class ResourceUploadDefinition(Model): +class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :param relative_path: Source relative path + :param relative_path: Source relative path. :type relative_path: str - :param upload_url: Upload URL + :param upload_url: Upload URL. :type upload_url: str """ @@ -1870,7 +2382,13 @@ class ResourceUploadDefinition(Model): 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, } - def __init__(self, *, relative_path: str=None, upload_url: str=None, **kwargs) -> None: + def __init__( + self, + *, + relative_path: Optional[str] = None, + upload_url: Optional[str] = None, + **kwargs + ): super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = relative_path self.upload_url = upload_url @@ -1879,8 +2397,7 @@ def __init__(self, *, relative_path: str=None, upload_url: str=None, **kwargs) - class TrackedResource(Resource): """The resource model definition for a ARM tracked top level resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -1890,7 +2407,7 @@ class TrackedResource(Resource): :vartype type: str :param location: The GEO location of the resource. :type location: str - :param tags: Tags of the service which is a list of key value pairs that + :param tags: A set of tags. Tags of the service which is a list of key value pairs that describe the resource. :type tags: dict[str, str] """ @@ -1909,7 +2426,13 @@ class TrackedResource(Resource): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, location: str=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(TrackedResource, self).__init__(**kwargs) self.location = location self.tags = tags @@ -1918,8 +2441,7 @@ def __init__(self, *, location: str=None, tags=None, **kwargs) -> None: class ServiceResource(TrackedResource): """Service resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource Id for the resource. :vartype id: str @@ -1929,13 +2451,12 @@ class ServiceResource(TrackedResource): :vartype type: str :param location: The GEO location of the resource. :type location: str - :param tags: Tags of the service which is a list of key value pairs that + :param tags: A set of tags. Tags of the service which is a list of key value pairs that describe the resource. :type tags: dict[str, str] - :param properties: Properties of the Service resource - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ClusterResourceProperties - :param sku: Sku of the Service resource + :param properties: Properties of the Service resource. + :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ClusterResourceProperties + :param sku: Sku of the Service resource. :type sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku """ @@ -1955,20 +2476,54 @@ class ServiceResource(TrackedResource): 'sku': {'key': 'sku', 'type': 'Sku'}, } - def __init__(self, *, location: str=None, tags=None, properties=None, sku=None, **kwargs) -> None: + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional["ClusterResourceProperties"] = None, + sku: Optional["Sku"] = None, + **kwargs + ): super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.properties = properties self.sku = sku -class ServiceSpecification(Model): +class ServiceResourceList(msrest.serialization.Model): + """Object that includes an array of Service resources and a possible link for next set. + + :param value: Collection of Service resources. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] + :param next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ServiceResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ServiceResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ServiceResourceList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :param log_specifications: Specifications of the Log for Azure Monitoring + :param log_specifications: Specifications of the Log for Azure Monitoring. :type log_specifications: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.LogSpecification] - :param metric_specifications: Specifications of the Metrics for Azure - Monitoring + :param metric_specifications: Specifications of the Metrics for Azure Monitoring. :type metric_specifications: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricSpecification] """ @@ -1978,20 +2533,26 @@ class ServiceSpecification(Model): 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, } - def __init__(self, *, log_specifications=None, metric_specifications=None, **kwargs) -> None: + def __init__( + self, + *, + log_specifications: Optional[List["LogSpecification"]] = None, + metric_specifications: Optional[List["MetricSpecification"]] = None, + **kwargs + ): super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications -class Sku(Model): +class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :param name: Name of the Sku. Default value: "S0" . + :param name: Name of the Sku. :type name: str - :param tier: Tier of the Sku. Default value: "Standard" . + :param tier: Tier of the Sku. :type tier: str - :param capacity: Current capacity of the target resource + :param capacity: Current capacity of the target resource. :type capacity: int """ @@ -2001,14 +2562,21 @@ class Sku(Model): 'capacity': {'key': 'capacity', 'type': 'int'}, } - def __init__(self, *, name: str="S0", tier: str="Standard", capacity: int=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = "S0", + tier: Optional[str] = "Standard", + capacity: Optional[int] = None, + **kwargs + ): super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier self.capacity = capacity -class SkuCapacity(Model): +class SkuCapacity(msrest.serialization.Model): """The SKU capacity. All required parameters must be populated in order to send to Azure. @@ -2019,10 +2587,9 @@ class SkuCapacity(Model): :type maximum: int :param default: Gets or sets the default. :type default: int - :param scale_type: Gets or sets the type of the scale. Possible values - include: 'None', 'Manual', 'Automatic' - :type scale_type: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuScaleType + :param scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :type scale_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuScaleType """ _validation = { @@ -2036,7 +2603,15 @@ class SkuCapacity(Model): 'scale_type': {'key': 'scaleType', 'type': 'str'}, } - def __init__(self, *, minimum: int, maximum: int=None, default: int=None, scale_type=None, **kwargs) -> None: + def __init__( + self, + *, + minimum: int, + maximum: Optional[int] = None, + default: Optional[int] = None, + scale_type: Optional[Union[str, "SkuScaleType"]] = None, + **kwargs + ): super(SkuCapacity, self).__init__(**kwargs) self.minimum = minimum self.maximum = maximum @@ -2044,15 +2619,14 @@ def __init__(self, *, minimum: int, maximum: int=None, default: int=None, scale_ self.scale_type = scale_type -class SupportedRuntimeVersion(Model): +class SupportedRuntimeVersion(msrest.serialization.Model): """Supported deployment runtime version descriptor. - :param value: The raw value which could be passed to deployment CRUD - operations. Possible values include: 'Java_8', 'Java_11', 'NetCore_31' - :type value: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimeValue - :param platform: The platform of this runtime version (possible values: - "Java" or ".NET"). Possible values include: 'Java', '.NET Core' + :param value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :type value: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimeValue + :param platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". :type platform: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimePlatform :param version: The detailed version (major.minor) of the platform. @@ -2065,19 +2639,26 @@ class SupportedRuntimeVersion(Model): 'version': {'key': 'version', 'type': 'str'}, } - def __init__(self, *, value=None, platform=None, version: str=None, **kwargs) -> None: + def __init__( + self, + *, + value: Optional[Union[str, "SupportedRuntimeValue"]] = None, + platform: Optional[Union[str, "SupportedRuntimePlatform"]] = None, + version: Optional[str] = None, + **kwargs + ): super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = value self.platform = platform self.version = version -class TemporaryDisk(Model): +class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :param size_in_gb: Size of the temporary disk in GB + :param size_in_gb: Size of the temporary disk in GB. :type size_in_gb: int - :param mount_path: Mount path of the temporary disk + :param mount_path: Mount path of the temporary disk. :type mount_path: str """ @@ -2090,24 +2671,30 @@ class TemporaryDisk(Model): 'mount_path': {'key': 'mountPath', 'type': 'str'}, } - def __init__(self, *, size_in_gb: int=None, mount_path: str=None, **kwargs) -> None: + def __init__( + self, + *, + size_in_gb: Optional[int] = None, + mount_path: Optional[str] = None, + **kwargs + ): super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.mount_path = mount_path -class TestKeys(Model): +class TestKeys(msrest.serialization.Model): """Test keys payload. - :param primary_key: Primary key + :param primary_key: Primary key. :type primary_key: str - :param secondary_key: Secondary key + :param secondary_key: Secondary key. :type secondary_key: str - :param primary_test_endpoint: Primary test endpoint + :param primary_test_endpoint: Primary test endpoint. :type primary_test_endpoint: str - :param secondary_test_endpoint: Secondary test endpoint + :param secondary_test_endpoint: Secondary test endpoint. :type secondary_test_endpoint: str - :param enabled: Indicates whether the test endpoint feature enabled or not + :param enabled: Indicates whether the test endpoint feature enabled or not. :type enabled: bool """ @@ -2119,7 +2706,16 @@ class TestKeys(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, *, primary_key: str=None, secondary_key: str=None, primary_test_endpoint: str=None, secondary_test_endpoint: str=None, enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + primary_key: Optional[str] = None, + secondary_key: Optional[str] = None, + primary_test_endpoint: Optional[str] = None, + secondary_test_endpoint: Optional[str] = None, + enabled: Optional[bool] = None, + **kwargs + ): super(TestKeys, self).__init__(**kwargs) self.primary_key = primary_key self.secondary_key = secondary_key @@ -2128,21 +2724,22 @@ def __init__(self, *, primary_key: str=None, secondary_key: str=None, primary_te self.enabled = enabled -class UserSourceInfo(Model): +class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :param type: Type of the source uploaded. Possible values include: 'Jar', - 'NetCoreZip', 'Source' - :type type: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceType - :param relative_path: Relative path of the storage which stores the source + :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source", "Container". + :type type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceType + :param relative_path: Relative path of the storage which stores the source. :type relative_path: str - :param version: Version of the source + :param version: Version of the source. :type version: str - :param artifact_selector: Selector for the artifact to be used for the - deployment for multi-module projects. This should be + :param artifact_selector: Selector for the artifact to be used for the deployment for + multi-module projects. This should be the relative path to the target module/project. :type artifact_selector: str + :param custom_container: Custom container payload. + :type custom_container: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomContainer """ _attribute_map = { @@ -2150,11 +2747,22 @@ class UserSourceInfo(Model): 'relative_path': {'key': 'relativePath', 'type': 'str'}, 'version': {'key': 'version', 'type': 'str'}, 'artifact_selector': {'key': 'artifactSelector', 'type': 'str'}, - } - - def __init__(self, *, type=None, relative_path: str=None, version: str=None, artifact_selector: str=None, **kwargs) -> None: + 'custom_container': {'key': 'customContainer', 'type': 'CustomContainer'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "UserSourceType"]] = None, + relative_path: Optional[str] = None, + version: Optional[str] = None, + artifact_selector: Optional[str] = None, + custom_container: Optional["CustomContainer"] = None, + **kwargs + ): super(UserSourceInfo, self).__init__(**kwargs) self.type = type self.relative_path = relative_path self.version = version self.artifact_selector = artifact_selector + self.custom_container = custom_container diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/models/_paged_models.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/models/_paged_models.py deleted file mode 100644 index a7f5e8da6ab..00000000000 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/models/_paged_models.py +++ /dev/null @@ -1,118 +0,0 @@ -# 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. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class ServiceResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`ServiceResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ServiceResource]'} - } - - def __init__(self, *args, **kwargs): - - super(ServiceResourcePaged, self).__init__(*args, **kwargs) -class AppResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`AppResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[AppResource]'} - } - - def __init__(self, *args, **kwargs): - - super(AppResourcePaged, self).__init__(*args, **kwargs) -class BindingResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`BindingResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[BindingResource]'} - } - - def __init__(self, *args, **kwargs): - - super(BindingResourcePaged, self).__init__(*args, **kwargs) -class CertificateResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`CertificateResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CertificateResource]'} - } - - def __init__(self, *args, **kwargs): - - super(CertificateResourcePaged, self).__init__(*args, **kwargs) -class CustomDomainResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`CustomDomainResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CustomDomainResource]'} - } - - def __init__(self, *args, **kwargs): - - super(CustomDomainResourcePaged, self).__init__(*args, **kwargs) -class DeploymentResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`DeploymentResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeploymentResource]'} - } - - def __init__(self, *args, **kwargs): - - super(DeploymentResourcePaged, self).__init__(*args, **kwargs) -class OperationDetailPaged(Paged): - """ - A paging container for iterating over a list of :class:`OperationDetail ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[OperationDetail]'} - } - - def __init__(self, *args, **kwargs): - - super(OperationDetailPaged, self).__init__(*args, **kwargs) -class ResourceSkuPaged(Paged): - """ - A paging container for iterating over a list of :class:`ResourceSku ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ResourceSku]'} - } - - def __init__(self, *args, **kwargs): - - super(ResourceSkuPaged, self).__init__(*args, **kwargs) diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/__init__.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/__init__.py index 0a24a9df9f9..aa6fe5cd0cf 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/__init__.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/__init__.py @@ -1,12 +1,9 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from ._services_operations import ServicesOperations diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_apps_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_apps_operations.py index bf31ff9bec7..eea853d9933 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_apps_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_apps_operations.py @@ -1,634 +1,726 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class AppsOperations(object): """AppsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2021_06_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2021-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2021-06-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, app_name, sync_status=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + sync_status=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" """Get an App and its properties. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status + :param sync_status: Indicates whether sync status. :type sync_status: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AppResource or ClientRawResponse if raw=true + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResource, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if sync_status is not None: query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AppResource', response) + deserialized = self._deserialize('AppResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, service_name, app_name, app_resource, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(app_resource, 'AppResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AppResource', response) + deserialized = self._deserialize('AppResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('AppResource', response) + deserialized = self._deserialize('AppResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('AppResource', response) + deserialized = self._deserialize('AppResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, service_name, app_name, app_resource, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.AppResource"] """Create a new App or update an exiting App. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param app_resource: Parameters for the create or update operation - :type app_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns AppResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource]] - :raises: :class:`CloudError` + :param app_resource: Parameters for the create or update operation. + :type app_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - app_resource=app_resource, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('AppResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def _delete_initial( - self, resource_group_name, service_name, app_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, service_name, app_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete an App. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def _update_initial( - self, resource_group_name, service_name, app_name, app_resource, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(app_resource, 'AppResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('AppResource', response) + deserialized = self._deserialize('AppResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('AppResource', response) + deserialized = self._deserialize('AppResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, service_name, app_name, app_resource, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.AppResource"] """Operation to update an exiting App. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param app_resource: Parameters for the update operation - :type app_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns AppResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource]] - :raises: :class:`CloudError` + :param app_resource: Parameters for the update operation. + :type app_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - app_resource=app_resource, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('AppResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def list( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AppResourceCollection"] """Handles requests to list all resources in a Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of AppResource - :rtype: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourcePaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AppResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.AppResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore def get_resource_upload_url( - self, resource_group_name, service_name, app_name, custom_headers=None, raw=False, **operation_config): - """Get an resource upload URL for an App, which may be artifacts or source - archive. - - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceUploadDefinition" + """Get an resource upload URL for an App, which may be artifacts or source archive. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ResourceUploadDefinition or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceUploadDefinition - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceUploadDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceUploadDefinition + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get_resource_upload_url.metadata['url'] + url = self.get_resource_upload_url.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ResourceUploadDefinition', response) + deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore def validate_domain( - self, resource_group_name, service_name, app_name, name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + validate_payload, # type: "_models.CustomDomainValidatePayload" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainValidateResult" """Check the resource name is valid as well as not in use. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param name: Name to be validated - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CustomDomainValidateResult or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidateResult - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param validate_payload: Custom domain payload to be validated. + :type validate_payload: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidatePayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidateResult + :raises: ~azure.core.exceptions.HttpResponseError """ - validate_payload = models.CustomDomainValidatePayload(name=name) + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.validate_domain.metadata['url'] + url = self.validate_domain.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CustomDomainValidateResult', response) + deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_bindings_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_bindings_operations.py index e174262aabf..055f8f16cc1 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_bindings_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_bindings_operations.py @@ -1,53 +1,65 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class BindingsOperations(object): """BindingsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2021_06_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2021-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2021-06-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, app_name, binding_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" """Get a Binding and its properties. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -55,127 +67,133 @@ def get( :type app_name: str :param binding_name: The name of the Binding resource. :type binding_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BindingResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BindingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str') + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BindingResource', response) + deserialized = self._deserialize('BindingResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, service_name, app_name, binding_name, properties=None, custom_headers=None, raw=False, **operation_config): - binding_resource = models.BindingResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str') + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(binding_resource, 'BindingResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('BindingResource', response) + deserialized = self._deserialize('BindingResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('BindingResource', response) + deserialized = self._deserialize('BindingResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('BindingResource', response) + deserialized = self._deserialize('BindingResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, service_name, app_name, binding_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.BindingResource"] """Create a new Binding or update an exiting Binding. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -183,98 +201,130 @@ def create_or_update( :type app_name: str :param binding_name: The name of the Binding resource. :type binding_name: str - :param properties: Properties of the Binding resource - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns BindingResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource]] - :raises: :class:`CloudError` + :param binding_resource: Parameters for the create or update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('BindingResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def _delete_initial( - self, resource_group_name, service_name, app_name, binding_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str') + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, service_name, app_name, binding_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Binding. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -282,104 +332,138 @@ def delete( :type app_name: str :param binding_name: The name of the Binding resource. :type binding_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def _update_initial( - self, resource_group_name, service_name, app_name, binding_name, properties=None, custom_headers=None, raw=False, **operation_config): - binding_resource = models.BindingResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str') + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(binding_resource, 'BindingResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('BindingResource', response) + deserialized = self._deserialize('BindingResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('BindingResource', response) + deserialized = self._deserialize('BindingResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, service_name, app_name, binding_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.BindingResource"] """Operation to update an exiting Binding. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -387,124 +471,144 @@ def update( :type app_name: str :param binding_name: The name of the Binding resource. :type binding_name: str - :param properties: Properties of the Binding resource - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns BindingResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource]] - :raises: :class:`CloudError` + :param binding_resource: Parameters for the update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('BindingResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def list( - self, resource_group_name, service_name, app_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.BindingResourceCollection"] """Handles requests to list all resources in an App. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of BindingResource - :rtype: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourcePaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.BindingResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_certificates_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_certificates_operations.py index bc4a01feace..51ba407eef8 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_certificates_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_certificates_operations.py @@ -1,381 +1,447 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class CertificatesOperations(object): """CertificatesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2021_06_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2021-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2021-06-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, certificate_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateResource" """Get the certificate resource. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param certificate_name: The name of the certificate resource. :type certificate_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CertificateResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateResource', response) + deserialized = self._deserialize('CertificateResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, service_name, certificate_name, properties=None, custom_headers=None, raw=False, **operation_config): - certificate_resource = models.CertificateResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + certificate_resource, # type: "_models.CertificateResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(certificate_resource, 'CertificateResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_resource, 'CertificateResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('CertificateResource', response) + deserialized = self._deserialize('CertificateResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('CertificateResource', response) + deserialized = self._deserialize('CertificateResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('CertificateResource', response) + deserialized = self._deserialize('CertificateResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, service_name, certificate_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + certificate_resource, # type: "_models.CertificateResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CertificateResource"] """Create or update certificate resource. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param certificate_name: The name of the certificate resource. :type certificate_name: str - :param properties: Properties of the certificate resource payload. - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns CertificateResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource]] - :raises: :class:`CloudError` + :param certificate_resource: Parameters for the create or update operation. + :type certificate_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CertificateResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('CertificateResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + certificate_resource=certificate_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore def _delete_initial( - self, resource_group_name, service_name, certificate_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, service_name, certificate_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete the certificate resource. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param certificate_name: The name of the certificate resource. :type certificate_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore def list( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CertificateResourceCollection"] """List all the certificates of one user. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CertificateResource - :rtype: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResourcePaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CertificateResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_config_servers_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_config_servers_operations.py index d7d77ccf976..aba3e06c24d 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_config_servers_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_config_servers_operations.py @@ -1,428 +1,500 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class ConfigServersOperations(object): """ConfigServersOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2021_06_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2021-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2021-06-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" """Get the config server and its properties. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ConfigServerResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigServerResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ConfigServerResource', response) + deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _update_put_initial( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, **operation_config): - config_server_resource = models.ConfigServerResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update_put.metadata['url'] + url = self._update_put_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ConfigServerResource', response) + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('ConfigServerResource', response) + deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update_put( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + def begin_update_put( + self, + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerResource"] """Update the config server. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param properties: Properties of the Config Server resource - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns ConfigServerResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource]] - :raises: :class:`CloudError` + :param config_server_resource: Parameters for the update operation. + :type config_server_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('ConfigServerResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _update_patch_initial( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, **operation_config): - config_server_resource = models.ConfigServerResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update_patch.metadata['url'] + url = self._update_patch_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ConfigServerResource', response) + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('ConfigServerResource', response) + deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update_patch( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + def begin_update_patch( + self, + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerResource"] """Update the config server. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param properties: Properties of the Config Server resource - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns ConfigServerResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource]] - :raises: :class:`CloudError` + :param config_server_resource: Parameters for the update operation. + :type config_server_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('ConfigServerResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _validate_initial( - self, resource_group_name, service_name, git_property=None, custom_headers=None, raw=False, **operation_config): - config_server_settings = models.ConfigServerSettings(git_property=git_property) + self, + resource_group_name, # type: str + service_name, # type: str + config_server_settings, # type: "_models.ConfigServerSettings" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerSettingsValidateResult" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.validate.metadata['url'] + url = self._validate_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ConfigServerSettingsValidateResult', response) + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('ConfigServerSettingsValidateResult', response) + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def validate( - self, resource_group_name, service_name, git_property=None, custom_headers=None, raw=False, polling=True, **operation_config): + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + + def begin_validate( + self, + resource_group_name, # type: str + service_name, # type: str + config_server_settings, # type: "_models.ConfigServerSettings" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerSettingsValidateResult"] """Check if the config server settings are valid. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param git_property: Property of git environment. - :type git_property: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerGitProperty - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns - ConfigServerSettingsValidateResult or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettingsValidateResult] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettingsValidateResult]] - :raises: :class:`CloudError` + :param config_server_settings: Config server settings to be validated. + :type config_server_settings: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - git_property=git_property, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('ConfigServerSettingsValidateResult', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_settings=config_server_settings, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_custom_domains_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_custom_domains_operations.py index ea9c40362bf..e7e4cafb94e 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_custom_domains_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_custom_domains_operations.py @@ -1,53 +1,65 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class CustomDomainsOperations(object): """CustomDomainsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2021_06_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2021-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2021-06-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, app_name, domain_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" """Get the custom domain of one lifecycle application. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -55,127 +67,133 @@ def get( :type app_name: str :param domain_name: The name of the custom domain resource. :type domain_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CustomDomainResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str') + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CustomDomainResource', response) + deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, service_name, app_name, domain_name, properties=None, custom_headers=None, raw=False, **operation_config): - domain_resource = models.CustomDomainResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str') + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('CustomDomainResource', response) + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('CustomDomainResource', response) + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('CustomDomainResource', response) + deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, service_name, app_name, domain_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CustomDomainResource"] """Create or update custom domain of one lifecycle application. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -183,98 +201,130 @@ def create_or_update( :type app_name: str :param domain_name: The name of the custom domain resource. :type domain_name: str - :param properties: Properties of the custom domain resource. - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns CustomDomainResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource]] - :raises: :class:`CloudError` + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('CustomDomainResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def _delete_initial( - self, resource_group_name, service_name, app_name, domain_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str') + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, service_name, app_name, domain_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete the custom domain of one lifecycle application. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -282,104 +332,138 @@ def delete( :type app_name: str :param domain_name: The name of the custom domain resource. :type domain_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def _update_initial( - self, resource_group_name, service_name, app_name, domain_name, properties=None, custom_headers=None, raw=False, **operation_config): - domain_resource = models.CustomDomainResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str') + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('CustomDomainResource', response) + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('CustomDomainResource', response) + deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, service_name, app_name, domain_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CustomDomainResource"] """Update custom domain of one lifecycle application. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -387,124 +471,144 @@ def update( :type app_name: str :param domain_name: The name of the custom domain resource. :type domain_name: str - :param properties: Properties of the custom domain resource. - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns CustomDomainResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource]] - :raises: :class:`CloudError` + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('CustomDomainResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def list( - self, resource_group_name, service_name, app_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CustomDomainResourceCollection"] """List the custom domains of one lifecycle application. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of CustomDomainResource - :rtype: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResourcePaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.CustomDomainResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_deployments_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_deployments_operations.py index 1ff5f294302..0c1fe5d247f 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_deployments_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_deployments_operations.py @@ -1,53 +1,65 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class DeploymentsOperations(object): """DeploymentsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2021_06_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2021-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2021-06-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" """Get a Deployment and its properties. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -55,127 +67,133 @@ def get( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DeploymentResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, service_name, app_name, deployment_name, properties=None, sku=None, custom_headers=None, raw=False, **operation_config): - deployment_resource = models.DeploymentResource(properties=properties, sku=sku) + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, service_name, app_name, deployment_name, properties=None, sku=None, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentResource"] """Create a new Deployment or update an exiting Deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -183,101 +201,130 @@ def create_or_update( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param properties: Properties of the Deployment resource - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource - :type sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns DeploymentResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource]] - :raises: :class:`CloudError` + :param deployment_resource: Parameters for the create or update operation. + :type deployment_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - properties=properties, - sku=sku, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('DeploymentResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def _delete_initial( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -285,104 +332,138 @@ def delete( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def _update_initial( - self, resource_group_name, service_name, app_name, deployment_name, properties=None, sku=None, custom_headers=None, raw=False, **operation_config): - deployment_resource = models.DeploymentResource(properties=properties, sku=sku) + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('DeploymentResource', response) + deserialized = self._deserialize('DeploymentResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, service_name, app_name, deployment_name, properties=None, sku=None, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentResource"] """Operation to update an exiting Deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -390,260 +471,296 @@ def update( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param properties: Properties of the Deployment resource - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource - :type sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns DeploymentResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource]] - :raises: :class:`CloudError` + :param deployment_resource: Parameters for the update operation. + :type deployment_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - properties=properties, - sku=sku, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('DeploymentResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def list( - self, resource_group_name, service_name, app_name, version=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + version=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentResourceCollection"] """Handles requests to list all resources in an App. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed + :param version: Version of the deployments to be listed. :type version: list[str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DeploymentResource - :rtype: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourcePaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str') + 'appName': self._serialize.url("app_name", app_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if version is not None: - query_parameters['version'] = self._serialize.query("version", version, '[str]', div=',') + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DeploymentResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore def list_for_cluster( - self, resource_group_name, service_name, version=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + version=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentResourceCollection"] """List deployments for a certain service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed + :param version: Version of the deployments to be listed. :type version: list[str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DeploymentResource - :rtype: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourcePaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_for_cluster.metadata['url'] + url = self.list_for_cluster.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') if version is not None: - query_parameters['version'] = self._serialize.query("version", version, '[str]', div=',') + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DeploymentResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} + return pipeline_response + return ItemPaged( + get_next, extract_data + ) + list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore def _start_initial( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL - url = self.start.metadata['url'] + url = self._start_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def start( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + + def begin_start( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Start the deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -651,88 +768,124 @@ def start( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore def _stop_initial( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL - url = self.stop.metadata['url'] + url = self._stop_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def stop( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + + def begin_stop( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Stop the deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -740,88 +893,124 @@ def stop( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore def _restart_initial( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL - url = self.restart.metadata['url'] + url = self._restart_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def restart( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + + def begin_restart( + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Restart the deployment. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -829,48 +1018,75 @@ def restart( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore def get_log_file_url( - self, resource_group_name, service_name, app_name, deployment_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.LogFileUrlResponse"] """Get deployment log file URL. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str @@ -878,58 +1094,52 @@ def get_log_file_url( :type app_name: str :param deployment_name: The name of the Deployment resource. :type deployment_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: LogFileUrlResponse or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.LogFileUrlResponse - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogFileUrlResponse, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.LogFileUrlResponse or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LogFileUrlResponse"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get_log_file_url.metadata['url'] + url = self.get_log_file_url.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serviceName': self._serialize.url("service_name", service_name, 'str'), 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str') + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('LogFileUrlResponse', response) + deserialized = self._deserialize('LogFileUrlResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} + get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_monitoring_settings_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_monitoring_settings_operations.py index 0bf89fa82af..4b278909b72 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_monitoring_settings_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_monitoring_settings_operations.py @@ -1,322 +1,369 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class MonitoringSettingsOperations(object): """MonitoringSettingsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2021_06_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2021-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2021-06-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" """Get the Monitoring Setting and its properties. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MonitoringSettingResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoringSettingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('MonitoringSettingResource', response) + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore def _update_put_initial( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, **operation_config): - monitoring_setting_resource = models.MonitoringSettingResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update_put.metadata['url'] + url = self._update_put_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('MonitoringSettingResource', response) + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('MonitoringSettingResource', response) + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update_put( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + def begin_update_put( + self, + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.MonitoringSettingResource"] """Update the Monitoring Setting. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param properties: Properties of the Monitoring Setting resource - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns - MonitoringSettingResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource]] - :raises: :class:`CloudError` + :param monitoring_setting_resource: Parameters for the update operation. + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('MonitoringSettingResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore def _update_patch_initial( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, **operation_config): - monitoring_setting_resource = models.MonitoringSettingResource(properties=properties) + self, + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update_patch.metadata['url'] + url = self._update_patch_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('MonitoringSettingResource', response) + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('MonitoringSettingResource', response) + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update_patch( - self, resource_group_name, service_name, properties=None, custom_headers=None, raw=False, polling=True, **operation_config): + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + def begin_update_patch( + self, + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.MonitoringSettingResource"] """Update the Monitoring Setting. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param properties: Properties of the Monitoring Setting resource - :type properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns - MonitoringSettingResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource]] - :raises: :class:`CloudError` + :param monitoring_setting_resource: Parameters for the update operation. + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - properties=properties, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('MonitoringSettingResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_operations.py index d4951ff128c..3a411f52957 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_operations.py @@ -1,103 +1,109 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class Operations(object): """Operations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2021_06_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2021-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2021-06-01-preview" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): - """Lists all of the available REST API operations of the - Microsoft.AppPlatform provider. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of OperationDetail - :rtype: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDetailPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDetail] - :raises: :class:`CloudError` + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AvailableOperations"] + """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailableOperations or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AvailableOperations] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] - + url = self.list.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('AvailableOperations', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.OperationDetailPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_runtime_versions_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_runtime_versions_operations.py index ff859f927be..26067aebd4f 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_runtime_versions_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_runtime_versions_operations.py @@ -1,93 +1,92 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class RuntimeVersionsOperations(object): """RuntimeVersionsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2021_06_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2021-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2021-06-01-preview" - - self.config = config + self._config = config def list_runtime_versions( - self, custom_headers=None, raw=False, **operation_config): - """Lists all of the available runtime versions supported by - Microsoft.AppPlatform provider. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: AvailableRuntimeVersions or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.AvailableRuntimeVersions - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + self, + **kwargs # type: Any + ): + # type: (...) -> "_models.AvailableRuntimeVersions" + """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailableRuntimeVersions, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AvailableRuntimeVersions + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableRuntimeVersions"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL - url = self.list_runtime_versions.metadata['url'] + url = self.list_runtime_versions.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('AvailableRuntimeVersions', response) + deserialized = self._deserialize('AvailableRuntimeVersions', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_services_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_services_operations.py index 8372978d908..ec19c6b6bc1 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_services_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_services_operations.py @@ -1,859 +1,931 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class ServicesOperations(object): """ServicesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2021_06_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2021-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2021-06-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" """Get a Service and its properties. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ServiceResource or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ServiceResource', response) + deserialized = self._deserialize('ServiceResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, service_name, resource, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(resource, 'ServiceResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ServiceResource', response) + deserialized = self._deserialize('ServiceResource', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('ServiceResource', response) + deserialized = self._deserialize('ServiceResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('ServiceResource', response) + deserialized = self._deserialize('ServiceResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, service_name, resource, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ServiceResource"] """Create a new Service or update an exiting Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param resource: Parameters for the create or update operation - :type resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns ServiceResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource]] - :raises: :class:`CloudError` + :param resource: Parameters for the create or update operation. + :type resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('ServiceResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _delete_initial( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - def delete( - self, resource_group_name, service_name, custom_headers=None, raw=False, polling=True, **operation_config): + def begin_delete( + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _update_initial( - self, resource_group_name, service_name, resource, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.update.metadata['url'] + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(resource, 'ServiceResource') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('ServiceResource', response) + deserialized = self._deserialize('ServiceResource', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('ServiceResource', response) + deserialized = self._deserialize('ServiceResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, service_name, resource, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ServiceResource"] """Operation to update an exiting Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param resource: Parameters for the update operation - :type resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns ServiceResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource]] - :raises: :class:`CloudError` + :param resource: Parameters for the update operation. + :type resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('ServiceResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def list_test_keys( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """List test keys for a Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TestKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeys or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL - url = self.list_test_keys.metadata['url'] + url = self.list_test_keys.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('TestKeys', response) + deserialized = self._deserialize('TestKeys', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore def regenerate_test_key( - self, resource_group_name, service_name, key_type, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + regenerate_test_key_request, # type: "_models.RegenerateTestKeyRequestPayload" + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """Regenerate a test key for a Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param key_type: Type of the test key. Possible values include: - 'Primary', 'Secondary' - :type key_type: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeyType - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TestKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeys or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param regenerate_test_key_request: Parameters for the operation. + :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2021_06_01_preview.models.RegenerateTestKeyRequestPayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError """ - regenerate_test_key_request = models.RegenerateTestKeyRequestPayload(key_type=key_type) + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.regenerate_test_key.metadata['url'] + url = self.regenerate_test_key.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('TestKeys', response) + deserialized = self._deserialize('TestKeys', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore def disable_test_endpoint( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Disable test endpoint functionality for a Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL - url = self.disable_test_endpoint.metadata['url'] + url = self.disable_test_endpoint.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} + disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore def enable_test_endpoint( - self, resource_group_name, service_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """Enable test endpoint functionality for a Service. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TestKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeys or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL - url = self.enable_test_endpoint.metadata['url'] + url = self.enable_test_endpoint.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str') + 'serviceName': self._serialize.url("service_name", service_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('TestKeys', response) + deserialized = self._deserialize('TestKeys', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore def check_name_availability( - self, location, type, name, custom_headers=None, raw=False, **operation_config): + self, + location, # type: str + availability_parameters, # type: "_models.NameAvailabilityParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.NameAvailability" """Checks that the resource name is valid and is not already in use. - :param location: the region + :param location: the region. :type location: str - :param type: Type of the resource to check name availability - :type type: str - :param name: Name to be checked - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: NameAvailability or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailability or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param availability_parameters: Parameters supplied to the operation. + :type availability_parameters: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailability + :raises: ~azure.core.exceptions.HttpResponseError """ - availability_parameters = models.NameAvailabilityParameters(type=type, name=name) + cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailability"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.check_name_availability.metadata['url'] + url = self.check_name_availability.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('NameAvailability', response) + deserialized = self._deserialize('NameAvailability', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore def list_by_subscription( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServiceResourceList"] """Handles requests to list all resources in a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ServiceResource - :rtype: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourcePaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list_by_subscription.metadata['url'] + url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ServiceResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ServiceResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore def list( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServiceResourceList"] """Handles requests to list all resources in a resource group. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ServiceResource - :rtype: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourcePaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ServiceResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ServiceResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_skus_operations.py b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_skus_operations.py index 43af9938c8b..8ebe4102035 100644 --- a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_skus_operations.py +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/operations/_skus_operations.py @@ -1,106 +1,113 @@ # 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. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class SkusOperations(object): """SkusOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2021_06_01_preview.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2021-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2021-06-01-preview" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ResourceSkuCollection"] """Lists all of the available skus of the Microsoft.AppPlatform provider. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ResourceSku - :rtype: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSku] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuCollection] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourceSkuPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore diff --git a/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/py.typed b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/src/spring-cloud/azext_spring_cloud/vendored_sdks/appplatform/v2021_06_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/src/spring-cloud/setup.py b/src/spring-cloud/setup.py index bec7367dc21..ef5d726e98c 100644 --- a/src/spring-cloud/setup.py +++ b/src/spring-cloud/setup.py @@ -16,7 +16,7 @@ # TODO: Confirm this is the right version number you want and it matches your # HISTORY.rst entry. -VERSION = '2.6.0' +VERSION = '2.7.0' # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers